Mysql error.log报错:Error: Table “mysql”.“innodb_table_stats” not found

发现mysql的error.log裡面有报错:

InnoDB: Error: Table “mysql”.“innodb_table_stats” not found. InnoDB:
Error: Fetch of persistent statistics requested for table
“hj_web”.“wechat_res” but the required system tables
mysql.innodb_table_stats and mysql.innodb_index_stats are not present
or have unexpected structure. Using transient stats instead.

 

 

那么需重新构建mysql这个databases的5个表:

步骤:
1、登入资料库,进入mysql库,执行如下SQL删除5张表
记住,一定要是drop table if exists

mysql> use mysql; mysql> drop table if exists innodb_index_stats;
mysql> drop table if exists innodb_table_stats; mysql> drop table if
exists slave_master_info; mysql> drop table if exists
slave_relay_log_info; mysql> drop table if exists slave_worker_info;

 

 

乐维提示执行完后,可以用show tables检视一下,看錶的资料是否已经比删除之前减少了,如果减少了,说明你成功了!

2、上一步操作完成后,停止资料库,并进入到资料库资料档案所在目录,删除上面5个表所对应的idb档案,如下所示:

# /etc/init.d/mysqld stop
# cd /data/mysql/data/mysql/
# ls -l *.ibd

-rw-rw---- 1 mysql mysql 98304 May 27 14:17 innodb_index_stats.ibd
-rw-rw---- 1 mysql mysql 98304 May 27 14:17 innodb_table_stats.ibd
-rw-rw---- 1 mysql mysql 98304 May 27 14:14 slave_master_info.ibd
-rw-rw---- 1 mysql mysql 98304 May 27 14:14 slave_relay_log_info.ibd
-rw-rw---- 1 mysql mysql 98304 May 27 14:14 slave_worker_info.ibd

# /bin/rm -rf *.ibd

 

3、重新启动资料库,进入到mysql库,重建上面被删除的表结构:
资料库的建表指令码在mysql软体的安装目录的share目录下或者mysql的安装包的script目录下,我们这裡可以find一下:

# find / -name mysql_system_tables.sql

/usr/local/mysql-5.6.29/scripts/mysql_system_tables.sql

# /etc/init.d/mysqld start
mysql> use mysql;
mysql> source /usr/local/mysql-5.6.29/scripts/mysql_system_tables.sql
mysql> show tables;
28 rows in set (0.00 sec)

 

再随便desc下5个的其中一俩个表看看:

mysql> desc innodb_table_stats;
mysql> desc slave_master_info;

 

 

最后再检视mysql的error.log日志,
确认没有新的报错之后,就表示成功。

 

转自:https://www.itread01.com/content/1544122025.html?tdsourcetag=s_pctim_aiomsg

posted @ 2020-03-16 10:32  郭大侠1  阅读(401)  评论(0编辑  收藏  举报