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 ...
随机推荐
- gpt
gpt 这里sdb是大于2T的那个VD,具体到您的机器,可以先在parted命令中先用list命令列出磁盘,然后用mklabel gpt来转换,具体如下: (parted) select /dev/s ...
- [BS-16] 尽量将View的Opaque属性设置为YES(默认就是YES)
尽量将View的Opaque属性设置为YES(默认就是YES) UIView控件都有一个Opaque属性,如果不会更改view的透明度,那么应该将其opaque属性设置为YES.为什么要这样做呢?其实 ...
- MVC项目实践,在三层架构下实现SportsStore-03,Ninject控制器工厂等
SportsStore是<精通ASP.NET MVC3框架(第三版)>中演示的MVC项目,在该项目中涵盖了MVC的众多方面,包括:使用DI容器.URL优化.导航.分页.购物车.订单.产品管 ...
- Demo4 Slides.js的使用
Slides.js挺好用的啊,把示例中的Demo调试通了.首先把css.img.js文件夹下的内容全部拷贝到Vs网站项目下的Scripts文件夹下. 代码主要修改了一些图片路径和网址链接. <! ...
- 前端学习——css基础知识,选择器与html模板、值得收藏的html标签
一.css需要的html(采用html5标准) DTD,文档类型声明: <!Doctype html> 文本编码声明: <meta charset="utf-8" ...
- python加密模块学习
1. md5模块 md5.new([arg]) 返回一个md5对象,如果给出参数,则相当于调用了update(arg) md5.update(arg) 用string参数arg更新md5对 ...
- G面经Prepare: Search word delete sequence in dictionary
给一个单词一个字典,每次删除单词里任一个字母直到剩下一个字母,形成一个序列,比如office->offce->ofce->ofc->oc->c.问是否字典里存在一个这种序 ...
- JDK安装 配置环境变量
我将JDK安装在D盘中 在D盘中新建一个文件 文件名为JAVA 运行jdk安装软件 更改jdk安装路径为 下一步 等待jdk安装完成 安装jre路径 jre路径改为 点击下一步 等待jre安装完成 注 ...
- 【Origin】jquery.barddialog.js
/// <reference path="jquery-2.1.1.min.js" /> /** * @license jquery.bardDialog 1.0.0 ...
- java项目中可能会使用到的jar包解释
一.Struts2 用的版本是struts2.3.1.1 一个简单的Struts项目所需的jar包有如下8个 1. struts2-core-2.3.1.1.jar: Struts2的核心类库. 2. ...