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;

The output is as follows:

+----------------+--------------+------+------+---------+-------+ | 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)

View the information in the USER_PRIVILEGES table:

SELECT * FROM USER_PRIVILEGES;

The output is as follows:

+------------+---------------+-------------------------+--------------+ | 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 | CREATE TABLESPACE | 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 | | 'root'@'%' | def | REPLICATION CLIENT | YES | | 'root'@'%' | def | REPLICATION SLAVE | YES | +------------+---------------+-------------------------+--------------+ 31 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.

See also