SHOW-GRANTS
SHOW GRANTS
Description
This statement is used to view the grants for users.
SHOW [ALL] GRANTS [FOR user_identity];-
ALLBy using the key word
ALL, user can view the grants for all users.
-
user_identityView 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)-
UserIdentityUser identity.
-
PasswordYesindicates that a password is set.Noindicates no password. -
GlobalPrivsList of grants at the global level. (
falseafter list can be ignored). -
DatabasePrivsList of grants at the database level. (
falseafter list can be ignored). -
TablePrivsList of grants at the table level. (
falseafter 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