Mysql重启服务Error: tablespace id is xx in the data dictionary问题

今天在进行同步线上数据到线下数据库时候,重启数据库失败,报错如下:

2020-06-10 15:48:14 38376 [Note] InnoDB: 128 rollback segment(s) are active.
2020-06-10 15:48:14 38376 [Note] InnoDB: Waiting for purge to start
InnoDB: Error: tablespace id is 4753 in the data dictionary
InnoDB: but in file ./mysql/innodb_index_stats.ibd it is 2!

翻译过来大概就是innodb_index_stats.ibd这个表的表空间id不一致的问题。

首先想想问题产生的原因,mysql的默认库mysql我用的是线下的数据,而mysql里面包括这张表,而其他数据库的数据都是线上的,这个索引表用于记录索引的状态信息,于是就产生了这个问题。
解决办法:innodb_index_stats.ibd这个表也使用线上的数据就可以了。。
然后重启就成功了:

mysqld_safe --defaults-file=/data/conf/my.cnf &
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章