USER_PRIVILEGES

USER_PRIVILEGES 表提供了关于全局权限的信息。该表的数据根据 mysql.user 系统表生成。

USE information_schema; DESC user_privileges;
+----------------+--------------+------+------+---------+-------+ | Field | Type | Null | Key | Default | Extra | +----------------+--------------+------+------+---------+-------+ | GRANTEE | varchar(81) | YES | | NULL | | | TABLE_CATALOG | varchar(512) | YES | | NULL | | | PRIVILEGE_TYPE | varchar(64) | YES | | NULL | | | IS_GRANTABLE | varchar(3) | YES | | NULL | | +----------------+--------------+------+------+---------+-------+ 4 rows in set (0.00 sec)
SELECT * FROM user_privileges;
+------------+---------------+-------------------------+--------------+ | GRANTEE | TABLE_CATALOG | PRIVILEGE_TYPE | IS_GRANTABLE | +------------+---------------+-------------------------+--------------+ | 'root'@'%' | def | Select | YES | | 'root'@'%' | def | Insert | YES | | 'root'@'%' | def | Update | YES | | 'root'@'%' | def | Delete | YES | | 'root'@'%' | def | Create | YES | | 'root'@'%' | def | Drop | YES | | 'root'@'%' | def | Process | YES | | 'root'@'%' | def | References | YES | | 'root'@'%' | def | Alter | YES | | 'root'@'%' | def | Show Databases | YES | | 'root'@'%' | def | Super | YES | | 'root'@'%' | def | Execute | YES | | 'root'@'%' | def | Index | YES | | 'root'@'%' | def | Create User | YES | | 'root'@'%' | def | Trigger | YES | | 'root'@'%' | def | Create View | YES | | 'root'@'%' | def | Show View | YES | | 'root'@'%' | def | Create Role | YES | | 'root'@'%' | def | Drop Role | YES | | 'root'@'%' | def | CREATE TEMPORARY TABLES | YES | | 'root'@'%' | def | LOCK TABLES | YES | | 'root'@'%' | def | CREATE ROUTINE | YES | | 'root'@'%' | def | ALTER ROUTINE | YES | | 'root'@'%' | def | EVENT | YES | | 'root'@'%' | def | SHUTDOWN | YES | | 'root'@'%' | def | RELOAD | YES | | 'root'@'%' | def | FILE | YES | | 'root'@'%' | def | CONFIG | YES | +------------+---------------+-------------------------+--------------+ 28 rows in set (0.00 sec)

USER_PRIVILEGES 表中列的含义如下:

  • GRANTEE:被授权的用户名称,格式为 'user_name'@'host_name'
  • TABLE_CATALOG:表所属的目录的名称。该值始终为 def
  • PRIVILEGE_TYPE:被授权的权限类型,每行只列一个权限。
  • IS_GRANTABLE:如果用户有 GRANT OPTION 的权限,则为 YES,否则为 NO
下载 PDF
产品
TiDB
TiDB Dedicated
TiDB Serverless
© 2024 PingCAP. All Rights Reserved.
Privacy Policy.