postgres创建用户,表
使用createuser来创建用户
- [postgres@web1 ~]$ /data/pgsql/bin/createuser --help
- createuser creates a new PostgreSQL role.
- Usage:
- createuser [OPTION]... [ROLENAME]
- Options:
- -c, --connection-limit=N connection limit for role (default: no limit)
- -d, --createdb role can create new databases
- -D, --no-createdb role cannot create databases (default)
- -e, --echo show the commands being sent to the server
- -E, --encrypted encrypt stored password
- -i, --inherit role inherits privileges of roles it is a
- member of (default)
- -I, --no-inherit role does not inherit privileges
- -l, --login role can login (default)
- -L, --no-login role cannot login
- -N, --unencrypted do not encrypt stored password
- -P, --pwprompt assign a password to new role
- -r, --createrole role can create new roles
- -R, --no-createrole role cannot create roles (default)
- -s, --superuser role will be superuser
- -S, --no-superuser role will not be superuser (default)
- -V, --version output version information, then exit
- --interactive prompt for missing role name and attributes rather
- than using defaults
- --replication role can initiate replication
- --no-replication role cannot initiate replication
- -?, --help show this help, then exit
- Connection options:
- -h, --host=HOSTNAME database server host or socket directory
- -p, --port=PORT database server port
- -U, --username=USERNAME user name to connect as (not the one to create)
- -w, --no-password never prompt for password
- -W, --password force password prompt
- Report bugs to <pgsql-bugs@postgresql.org>.
- [postgres@web1 ~]$
- [postgres@web1 ~]$
- [postgres@web1 ~]$ /data/pgsql/bin/createuser zhongwc -P
- Enter password for new role:
- Enter it again:
- [postgres@web1 ~]$
使用createdb创建数据库
- [postgres@web1 ~]$ /data/pgsql/bin/createdb --help
- createdb creates a PostgreSQL database.
- Usage:
- createdb [OPTION]... [DBNAME] [DESCRIPTION]
- Options:
- -D, --tablespace=TABLESPACE default tablespace for the database
- -e, --echo show the commands being sent to the server
- -E, --encoding=ENCODING encoding for the database
- -l, --locale=LOCALE locale settings for the database
- --lc-collate=LOCALE LC_COLLATE setting for the database
- --lc-ctype=LOCALE LC_CTYPE setting for the database
- -O, --owner=OWNER database user to own the new database
- -T, --template=TEMPLATE template database to copy
- -V, --version output version information, then exit
- -?, --help show this help, then exit
- Connection options:
- -h, --host=HOSTNAME database server host or socket directory
- -p, --port=PORT database server port
- -U, --username=USERNAME user name to connect as
- -w, --no-password never prompt for password
- -W, --password force password prompt
- --maintenance-db=DBNAME alternate maintenance database
- By default, a database with the same name as the current user is created.
- Report bugs to <pgsql-bugs@postgresql.org>.
- [postgres@web1 ~]$
- [postgres@web1 ~]$
- [postgres@web1 ~]$ /data/pgsql/bin/createdb zwcdb
- [postgres@web1 ~]$ psql -U zhongwc -d zwcdb
- psql (9.2.2)
- Type "help" for help.
- zwcdb=> help
- You are using psql, the command-line interface to PostgreSQL.
- Type: \copyright for distribution terms
- \h for help with SQL commands
- \? for help with psql commands
- \g or terminate with semicolon to execute query
- \q to quit
- zwcdb=>
创建表
- [postgres@web1 data]$ psql -U zhongwc -d zwcdb -h 192.168.1.203 -p 1521
- Password for user zhongwc:
- psql (9.2.2)
- Type "help" for help.
- zwcdb=> create table t_zhongwc(pid integer,pname varchar(32),constraint zhongwc_pid_pk primary key(pid));
- NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index "zhongwc_pid_pk" for table "t_zhongwc"
- CREATE TABLE
- zwcdb=>
- zwcdb=> select * from t_zhongwc;
- pid | pname
- -----+-------
- (0 rows)
删除表
- zwcdb=> drop table t_zhongwc;
- DROP TABLE
- zwcdb=> drop table t_zhongwc;
- ERROR: table "t_zhongwc" does not exist
postgres创建用户,表的更多相关文章
- oracle 字符集安装错了,修改字符集 及创建用户 表空间 ,删除用户及所有的表
1.首先以sysdba的身份登录上去 conn /as sysdba 2.关闭数据库shutdown immediate; 3.以mount打来数据库,startup mount 4.设置sessio ...
- oracle创建用户表空间
--本次因工作需要,为其他部门提供部分表数据,创建一个新用户与表空间.--system用户下drop user sys_outside cascade;drop tablespace sys_outs ...
- Oracle_PLSQL创建用户表空间
- Oracle创建表空间、创建用户以及授权、查看权限
常用的,留着备用 1.创建临时表空间 CREATE TEMPORARY TABLESPACE test_tempTEMPFILE 'C:\oracle\product\10.1.0\oradata\o ...
- Oracle创建用户并给用户授权查询指定表或视图的权限
MSV31账户登录数据库进行如下操作: CREATE USER NORTHBOUND IDENTIFIED BY NORTHBOUND DEFAULT TABLESPACE "TBS_DN ...
- sql脚本创建用户角色权限表
/******************************************/ /* 名称:权限管理 */ /* 编写日期:2010.5.20 */ /* 开发者:dangqinghua * ...
- ORACLE创建用户,建表空间,授予权限
1.创建用户表空间 CREATE TABLESPACE my_tsLOGGINGDATAFILE 'D:\app\win7\oradata\orcl\my_ts.dbf' SIZE 10M AUTOE ...
- oracle创建临时表空间、用户表空间、创建用户关联表空间、授权等
1.创建临时表空间 CREATE TEMPORARY TABLESPACE test_temp TEMPFILE 'C:\oracle\product\10.1.0\oradata\orcl\test ...
- oracle11g 创建用户并授权
Oracle创建用户并给用户授权查询指定表或视图的权限用sys账户登录数据库进行如下操作: CREATE USER NORTHBOUND IDENTIFIED BY NORTHBOUND DEFAUL ...
随机推荐
- Linux就这个范儿 第12章 一个网络一个世界
Linux就这个范儿 第12章 一个网络一个世界 与Linux有缘相识还得从一项开发任务说起.十八年前,我在Nucleus OS上开发无线网桥AP,需要加入STP生成树协议(SpanningTree ...
- Python模块(getpass)
getpass getpass模块用于输入信息时不显示,比如输入密码时隐藏.getpass模块接收用户的输入的数据类型是str类型. #!/usr/bin/env python #-*- coding ...
- ICP算法使用遇到的问题
这几天在学习数据关联的方法,本来想使用ICP算法进行距离测距数据的配准,但是用的过程中出现问题,配的不准,而且偏差更大了. 红色的和黄色的2维激光点进行ICP配准,但将变换矩阵和黄色进行乘之后偏差更大 ...
- How do you evaluate music?
I’ve seen several “can’t stand” or “best of” threads in regard to music, and based on some related d ...
- php:PHPExcel导出excel表格
一.动态生成的内容如何能当成文件来下载呢? 方法:1.将Content-Type设置成application/octet-stream就可以了,即[header('Content-Type: appl ...
- C++Primer 第六章
//1.我们通过调用运算符来执行函数.调用运算符的形式是一对圆括号,他作用于一个表达式,该表达式是一个函数或者指向函数的指针.圆括号之内是用逗号分隔的实参列表,用于初始化函数形参.调用表达式的类型就是 ...
- Swift游戏实战-跑酷熊猫 13 二段跳的实现
这节内容我们来实现熊猫的二段跳. 要点: 二段跳的逻辑: 逻辑一,第一次点击屏幕,status就会变成jump. 逻辑二,第二次点击屏幕,status就会变成jump2. 逻辑三,当status变成j ...
- PostgreSQL Obtaining the Result Status
There are several ways to determine the effect of a command. The first method is to use the GETDIAGN ...
- php-wamp滴定仪网站的根目录
1.点击wamp中的Apache中的httpd.conf:如下图修改两处 2.进入wamp的安装目录下:修改这两个文件(目的:修改wamp中网站目录) 内容如下图: 关闭wamp服务:重启wamp
- android 测试(转)
个人接触android的时间也不是很长,稍微总结下在做Android测试的过程中,初次接触的同学需要些什么准备,以及需要些什么知识?下面讲到的东西可能很多人会觉得很简单,但我确实碰到过有新同学对这些点 ...