How can I show users privileges in MySQL?

Hi,

How can I show user's privileges in MySQL?

I want to know what is accessible to user in MySQL database. How to check this?

Thanks

View Answers

November 5, 2017 at 7:02 PM

Hi,

To view grant for a user you can use following sql query:

show grants for username;

Here is simple usage:

mysql> show grants for webservice;
+-----------------------------------------------------------------------------------------------------------+
| Grants for webservice@%                                                                                   |
+-----------------------------------------------------------------------------------------------------------+
| GRANT USAGE ON *.* TO 'webservice'@'%' IDENTIFIED BY PASSWORD 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx' |
| GRANT ALL PRIVILEGES ON `mydb`.* TO 'webservice'@'%'                                                  |
+-----------------------------------------------------------------------------------------------------------+
2 rows in set (0.00 sec)

mysql>

Thanks









Related Tutorials/Questions & Answers:
Advertisements