views:

83

answers:

1

For a specific database in a MySQL Server 5.5 I would like to view all grants given to any user. To do this I have been reading from the information_schema.schema_privileges table using a select statement as follows:

select * from information_schema.schema_privileges where table_schema='myproject';

The problem is that I only see my own grants for the database. I am therefore trying to modify my grants such that the grants for all users for that database are listed in the results of the select.

In the documentation it says that the information in the schema_privilegestable comes from the mysql.dbtable, however also granting select for mysql.dbdoesn't seem to make any difference. I still only see my own grants for the database in question.

Does anyone have any ideas which grants are required?

My current grants are as follows:

show grants;
Grants for myuser@localhost
GRANT USAGE ON . TO 'myuser'@'localhost' IDENTIFIED BY PASSWORD 'XXX'
GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP ON myproject.* TO 'myuser'@'localhost' WITH GRANT OPTION
GRANT SELECT ON mysql.user TO 'myuser'@'localhost'
GRANT SELECT ON mysql.db TO 'myuser'@'localhost'

A: 

OK, I solved it by just reading out directly from the mysql.db table. It was much simpler in the end!

select user, host, select_priv, insert_priv, update_priv, delete_priv, create_priv, drop_priv, grant_priv from mysql.db where Db='myproject';

Ham