Jump to content

[SOLVED] How to show existing permissions granted to MYSQL databases/tables?


Recommended Posts



I am using command line mysql and cannot for the life of me find a way to show existing database permissions exist!


For instance, if I did: GRANT SELECT ON database.table TO someone@"%" IDENTIFIED BY 'password';


How can I then FIND the results of that command?


I want to see:




Obviously not in that format but what I want to do is audit my permissions and also make sure that I am typing things correctly.


I am currently having a connection error that I don't understand. Using a user name and pw I granted permissions to several times, it says it cannot connect. Want to verify that the permissions exist and that I didn't make a typo of some kind.


Thank you, I hope that makes sense!

Link to comment
Share on other sites

Thank you, that is not something I knew about.


Unfortunately it only seems to show granted privileges for the user you are currently logged in as?  ???


The problem is that I cannot connect as this user. I don't know what the problem is with granting permissions and I'd like to see ALL permissions granted to various users to make sure there isn't some kind of typo?


I would imagine this would also be very useful to audit who can and cannot access different actions/databases and tables. I can't believe something so basic is so hard to find, hehe!

Link to comment
Share on other sites

Hmm, well that does work (and is very helpful to know, thank you!) but doesn't help the problem I am having like I was hoping it would. It looks like I granted permissions correctly but it still won't let me connect. Weird!


Also, it would be helpful to be able to at least see the different user names that have ANY permissions so we could use SHOW GRANTS FOR on them.


Seems like it should be a basic security issue so that you can make sure that no one has access to something they shouldn't!



Link to comment
Share on other sites

Got it all figured out a while ago, just updating here in case others have the same problem.


I was right, it WAS exceptionally simple!


You can view all your database users with:


SELECT user, host, password FROM mysql.user;


You can also view specific permissions for a user with:


SHOW GRANTS FOR userName@"%";


Easy as pie, I was just missing the right syntax. Weird that it was so hard to find online though!


I hope this helps!


Link to comment
Share on other sites

This thread is more than a year old.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.