MySQL InnoDB 错误:log sequence number is in the future

MySQL InnoDB 错误:log sequence number is in the future 问题

一台服务器在断电后MariaDB数据库无法启动,日志如下

131016 15:33:18  InnoDB: Error: page 1 log sequence number 93 3574294358
InnoDB: is in the future! Current system log sequence number 0 3114505740.
InnoDB: Your database may be corrupt or you may have copied the InnoDB
InnoDB: tablespace but not the InnoDB log files. See
InnoDB: http://dev.mysql.com/doc/refman/5.1/en/forcing-innodb-recovery.html
InnoDB: for more information.

数据库崩溃,还好里面数据的数据不太重要,尝试恢复

解决

按照提示访问官方文档
https://dev.mysql.com/doc/refman/8.0/en/forcing-innodb-recovery.html
按照文中所述编辑数据库的配置文件my.cnf,添加innodb_force_recovery属性
设置 innodb_force_recovery = 1,然后保存修改并重启MariaDB服务器
innodb_force_recovery = 1不行就改成2,2不行改成3,以此类推,最大值为6,

注意:当该值设置为4或者更大时有可能彻底损坏数据,所以做之前最好备份硬盘

启动后把数据导出,重装数剧库或者删除重建数据库就OK了,记得吧innodb_force_recovery改回来

附加问题

在修改innodb_force_recovery并重启数据服务时,重启命令一直在等待,查看日志发现出现很多如下日志条目

InnoDB: Waiting for the background threads to start
InnoDB: Waiting for the background threads to start
InnoDB: Waiting for the background threads to start
...

修改配置文件my.cnf,添加innodb_purge_threads = 0,具体原因没有细究
唉,备份啊备份

最新回复(0)
Google XML地图百度 XML地图Google txt地图百度 txt地图17社