hasanghaforian hasanghaforian - 2 years ago 59
SQL Question

Show users which have permission about specific database

Is there a way to log in as root user of MySQL and show all users which have any permission about specified database?

Answer Source
USE mysql;
SELECT user,host FROM db WHERE db='name';
SELECT user,host FROM tables_priv WHERE db='name';
SELECT user,host FROM columns_priv WHERE db='name';
SELECT user,host FROM procs_priv WHERE db='name';

First statement gets all users who have permissions on the database itself. The other 3 queries are for users who have only permissions on tables, columns or procedure level.

Sadly can't reference to another user who posted this. I learned it from there but can't find it anymore.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download