需要哪些授权才能查看 information_schema.schema_privileges 中*其他*用户的权限?
对于 MySQL Server 5.5 中的特定数据库,我想查看给予任何用户的所有授权。为此,我一直使用 select 语句从 information_schema.schema_privileges
表中读取内容,如下所示:
select * from information_schema.schema_privileges where table_schema='myproject';
问题是我只能看到我自己对数据库的资助。因此,我尝试修改我的授权,以便该数据库的所有用户的授权都列在选择结果中。
在文档中,它说信息schema_privileges
表中的内容来自 mysql.db
表,但是也为 mysql.db
授予 select
权限”似乎没有什么区别。我仍然只能看到我自己对相关数据库的资助。
有人知道需要哪些赠款吗?
我当前的补助金如下:
show grants;
为 myuser@localhost
提供资助 将 . 的使用权限授予由密码“XXX”识别的“myuser”@“localhost”
使用授予选项将 myproject
.* 上的选择、插入、更新、删除、创建和删除授予 'myuser'@'localhost'
将 mysql
.user
上的选择授予 'myuser'@'localhost'
将 mysql
.db
上的选择授予 'myuser'@'localhost'
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_privileges
table comes from the mysql.db
table, however also granting select
for mysql.db
doesn'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'
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
好的,我通过直接从 mysql.db 表中读取来解决了这个问题。最后就简单多了!
从 mysql.db 中选择用户、主机、select_priv、insert_priv、update_priv、delete_priv、create_priv、drop_priv、grant_priv,其中 Db='myproject';
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';