postgresql-只读账号授权
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
用一个例子来演示会更加清晰