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 ...
随机推荐
- Android RecycleView + CardView 控件简析
今天使用了V7包加入的RecycleView 和 CardView,写篇简析. 先上效果图: 原理图: 这是RecycleView的工作原理: 1.LayoutManager用来处理RecycleVi ...
- android开源框架
1.volley 项目地址 https://github.com/smanikandan14/Volley-demo (1) JSON,图像等的异步下载: (2) 网络请求的排序(scheduli ...
- android自动填写短信验证码
广播类 package com.examp.azuoyoutong.listner; import java.util.regex.Matcher;import java.util.regex.Pat ...
- 第六篇 Integration Services:初级工作流管理
本篇文章是Integration Services系列的第六篇,详细内容请参考原文. 简介在前几篇文章中,我们关注使用增量加载方式加载数据.在本篇文章,我们将关注使用优先约束管理SSIS控制流中的工作 ...
- ASP.NET的运行原理与运行机制 如何:为 IIS 7.0 配置 <system.webServer> 节
https://technet.microsoft.com/zh-cn/sysinternals/bb763179.aspx 当一个HTTP请求到服务器并被IIS接收到之后,IIS首先通过客户端请求的 ...
- VisualStudio如何以源码文本方式打开rc文件
视图 >> 解决方案资源管理器 >> 右击XXX.rc >> 打开方式 >> 源代码(文本)编辑器
- 安装ECshop普遍问题的解决方法
安装ecshop经常会出现以下问题: 1.Strict Standards: Non-static method cls_image::gd_version() should not be calle ...
- 使用CollectionView做横向滑动分页效果:
一开始几页滑动是没有问题的,等滑到三四个页面之后,就出现奇怪的缝隙,一开始死活找不到原因,最后在layout的代理方法minimumLineSpacingForSectionAtIndex返回值设置为 ...
- 算法训练 区间k大数查询
http://lx.lanqiao.org/problem.page?gpid=T11 算法训练 区间k大数查询 时间限制:1.0s 内存限制:256.0MB 问题描述 给定一个 ...
- [原创]java WEB学习笔记75:Struts2 学习之路-- 总结 和 目录
本博客的目的:①总结自己的学习过程,相当于学习笔记 ②将自己的经验分享给大家,相互学习,互相交流,不可商用 内容难免出现问题,欢迎指正,交流,探讨,可以留言,也可以通过以下方式联系. 本人互联网技术爱 ...