1

How to know if a mysql user has all (or some) privileges on a certain DB?

Of course, I don't ask how to do so with phpmyadmin, rather, with the mysql CLI.

I aim to gather as much as basic data on a certain user but the most important for me is to understand the degree this user is associated with the given database (which has the exact same name as the user name, in this case - both the user and the db, are called test).

Edit for PuzzledCuber:

That's my output for show grants for 'test'@'%';:

+--------------------------------------------------------+
| Grants for test@localhost                              |
+--------------------------------------------------------+
| GRANT USAGE ON *.* TO 'test'@'localhost'               |
| GRANT ALL PRIVILEGES ON `test`.* TO 'test'@'localhost' |
+--------------------------------------------------------+

Why is the second row (GRANT ALL...) different than the first row (GRANT USAGE...)?

1

>show grants for 'user'@'%';
Thie explains how to check users and their privileges:
http://xmodulo.com/how-to-view-list-of-mysql-users-and-their-privileges.html

This shows the different permission types and how to grant them:
https://www.digitalocean.com/community/tutorials/how-to-create-a-new-user-and-grant-permissions-in-mysql

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.