1.. 只读账号授权

# 超级用户登录数据库
create user ro_user password 'readonly';

# 设置Postgres数据库为只读的transaction
alter user ro_user set default_transaction_read_only=on;

# 赋予用户权限,查看public模式下所有表:(新建表也会有只读权限)
grant usage on schema public to ro_user;
alter default privileges in schema public grant select on tables to ro_user;

# 赋予用户连接数据库权限
grant connect on database zhong to ro_user;
# 切换到指定数据库
\c zhong
# 赋予用户表、序列查看权限
grant usage on schema public to ro_user;
grant select on all sequences in schema public to ro_user;
grant select on all tables in schema public to ro_user;
————————————————
https://blog.csdn.net/weixin_38623994/article/details/106651022

 

相关文章:

  • 2021-10-03
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-11-21
  • 2021-08-16
  • 2021-12-06
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2021-12-17
  • 2022-12-23
  • 2021-10-27
  • 2021-10-07
  • 2021-08-03
相关资源
相似解决方案