postgre创建账户

一、创建账号
$ psql -U postgres
psql (9.4.4)
Type "help" for help.


postgres=# \! uuidgen
c1b9ef9e-f09e-4f26-9f34-c048aad3a9b2
postgres=# create role user1 with login password 'c1b9ef9e-f09e-4f26-9f34-c048aad3a9b2';
CREATE ROLE
postgres=# \c rdht01
You are now connected to database "rdht01" as user "postgres".
rdht01=# grant select,update,delete,insert on all tables in schema public to user1;
GRANT
rdht01=# alter default privileges in schema public grant select,update,delete,insert on tables to user1;
ALTER DEFAULT PRIVILEGES
rdht01=# alter default privileges in schema public grant usage on sequences to user1;
ALTER DEFAULT PRIVILEGES


二、删除账号
postgres=# drop owned by user1;
DROP OWNED
postgres=# drop role user1 ;
DROP ROLE

验证

dcs=# \q
[postgres@zhaopin-210-11 tingting.zhang]$ psql -U web_ihr_admin_user -d rdcs -W -h 172.30.230.10
could not change directory to "/home/tingting.zhang": Permission denied
Password for user web_ihr_admin_user: 
psql (9.4.5)
Type "help" for help.


rdcs=> \dt
               List of relations
 Schema |        Name        | Type  |  Owner   
--------+--------------------+-------+----------
 public | cs_x_rd            | table | postgres
 public | csgroup            | table | postgres
 public | cslist             | table | postgres
 public | jobpublishmodule   | table | postgres
 public | jobpublishschedule | table | postgres
 public | operationlog       | table | postgres
 public | org_x_city         | table | postgres
 public | organ              | table | postgres
 public | staff              | table | postgres
(9 rows)


rdcs=> select * from staff limit 1;
 staffid | passportuserid | companyid | orgid | orghostid | staffname | email | telephone | mobile | fax | jobposition | status | cr
eatedate | modifieddate | lastlogindate | email2 | createuserid | modifiedusertid | ctimestamp | accountnumber | staffcode | sourcet
ype | sourceid | passportuserhostid | sourcecompanytype | sourcecompanyid | firstrechargedate 
---------+----------------+-----------+-------+-----------+-----------+-------+-----------+--------+-----+-------------+--------+---
---------+--------------+---------------+--------+--------------+-----------------+------------+---------------+-----------+--------
----+----------+--------------------+-------------------+-----------------+-------------------
(0 rows)

来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/29898569/viewspace-1833801/,如需转载,请注明出处,否则将追究法律责任。

转载于:http://blog.itpub.net/29898569/viewspace-1833801/

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值