mysql重启失败

一、问题背景

部署项目的虚机异常重启,利用docker部署的mysql重启失败

二、报错截图如下
2023-02-06 15:11:00+00:00 [Note] [Entrypoint]: Entrypoint script for MySQL Server 5.7.37-1debian10 started.
2023-02-06 15:11:00+00:00 [Note] [Entrypoint]: Switching to dedicated user 'mysql'
2023-02-06 15:11:00+00:00 [Note] [Entrypoint]: Entrypoint script for MySQL Server 5.7.37-1debian10 started.
2023-02-06T15:11:00.854091Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2023-02-06T15:11:00.859582Z 0 [Note] mysqld (mysqld 5.7.37) starting as process 1 ...
2023-02-06T15:11:00.866111Z 0 [Note] InnoDB: PUNCH HOLE support available
2023-02-06T15:11:00.866176Z 0 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
2023-02-06T15:11:00.866182Z 0 [Note] InnoDB: Uses event mutexes
2023-02-06T15:11:00.866184Z 0 [Note] InnoDB: GCC builtin __atomic_thread_fence() is used for memory barrier
2023-02-06T15:11:00.866187Z 0 [Note] InnoDB: Compressed tables use zlib 1.2.11
2023-02-06T15:11:00.866189Z 0 [Note] InnoDB: Using Linux native AIO
2023-02-06T15:11:00.867459Z 0 [Note] InnoDB: Number of pools: 1
2023-02-06T15:11:00.867813Z 0 [Note] InnoDB: Using CPU crc32 instructions
2023-02-06T15:11:00.875232Z 0 [Note] InnoDB: Initializing buffer pool, total size = 128M, instances = 1, chunk size = 128M
2023-02-06T15:11:00.899354Z 0 [Note] InnoDB: Completed initialization of buffer pool
2023-02-06T15:11:00.907222Z 0 [Note] InnoDB: If the mysqld execution user is authorized, page cleaner thread priority can be changed. See the man page of setpriority().
2023-02-06T15:11:00.925448Z 0 [Note] InnoDB: Highest supported file format is Barracuda.
2023-02-06T15:11:00.928520Z 0 [ERROR] InnoDB: Ignoring the redo log due to missing MLOG_CHECKPOINT between the checkpoint 33357625 and the end 33357312.
2023-02-06T15:11:00.928577Z 0 [ERROR] InnoDB: Plugin initialization aborted with error Generic error
2023-02-06T15:11:01.537789Z 0 [ERROR] Plugin 'InnoDB' init function returned error.
2023-02-06T15:11:01.537812Z 0 [ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed.
2023-02-06T15:11:01.537817Z 0 [ERROR] Failed to initialize builtin plugins.
2023-02-06T15:11:01.537820Z 0 [ERROR] Aborting

2023-02-06T15:11:01.537831Z 0 [Note] Binlog end
2023-02-06T15:11:01.537870Z 0 [Note] Shutting down plugin 'CSV'
2023-02-06T15:11:01.538218Z 0 [Note] mysqld: Shutdown complete

三、我的项目配置如下

mysql 版本是5.7

四、分析问题
五、问题原因

这个问题呈现在 MySQL 5.7 之后的版本,次要的起因是 MySQL 会在最新的 checkpoint 实现后都会在 redo log 写一个一字节的 MLOG_CHECKPOINT 标记,用来标记在此之前的 redo 都已 checkpoint 实现。如果处于任何起因没有找到这个标记,那么整个 redo log 文件都会被疏忽。呈现这个谬误的话,最好是有备份进行复原,如果没有做好备份,那只能采取非常规的启动形式,但可能造成数据失落。

六、解决方式

先备份数据目录下ib_logfile0、ib_logfile1两个文件,再删除后重新启动mysql;
网上资料也有许多显示修改配置 innodb_force_recovery 的,不过对这个不熟悉,而且删除上面两个文件重启服务就行了,也就没有修改配置

posted @ 2023-02-06 23:29  枫叶艾辰  阅读(66)  评论(0编辑  收藏  举报