Documentation Home
MySQL 5.7 Reference Manual
Related Documentation Download this Manual
PDF (US Ltr) - 39.3Mb
PDF (A4) - 39.3Mb
PDF (RPM) - 38.5Mb
HTML Download (TGZ) - 11.0Mb
HTML Download (Zip) - 11.0Mb
HTML Download (RPM) - 9.7Mb
Man Pages (TGZ) - 214.4Kb
Man Pages (Zip) - 323.7Kb
Info (Gzip) - 3.6Mb
Info (Zip) - 3.6Mb
Excerpts from this Manual SHOW GRANTS Syntax


This statement displays the privileges that are assigned to a MySQL user account, in the form of GRANT statements that must be executed to duplicate the privilege assignments.


To display nonprivilege information for MySQL accounts, use the SHOW CREATE USER statement. See Section, “SHOW CREATE USER Syntax”.

SHOW GRANTS requires the SELECT privilege for the mysql system database, except to display privileges for the current user.

To name the account for SHOW GRANTS, use the same format as for the GRANT statement; for example, 'jeffrey'@'localhost':

mysql> SHOW GRANTS FOR 'jeffrey'@'localhost';
| Grants for jeffrey@localhost                                     |
| GRANT USAGE ON *.* TO `jeffrey`@`localhost`                      |
| GRANT SELECT, INSERT, UPDATE ON `db1`.* TO `jeffrey`@`localhost` |

The host part, if omitted, defaults to '%'. For additional information about specifying account names, see Section 6.2.3, “Specifying Account Names”.

To display the privileges granted to the current user (the account you are using to connect to the server), you can use any of the following statements:


If SHOW GRANTS FOR CURRENT_USER (or any of the equivalent syntaxes) is used in definer context, such as within a stored procedure that executes with definer rather than invoker privileges, the grants displayed are those of the definer and not the invoker.

SHOW GRANTS does not display privileges that are available to the named account but are granted to a different account. For example, if an anonymous account exists, the named account might be able to use its privileges, but SHOW GRANTS does not display them.

SHOW GRANTS output does not include IDENTIFIED BY PASSWORD clauses. Use the SHOW CREATE USER statement instead. See Section, “SHOW CREATE USER Syntax”.