开发者

Which grants are required to see privileges for *other* users in information_schema.schema_privileges?

开发者 https://www.devze.com 2022-12-28 11:42 出处:网络
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 usin

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'


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';

0

精彩评论

暂无评论...
验证码 换一张
取 消