MySQL 5.6 解决InnoDB: Error: Table “mysql”.”innodb_table_stats” not found.问题

渡边不斯凯
Jul 28, 2017 · 2 min read

如果你通过直接更改一种不明来源的my.cnf配置文件,并重新启动MySQL服务的话,有很大几率会出现这种错误:(更改配置文件以及其他处理操作暂且不论。)errlog 出现报错:InnoDB: Error: Table “mysql”.”innodb_table_stats” not found.

这种问题,很明显在mysql库中未找到innodb_table_stats这张表,不过如果你直接create table创建的话是不会成功的。

首先,确定需要重建的表: innodb_index_stats,innodb_tables_stats,分析/usr/local/mysql/share/mysql_system_tables.sql这个脚本就可以找到此表的DDL语句。整理成一个sql文件,待执行。

停止数据库,并进入到数据库数据文件所在目录,删除上面表所对应的idb文件。

启动登陆数据库,source innostate.sql

执行成功后, use mysql ;show tables;当在进行表操作就不会在errlog中看到相关报错信息了。

渡边不斯凯

我可能抑郁了,

Welcome to a place where words matter. On Medium, smart voices and original ideas take center stage - with no ads in sight. Watch
Follow all the topics you care about, and we’ll deliver the best stories for you to your homepage and inbox. Explore
Get unlimited access to the best stories on Medium — and support writers while you’re at it. Just $5/month. Upgrade