Sign InTry Free

USER_PRIVILEGES

The USER_PRIVILEGES table provides information about global privileges. This information comes from the mysql.user system table:

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)

Fields in the USER_PRIVILEGES table are described as follows:

  • GRANTEE: The name of the granted user, which is in the format of 'user_name'@'host_name'.
  • TABLE_CATALOG: The name of the catalog to which the table belongs. This value is always def.
  • PRIVILEGE_TYPE: The privilege type to be granted. Only one privilege type is shown in each row.
  • IS_GRANTABLE: If you have the GRANT OPTION privilege, the value is YES; otherwise, the value is NO.

Was this page helpful?

Download PDFRequest docs changesAsk questions on Discord
Playground
New
One-stop & interactive experience of TiDB's capabilities WITHOUT registration.
Products
TiDB
TiDB Dedicated
TiDB Serverless
Pricing
Get Demo
Get Started
© 2024 PingCAP. All Rights Reserved.
Privacy Policy.