Bootstrap FreeKB - mySQL / MariaDB - display a users privileges using SHOW GRANTS statement
mySQL / MariaDB - display a users privileges using SHOW GRANTS statement

Updated:   |  mySQL / MariaDB articles

This assume you are able to log into your MariaDB or mySQL server or you have configured passwordless authentication and will be using the -e command line option. The SHOW GRANTS statement can be used to display grants.

mysql> show grants;

 

Or like this (to display local grants).

mysql> show grants for 'root'@'localhost';

 

Or like this (to display remote grants).

mysql> show grants for 'john.doe'@'%';

 

Something like this should be displayed.

  • 'localhost' are the local grants
  • '%' are the remote grants (e.g. connecting to the database from a remote system)
+----------------------------------------------------------------------------------------------------------------------------------------+
| Grants for root@localhost                                                                                                              |
+----------------------------------------------------------------------------------------------------------------------------------------+
| GRANT ALL PRIVILEGES ON *.* TO 'root'@'localhost' IDENTIFIED BY PASSWORD '*B87A204DF7CFA2D10278BBA8AC90DC081CD15EB2' WITH GRANT OPTION |
| GRANT PROXY ON ''@'' TO 'root'@'localhost' WITH GRANT OPTION                                                                           |
+----------------------------------------------------------------------------------------------------------------------------------------+

 




Did you find this article helpful?

If so, consider buying me a coffee over at Buy Me A Coffee



Comments


Add a Comment


Please enter ddf5f4 in the box below so that we can be sure you are a human.