简体   繁体   中英

mysql: access denied on information_schema

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?

The MySQL documentation says:

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

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

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 .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM