
近期有同学反馈在使用PG数据库的时候,明明之前创建的账号已经授权了查看所有表的权限,为何却查不到新建表?到底该如何授权?
1. 常见授权脚本
create user test_user with password 'password';
grant usage on schema public to test_user;
grant select on all tables in schema public to test_user;
alter default privileges in schema public grant select on tables to test_user;
grant all privileges on all tables in schema public to test_user;grant all privileges on all sequences in schema public to test_user;
2. 查看用户权限
很多时候也需要查看用户有哪些权限,因此常见的权限查看脚本如下
查看某用户的系统权限
SELECT * FROM pg_roles WHERE rolname='test_user';
查看某用户的表权限
select * from information_schema.table_privileges where grantee='test_user';
select * from information_schema.usage_privileges where grantee='test_user';
查看某用户在存储过程函数的执行权限
select * from information_schema.routine_privileges where grantee='test_user';
查看某用户在某表的列上的权限
select * from information_schema.column_privileges where grantee='test_user';
查看当前用户能够访问的数据类型
select * from information_schema.data_type_privileges ;
查看用户自定义类型上授予的USAGE权限
select * from information_schema.udt_privileges where grantee='test_user';

2. mysql8.0新增用户及加密规则修改的那些事
3. 比hive快10倍的大数据查询利器-- presto
4. 监控利器出鞘:Prometheus+Grafana监控MySQL、Redis数据库
5. PostgreSQL主从复制--物理复制
6. MySQL传统点位复制在线转为GTID模式复制




文章转载自数据库干货铺,如果涉嫌侵权,请发送邮件至:contact@modb.pro进行举报,并提供相关证据,一经查实,墨天轮将立刻删除相关内容。




