电脑桌面
添加蚂蚁七词文库到电脑桌面
安装后可以在桌面快捷访问

PG数据库如何新建只读用户

来源:金蝶云社区作者:金蝶2024-09-2313

PG数据库如何新建只读用户

一 新建全局只读账号

以超级用户登录数据库,创建用户。

create user test password 'test' superuser;

设置为只读transaction

alter role test set default_transaction_read_only=true;



二 新建单个schema只读账号

以超级用户登录数据库,创建用户。

create user readonly password 'readonly';

设置为只读transaction

alter user readonly set default_transaction_read_only=on;

默认postgres数据库public模式下的对象是可以访问的。

访问postgres数据库schema

赋给使用schema的权限

grant usage on schema pg_toast to read_only;

添加所有表的只读权限

grant select on all tables in schema pg_toast  to read_only;



也可以单独给某个表的查询权限

grant select on table tablename  to read_only;

访问huanyu_fi数据库的schema

如果要在别的数据库

PG数据库如何新建只读用户

一 新建全局只读账号以超级用户登录数据库,创建用户。create user test password 'test' superuser;设置为只读transactiona...
点击下载文档文档为doc格式

声明:除非特别标注,否则均为本站原创文章,转载时请以链接形式注明文章出处。如若本站内容侵犯了原著者的合法权益,可联系本站删除。

确认删除?
回到顶部
客服QQ
  • 客服QQ点击这里给我发消息
QQ群
  • 答案:my7c点击这里加入QQ群
支持邮箱
微信
  • 微信