首批通过分布式安全可靠测评,为关键业务系统打造
information_schema.SCHEMA_PRIVILEGES
更新时间:2026-07-15 20:42:47
说明
该视图从 V1.4 版本开始引入。
功能描述
展示数据库权限信息。
字段说明
| 字段名称 | 类型 | 是否可以为 NULL | 描述 |
|---|---|---|---|
| GRANTEE | varchar(81) | NO | 被授予权限的账户名 |
| TABLE_CATALOG | varchar(512) | NO | 固定值(def) |
| TABLE_SCHEMA | varchar(128) | NO | 数据库名 |
| PRIVILEGE_TYPE | varchar(64) | NO | 授予的权限 |
| IS_GRANTABLE | varchar(3) | NO | 是否可转授 |
查询示例
查看数据库权限信息,展示前 5 条记录。
obclient [oceanbase]> SELECT * FROM information_schema.SCHEMA_PRIVILEGES LIMIT 5;
查询结果如下:
+------------+---------------+--------------------+----------------+--------------+
| GRANTEE | TABLE_CATALOG | TABLE_SCHEMA | PRIVILEGE_TYPE | IS_GRANTABLE |
+------------+---------------+--------------------+----------------+--------------+
| 'root'@'%' | def | information_schema | ALTER | NO |
| 'root'@'%' | def | information_schema | CREATE | NO |
| 'root'@'%' | def | information_schema | DELETE | NO |
| 'root'@'%' | def | information_schema | DROP | NO |
| 'root'@'%' | def | information_schema | INSERT | NO |
+------------+---------------+--------------------+----------------+--------------+
5 rows in set