pg数据库新建账号、赋权限、删除账号

--切换到管理员账号(postgres),新建普通账号
CREATE USER test_phq WITH PASSWORD 'pcms';
--切换到指定数据库public下(yuding)、赋予数据库级别的权限
GRANT ALL PRIVILEGES ON DATABASE yuding TO test_phq;
--切换到指定数据库public下(yuding)、赋予全部表的全部权限
GRANT ALL PRIVILEGES ON ALL TABLES    IN SCHEMA public TO test_phq;
--切换到指定数据库public下(yuding)、赋予全部序列的全部权限
GRANT ALL PRIVILEGES ON ALL sequences IN SCHEMA public TO test_phq;
--切换到指定数据库public下(yuding)、删除普通账号
REASSIGN OWNED BY test_phq TO postgres;
DROP OWNED BY test_phq;
DROP USER test_phq;

 

posted @ 2019-12-30 17:39  小泉哥  阅读(2432)  评论(0编辑  收藏  举报