mysql> SHOWing GRANTS for all users

Viewed 203

Currently I perform a manual two-step procedure to get the grants information for all the users.

Step 1:

SELECT user, host FROM mysql.user;

Step 2:

SHOW GRANTS FOR '«user»'@'«host»'; -- Repeated for all user-host pairs.

Is there a single command to give me this information?

1 Answers

You should be able to retrieve privileges for all users from information_schema:

select grantee, group_concat(privilege_type) from information_schema.user_privileges group by grantee

Related