Is there a way to list all users/hosts that have been granted access to a database? I know I can do this:
> show grants for someuser;
+------------------------------------------------------------------------------------------------------+
| Grants for someuser@% |
+------------------------------------------------------------------------------------------------------+
| GRANT USAGE ON *.* TO `someuser`@`%` IDENTIFIED BY PASSWORD '*XXXXXXXXXXXXX' |
| GRANT ALL PRIVILEGES ON `a_database`.* TO `someuser`@`%` WITH GRANT OPTION |
+------------------------------------------------------------------------------------------------------+
2 rows in set (0.00 sec)
Or this:
> show grants for someuser@afqdn;
+-----------------------------------------------------------------------------------------------------------------------+
| Grants for someuser@afqdn |
+-----------------------------------------------------------------------------------------------------------------------+
| GRANT USAGE ON *.* TO `someuser`@`qfqdn` IDENTIFIED BY PASSWORD '*XXXXXXXXXXXXX' |
| GRANT ALL PRIVILEGES ON `a_database`.* TO `someuser`@`afqdn` |
+-----------------------------------------------------------------------------------------------------------------------+
2 rows in set (0.00 sec)
Is there a way in which I can provide the database in the request? And then get all different users that have been granted access to that db in a single shot? In the examples I used it starts from a given username (and for my specific use-case I do have the username) but how about we want to list all users in a single shot instead of guessing user by user / fqdn by fqdn?