Last active
October 25, 2020 11:00
-
-
Save huacnlee/815737ab61cd8de8b08b1a27ab4c2102 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- 创建名称为readonly的只读用户: | |
create user social with password '123456'; | |
-- 然后把在public这个schema下现有的所有表的select权限赋给readobly,并执行下面的SQL命令: | |
grant select on select tables in schema public to social; | |
-- 上面的命令只是把现有的表的权限给了readonly用户,如果此时创建了表,readonly用户还是不能读,需要使用下面的SQL把所建表的select权限也给用户readonly: | |
alter default privileges in schema public grant select on tables to social; | |
----------------------- 全部权限 | |
create user social with password '123456'; | |
grant all ON ALL TABLES in schema public to social; | |
grant all ON ALL SEQUENCES in schema public to social; | |
alter default privileges in schema public grant all on tables to social; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
调整 Sequence 的起步