dcsimg
 

Submitted by: M S Sridhar(sridhar.ms@gmail.com)

Tuesday Mar 3rd 2020 by M S Sridhar

Language: SQL, Expertise: Intermediate - Learn how to view what permissions a given user has been granted.

MySQL allows various permissions to be set for users during (or after) creation. The following command comes handy to understand what GRANTS a user has.

Command: SHOW GRANTS FOR user;

In the above command, replace the user with the real username to know the GRANTS associated with the user.

Sample:

SHOW GRANTS FOR root; 

Results in:

+-------------------------------------------------------------+
| Grants for root@%                                 |
+-------------------------------------------------------------+
| GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' WITH GRANT OPTION |
+-------------------------------------------------------------+ 
Home
Mobile Site | Full Site