创建只读账号
1.1以初始化账号登入
[[email protected] ~]# psql -U postgres
1.2创建用户
postgres=# create role develop with login password ‘123456‘;
CREATE ROLE
postgres=# select usename from pg_user;
usename
----------
postgres
test
develop
(3 rows)
1.3切换数据库
\c current_product
1.4赋予只读权限
current_product=# grant select on all tables in schema public to develop;
GRANT
1.5切换到develop用户
current_product=# \c - develop
You are now connected to database "current_product" as user "develop".
1.6检测是否拥有只读权限
current_product=> select * from test;
id
----
(0 rows)
时间: 2024-10-15 13:53:35