HiveBrain v1.2.0
Get Started
← Back to all entries
patternsqlCritical

mysql: Show GRANTs for all users

Submitted by: @import:stackexchange-dba··
0
Viewed 0 times
showallmysqlforgrantsusers

Problem

MySQL's SHOW GRANTS shows the permissions of the current user.

Is there a way to log in as root and show the permissions of all users?

Solution

select * from information_schema.user_privileges;


EDIT:

As mentioned by Shlomi Noach:


It does not list database-specific, table-specific, column-specific,
routine-specific privileges. Therefore, the grant GRANT SELECT ON
mydb.* TO myuser@localhost does not show in
information_schema.user_privileges. The common_schema solution
presented above aggregates the data from user_privileges and other tables
to give you the full picture.

Code Snippets

select * from information_schema.user_privileges;

Context

StackExchange Database Administrators Q#23265, answer score: 125

Revisions (0)

No revisions yet.