snippetsqlMinor
How to retrieve granted privileges without access to the database “mysql”?
Viewed 0 times
withouttheprivilegesgranteddatabaseretrievemysqlhowaccess
Problem
As a MySQL user without access to the mysql database, is it possible to retrieve my privileges?
Solution
It seems that using
Although the manual states that you still need to have access to the mysql database:
And accessing mysql.user directly actually didn’t work, probably because it does also contain further sensitive information like the passwords of other users:
SHOW GRANTS did work in this case:SHOW GRANTS FOR CURRENT_USER;Although the manual states that you still need to have access to the mysql database:
SHOW GRANTS requires the SELECT privilege for the mysql database.And accessing mysql.user directly actually didn’t work, probably because it does also contain further sensitive information like the passwords of other users:
mysql> SELECT * FROM mysql.user;
ERROR 1142 (42000): SELECT command denied to user 'user'@'host' for table 'user'Code Snippets
SHOW GRANTS FOR CURRENT_USER;mysql> SELECT * FROM mysql.user;
ERROR 1142 (42000): SELECT command denied to user 'user'@'host' for table 'user'Context
StackExchange Database Administrators Q#2085, answer score: 4
Revisions (0)
No revisions yet.