电脑断电导致mysql不可用,删除ib_logfile0和ib_logfile1恢复
mysql安装在虚拟机中,公司突然断电导致mysql启动失败
查看mysql的error日志
2021-05-19T06:44:51.993300Z 0 [ERROR] InnoDB: Ignoring the redo log due to missing MLOG_CHECKPOINT between the checkpoint 2798595433 and the end 2798595072.
2021-05-19T06:44:51.993316Z 0 [ERROR] InnoDB: Plugin initialization aborted with error Generic error
2021-05-19T06:44:52.598369Z 0 [ERROR] Plugin 'InnoDB' init function returned error.
2021-05-19T06:44:52.598399Z 0 [ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed.
2021-05-19T06:44:52.598405Z 0 [ERROR] Failed to initialize builtin plugins
主要的原因是mysql会在最新的checkpoint完成后都会在redo log写一个一字节的MLOG_CHECKPOINT 标记,用来标记在此之前的redo都已checkpoint完成。如果处于任何原因没有找到这个标记,那么整个redo日志文件都会被忽略。出现这个错误的话,最好是有备份进行恢复,如果没有做好备份,那只能采取非常规的启动方式,但可能造成数据丢失
删除/var/lib/mysql目录下的ib_logfile0和ib_logfile1重新启动就可以了
https://blog.csdn.net/eagle89/article/details/102704021
https://blog.csdn.net/weixin_43424368/article/details/108892963