SHOW GRANTS

This MySQL statement displays the GRANT statement for a given user.

Syntax

Below is the syntax for this command. Text within square brackets (i.e, [ and ] ) are optional. Choices are separated by bars (i.e, | ). Ellipses preceded by a comma indicates a repeating pattern. Ellipses before or after syntax are used to highlight a relevant except from the larger syntax. Text displayed in italic letters represent text that should be replaced with the specific names related to the database (e.g., column with the name of the column).

SHOW GRANTS [FOR 'user'@'host']

Explanation

This MySQL statement displays the GRANT statement for a given user. If the FOR clause is not given, the current user account is assumed. If the user name is given without reference to a particular host, the wildcard % is assumed. Otherwise, the user name should be followed by the host.

Examples

Below is an example of this MySQL statement:

SHOW GRANTS FOR 'ulfthewolf'@'localhost'G

*************************** 1. row ***************************
Grants for ulfthewolf@localhost: 

GRANT ALL PRIVILEGES ON *.* 
TO 'ulfthewolf'@'localhost' 
IDENTIFIED BY PASSWORD '57fa103a3c5c9f30' 
WITH GRANT OPTION

The resulting statement is what would be entered to create the user ulfthewolf for the host localhost, with the given privileges including the WITH GRANT OPTION flag.