PostgreSQL 修改数据库拥有者

PostgreSQL About 1,335 words

查看拥有者

z-blog=# \l
                                                    数据库列表
   名称    | 拥有者 | 字元编码 |            校对规则            |             Ctype              |    存取权限
-----------+--------+----------+--------------------------------+--------------------------------+-----------------
 dbname    | thunk  | UTF8     | Chinese (Simplified)_China.936 | Chinese (Simplified)_China.936 |
 postgres  | thunk  | UTF8     | Chinese (Simplified)_China.936 | Chinese (Simplified)_China.936 |
 template0 | thunk  | UTF8     | Chinese (Simplified)_China.936 | Chinese (Simplified)_China.936 | =c/thunk       +
           |        |          |                                |                                | thunk=CTc/thunk
 template1 | thunk  | UTF8     | Chinese (Simplified)_China.936 | Chinese (Simplified)_China.936 | =c/thunk       +
           |        |          |                                |                                | thunk=CTc/thunk
 z-blog    | z-blog | UTF8     | Chinese (Simplified)_China.936 | Chinese (Simplified)_China.936 |
(5 行记录)

修改用户

alter database "z-blog" owner to "z-blog";

修改权限

方式一:提权

将用户提升为超级管理员

ALTER USER "z-blog" WITH SUPERUSER;

方式二:授权

将该数据库所有的序列权限授予给角色

GRANT USAGE, SELECT ON ALL SEQUENCES IN SCHEMA public TO "z-blog";

将该数据库所有的表权限授予给角色

GRANT ALL PRIVILEGES ON ALL TABLES IN SCHEMA public TO "z-blog";
Views: 4,268 · Posted: 2020-03-25

————        END        ————

Give me a Star, Thanks:)

https://github.com/fendoudebb/LiteNote

扫描下方二维码关注公众号和小程序↓↓↓

扫描下方二维码关注公众号和小程序↓↓↓


Today On History
Browsing Refresh