Loading...
MySQL

Show Grants for a MySQL User

To show the granted permissions for a MySQL username, first you will need to know the username that you need to check on. In this article, the username will be test_db. So, to show the information for the user, you will first drop into the mysql shell.

root@server [/]#mysql
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 0001
Server version: 5.0.91-community MySQL Community Edition (GPL)

Type ‘help;’ or ‘\h’ for help. Type ‘\c’ to clear the current input statement.

mysql>

Then, you use the show grants command to show the granted permissions for that MySQL user.

mysql> show grants for ‘test_db’@’localhost’;
+————————————————————————————————————————————————————————————————–+
| Grants for test_db@localhost |
+————————————————————————————————————————————————————————————————–+
| GRANT USAGE ON *.* TO ‘test_db’@’localhost’ IDENTIFIED BY PASSWORD ‘*DYC75DW0KD63D82OEGMCF334LKSUTAQQLUDRW’ |

| GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, REFERENCES, INDEX, ALTER, CREATE TEMPORARY TABLES, LOCK TABLES, EXECUTE, CREATE ROUTINE ON `test\_db`.* TO ‘test_db’@’localhost’ |
+————————————————————————————————————————————————————————————————–+
2 rows in set (0.00 sec)

You can tell the database that it it granted the permissions to from this part of that statement, where test\_db is the database test_db.

GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, REFERENCES, INDEX, ALTER, CREATE TEMPORARY TABLES, LOCK TABLES, EXECUTE, CREATE ROUTINE ON `test\_db`.* TO ‘test_db’@’localhost’ |

Popular Posts
  • No Popular Post Available
Leave a Reply

Your email address will not be published. Required fields are marked *

*