使用createuser来创建用户

  1. [postgres@web1 ~]$ /data/pgsql/bin/createuser --help
  2. createuser creates a new PostgreSQL role.
  3. Usage:
  4. createuser [OPTION]... [ROLENAME]
  5. Options:
  6. -c, --connection-limit=N  connection limit for role (default: no limit)
  7. -d, --createdb            role can create new databases
  8. -D, --no-createdb         role cannot create databases (default)
  9. -e, --echo                show the commands being sent to the server
  10. -E, --encrypted           encrypt stored password
  11. -i, --inherit             role inherits privileges of roles it is a
  12. member of (default)
  13. -I, --no-inherit          role does not inherit privileges
  14. -l, --login               role can login (default)
  15. -L, --no-login            role cannot login
  16. -N, --unencrypted         do not encrypt stored password
  17. -P, --pwprompt            assign a password to new role
  18. -r, --createrole          role can create new roles
  19. -R, --no-createrole       role cannot create roles (default)
  20. -s, --superuser           role will be superuser
  21. -S, --no-superuser        role will not be superuser (default)
  22. -V, --version             output version information, then exit
  23. --interactive             prompt for missing role name and attributes rather
  24. than using defaults
  25. --replication             role can initiate replication
  26. --no-replication          role cannot initiate replication
  27. -?, --help                show this help, then exit
  28. Connection options:
  29. -h, --host=HOSTNAME       database server host or socket directory
  30. -p, --port=PORT           database server port
  31. -U, --username=USERNAME   user name to connect as (not the one to create)
  32. -w, --no-password         never prompt for password
  33. -W, --password            force password prompt
  34. Report bugs to <pgsql-bugs@postgresql.org>.
  35. [postgres@web1 ~]$
  36. [postgres@web1 ~]$
  37. [postgres@web1 ~]$ /data/pgsql/bin/createuser zhongwc -P
  38. Enter password for new role:
  39. Enter it again:
  40. [postgres@web1 ~]$

使用createdb创建数据库

  1. [postgres@web1 ~]$ /data/pgsql/bin/createdb --help
  2. createdb creates a PostgreSQL database.
  3. Usage:
  4. createdb [OPTION]... [DBNAME] [DESCRIPTION]
  5. Options:
  6. -D, --tablespace=TABLESPACE  default tablespace for the database
  7. -e, --echo                   show the commands being sent to the server
  8. -E, --encoding=ENCODING      encoding for the database
  9. -l, --locale=LOCALE          locale settings for the database
  10. --lc-collate=LOCALE      LC_COLLATE setting for the database
  11. --lc-ctype=LOCALE        LC_CTYPE setting for the database
  12. -O, --owner=OWNER            database user to own the new database
  13. -T, --template=TEMPLATE      template database to copy
  14. -V, --version                output version information, then exit
  15. -?, --help                   show this help, then exit
  16. Connection options:
  17. -h, --host=HOSTNAME          database server host or socket directory
  18. -p, --port=PORT              database server port
  19. -U, --username=USERNAME      user name to connect as
  20. -w, --no-password            never prompt for password
  21. -W, --password               force password prompt
  22. --maintenance-db=DBNAME      alternate maintenance database
  23. By default, a database with the same name as the current user is created.
  24. Report bugs to <pgsql-bugs@postgresql.org>.
  25. [postgres@web1 ~]$
  26. [postgres@web1 ~]$
  27. [postgres@web1 ~]$ /data/pgsql/bin/createdb zwcdb
  1. [postgres@web1 ~]$ psql -U zhongwc -d zwcdb
  2. psql (9.2.2)
  3. Type "help" for help.
  4. zwcdb=> help
  5. You are using psql, the command-line interface to PostgreSQL.
  6. Type:  \copyright for distribution terms
  7. \h for help with SQL commands
  8. \? for help with psql commands
  9. \g or terminate with semicolon to execute query
  10. \q to quit
  11. zwcdb=>

创建表

  1. [postgres@web1 data]$ psql -U zhongwc -d zwcdb -h 192.168.1.203 -p 1521
  2. Password for user zhongwc:
  3. psql (9.2.2)
  4. Type "help" for help.
  5. zwcdb=> create table t_zhongwc(pid integer,pname varchar(32),constraint zhongwc_pid_pk primary key(pid));
  6. NOTICE:  CREATE TABLE / PRIMARY KEY will create implicit index "zhongwc_pid_pk" for table "t_zhongwc"
  7. CREATE TABLE
  8. zwcdb=>
  9. zwcdb=> select * from t_zhongwc;
  10. pid | pname
  11. -----+-------
  12. (0 rows)

删除表

    1. zwcdb=> drop table t_zhongwc;
    2. DROP TABLE
    3. zwcdb=> drop table t_zhongwc;
    4. ERROR:  table "t_zhongwc" does not exist

postgres创建用户,表的更多相关文章

  1. oracle 字符集安装错了,修改字符集 及创建用户 表空间 ,删除用户及所有的表

    1.首先以sysdba的身份登录上去 conn /as sysdba 2.关闭数据库shutdown immediate; 3.以mount打来数据库,startup mount 4.设置sessio ...

  2. oracle创建用户表空间

    --本次因工作需要,为其他部门提供部分表数据,创建一个新用户与表空间.--system用户下drop user sys_outside cascade;drop tablespace sys_outs ...

  3. Oracle_PLSQL创建用户表空间

  4. Oracle创建表空间、创建用户以及授权、查看权限

    常用的,留着备用 1.创建临时表空间 CREATE TEMPORARY TABLESPACE test_tempTEMPFILE 'C:\oracle\product\10.1.0\oradata\o ...

  5. Oracle创建用户并给用户授权查询指定表或视图的权限

    MSV31账户登录数据库进行如下操作: CREATE USER NORTHBOUND IDENTIFIED BY NORTHBOUND  DEFAULT TABLESPACE "TBS_DN ...

  6. sql脚本创建用户角色权限表

    /******************************************/ /* 名称:权限管理 */ /* 编写日期:2010.5.20 */ /* 开发者:dangqinghua * ...

  7. ORACLE创建用户,建表空间,授予权限

    1.创建用户表空间 CREATE TABLESPACE my_tsLOGGINGDATAFILE 'D:\app\win7\oradata\orcl\my_ts.dbf' SIZE 10M AUTOE ...

  8. oracle创建临时表空间、用户表空间、创建用户关联表空间、授权等

    1.创建临时表空间 CREATE TEMPORARY TABLESPACE test_temp TEMPFILE 'C:\oracle\product\10.1.0\oradata\orcl\test ...

  9. oracle11g 创建用户并授权

    Oracle创建用户并给用户授权查询指定表或视图的权限用sys账户登录数据库进行如下操作: CREATE USER NORTHBOUND IDENTIFIED BY NORTHBOUND DEFAUL ...

随机推荐

  1. 禁用ipv6

    禁用ipv6 1.在/etc/sysctl.conf 添加一行:net.ipv6.conf.all.disable_ipv6=1 2.在/etc/sysconfig/network 添加一行:NETW ...

  2. Q promise的使用

    虽然es6已经出现一段时间了,但是对于没有使用es6的node.js的时候,仍要解决回调金字塔,因此Q还是很有必要的.

  3. 建字段_添加数据_生成json.php

    <?php header("Content-Type:text/html;charset=utf8"); class db{ static $localhost = &quo ...

  4. 设计模式~简单工厂模式(Factory)

    简单工厂模式Simple Factory根据提供给它的数据,返回一个类的实例.通常它返回的类都有一个公共的父类(或者接口对象). 简单工厂的作用是实例化对象,而不需要客户了解这个对象属于哪个具体的子类 ...

  5. OGRFeature的DestroyFeature方法

    Ogr的销毁DestroyFeature方法: void OGRFeature::DestroyFeature( OGRFeature *poFeature ) { delete poFeature; ...

  6. python set add 导致问题 TypeError: unhashable type: 'list'

    问题复现 >>> a = set() >>> b = set() >>> b.add(1) >>> a.add(b) Trace ...

  7. Java基础之在窗口中绘图——使用模型/视图体系结构在视图中绘图(Sketcher 1 drawing a 3D rectangle)

    控制台程序. 在模型中表示数据视图的类用来显示草图并处理用户的交互操作,所以这种类把显示方法和草图控制器合并在一起.不专用于某个视图的通用GUI创建和操作在SketcherFrame类中处理. 模型对 ...

  8. Java基础之创建窗口——向窗口中添加菜单(Sketcher)

    控制台程序. JMenuBar对象表示放在窗口顶部的菜单栏.可以为JMenuBar对象添加JMenu或JMenuItem对象,它们都显示在菜单栏上.JMenu对象是带有标签的菜单,单击就可以显示一列菜 ...

  9. windows下根据端口号杀死进程

    Windows不像Linux,Unix那样,ps -ef 查出端口和进程号,然后根据进程号直接kill进程. Windows根据端口号杀死进程要分三步: 第一步 根据端口号寻找进程号 C:\>n ...

  10. linux文件编码

    linux下新建一个文件,或采用fopen新建,那么文件的编码是什么? 怎么查看文件编码格式: 查看文件编码file命令file ip.txt ip.txt: UTF-8 Unicode text, ...