mysql: access denied on information_schema

我与影子孤独终老i 提交于 2020-08-24 06:42:22

问题


When i'm create new user or grant privileges to existing, i got this error:

ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)

Grant privileges ok on all tables, except information_schema, on this table i got access denied error. How i can fix? Dump all databases, drop all databases, and then restore from dump?


回答1:


The MySQL documentation says:

... you can only read the contents of tables, not perform INSERT, UPDATE, or DELETE operations on them.




回答2:


It is not necessary to grant access to these tables. All users already have access.

"Each MySQL user has the right to access these tables, but can see only the rows in the tables that correspond to objects for which the user has the proper access privileges. In some cases (for example, the ROUTINE_DEFINITION column in the INFORMATION_SCHEMA.ROUTINES table), users who have insufficient privileges will see NULL."

https://bugs.mysql.com/bug.php?id=45430

http://dev.mysql.com/doc/refman/5.1/en/information-schema.html




回答3:


Note that if you have a typo in the name information_schema, you would also get an denied to user message. This is confusing sometimes.

select * from bogusSchema.bogusTable;

The error would be

Error Code: 1142. SELECT command denied to user 'user123'@'localhost' for table 'bogusTable'

I am using an InfoBright variant of MySQL. Not sure if this same problem exists with other variants/versions of MySQL.



来源:https://stackoverflow.com/questions/23989356/mysql-access-denied-on-information-schema

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!