Error 1142: SELECT and LOCK TABLE commands denied

╄→гoц情女王★ 提交于 2020-01-06 07:53:18

问题


I reinstalled the server running MySQL. I had created a backup of the database by using MySQL Workbench. Now I'm trying to import the dump in to the database trough the same program but I get the following error:

ERROR 1142 (42000) at line 656: SELECT,LOCK TABL command denied to user 'root'@'MIKKOS' for table 'events_waits_summary_by_thread_by_event_name'

I tought that root had full privileges. I ran the following but the same error appears with the previous query after executing this:

GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' WITH GRANT OPTION

It also appears when running locally (root@localhost).

What to do?


回答1:


Check which databases MySQL Workbench included in the dumpfile. I believe it defaults to dumping everything, including DBs like user and performance_schema. Those are the problem, your grant tables are probably fine.

Remove the unneeded databases, especially performance_schema and MySQL will likely import the dumpfile without errors.




回答2:


You need to repair internal table structure after reinstallation a newer MySQL server. To do so try:

REPAIR TABLE `events_waits_summary_by_thread_by_event_name`;

It would be better to drop database and restore it from full mysql database dump if you have one.



来源:https://stackoverflow.com/questions/14423686/error-1142-select-and-lock-table-commands-denied

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