mysql重启失败

文章描述了一个在Docker环境中部署的MySQL5.7服务器因虚机异常重启导致数据库启动失败的问题。错误日志显示出InnoDB插件初始化时遇到MLOG_CHECKPOINT标记缺失,从而忽略redolog。解决方案包括备份并删除ib_logfile文件后重启,或者设置innodb_force_recovery,但后者可能存在数据丢失风险。
摘要由CSDN通过智能技术生成
一、问题背景

部署项目的虚机异常重启,利用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 的,不过对这个不熟悉,而且删除上面两个文件重启服务就行了,也就没有修改配置

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值