姓名:刘浩然。 2020年大目标Python

postgresql后期给开发建表的权限问题

1、切换到指定数据库

\c axyh_360p_hunan_mobile_security_manage
View Code

2、回收权限

1 revoke connect on database axyh_360p_hunan_mobile_security_manage from public;
回收权限

3、设置授权后的权限

grant对以及在数据库的表进行授权

alter default 对新建的表进行授权延续

1 alter default privileges for user bd_zhangranran in schema public grant insert,select,update,delete,references,trigger on tables to bd_weidubin;
2 运维人员可能会进行重新导表,所以postgres用户也要进行授权延续操作
3 alter default privileges for user postgres in schema public grant insert,select,update,delete,references,trigger on tables to bd_weidubin;
授权延续

后期zhangjun用户在publi模式下建的表具有insert,select,update,delete,references,trigger权限。grant是对当时及以前的。alter default是对之后的

4、授予连接权限

1 grant connect on database axyh_360p_hunan_mobile_security_manage to bd_miaoyongchao;
授予连接权限

 

连接文档:
https://blog.csdn.net/wanghai__/article/details/6337570
权限文档:
http://www.freeoa.net/osuport/db/the-postgres-privileges_3112.html

posted @ 2019-08-07 13:32  pluto2charon  阅读(2165)  评论(0编辑  收藏  举报