SHOW-GRANTS
SHOW GRANTS
Description
This statement is used to view the grants for users.
SHOW [ALL] GRANTS [FOR user_identity];
-
ALL
By using the key word
ALL
, user can view the grants for all users.
-
user_identity
View the grants for specified user. And the user_identity must be created by CREATE USER command.
If user_identity is not specified, then view the grants for current user.
Description of return results:
mysql> show grants;
+--------------+----------+----------------------+---------------+------------+---------------+
| UserIdentity | Password | GlobalPrivs | DatabasePrivs | TablePrivs | ResourcePrivs |
+--------------+----------+----------------------+---------------+------------+---------------+
| 'admin'@'%' | Yes | Admin_priv (false) | NULL | NULL | NULL |
+--------------+----------+----------------------+---------------+------------+---------------+
1 row in set (0.00 sec)
-
UserIdentity
User identity.
-
Password
Yes
indicates that a password is set.No
indicates no password. -
GlobalPrivs
List of grants at the global level. (
false
after list can be ignored). -
DatabasePrivs
List of grants at the database level. (
false
after list can be ignored). -
TablePrivs
List of grants at the table level. (
false
after list can be ignored).
Example
-
View the grants for all users
SHOW ALL GRANTS;
-
View the grants for specified users
SHOW GRANTS FOR jack@'%';
-
View the grants for current user
SHOW GRANTS;
Keywords
SHOW, GRANTS