postgresql回收权限以及删除用户
1 min read

postgresql回收权限以及删除用户

  1. 回收schema的usage权限
revoke USAGE ON SCHEMA public from user_name;
  1. 回收public下所有表的查询权限:
revoke SELECT ON ALL TABLES IN SCHEMA public from user_name;
  1. 回收public下所有序列的查询权限
revoke SELECT ON ALL SEQUENCES IN SCHEMA public from user_name;
  1. 回收默认权限
ALTER DEFAULT PRIVILEGES IN SCHEMA public revoke SELECT ON TABLES from user_name;
  1. 关闭数据库连接权限
revoke CONNECT ON DATABASE db_name from user_name;
  1. 关闭默认只读事务设置
alter user user_name set default_transaction_read_only=off;
  1. 查看权限是否为空了
\ddp
  1. 通过管理员删除user_name用户:
drop user user_name;
京ICP备19055754号