解决 Starting MySQL ERROR The server quit without updating PID file

解决 Starting MySQL ERROR The server quit without updating PID file,第1张

服务器断电重启后mysql启动报错,记录一下解决方案

环境
mysql版本 5.7.21
服务器 Red Hat Enterprise Linux Server release 7.6 (Maipo)

# myslq启动报错
Starting MySQL.. ERROR! The server quit without updating PID file.
首先查看错误日志,注意到在redo log里找不到checkpoint点,innodb引擎启动失败
# 查看/etc/my.cnf下datadir配置的目录
cd /usr/local/mysql/data
# 目录下有一个主机名.err文件
view hostname.err
2022-01-12T05:56:36.174273Z 0 [ERROR] InnoDB: Ignoring the redo log due to missing MLOG_CHECKPOINT between the checkpoint 261550117271 and the end 261550116864.
2022-01-12T05:56:36.174285Z 0 [ERROR] InnoDB: Plugin initialization aborted with error Generic error
2022-01-12T05:56:36.787768Z 0 [ERROR] Plugin 'InnoDB' init function returned error.
2022-01-12T05:56:36.787839Z 0 [ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed.
2022-01-12T05:56:36.787854Z 0 [ERROR] Failed to initialize builtin plugins.
2022-01-12T05:56:36.787878Z 0 [ERROR] Aborting

2022-01-12T05:56:36.787905Z 0 [Note] Binlog end
2022-01-12T05:56:36.788857Z 0 [Note] /usr/local/mysql/bin/mysqld: Shutdown complete
按照网上说的,把所有ib_logfile*文件删除,再启动mysql,能够顺利启动,由于是测试环境,所以能跑起来就行了,数据丢了也无所谓,如果是生产环境还需谨慎 *** 作。
# 在/usr/local/mysql/data目录下有两个ib_logfile文件ib_logfile0和ib_logfile1
rm -rf ./ib_logfile*
# 重新启动mysql
service mysqld start
推荐的做法是在my.cnf里设置innodb_force_recovery=1 ,如果1不行改成2,最大是6 ,然后启动mysql, 将数据dump出来,再导入到新的实例,这种方法我没试过,仅记录一下。
vi /etc/my.cnf
#将下面参数设置为1
innodb_force_recovery=1
#保存后重启mysql
service mysqld start
根据主键id ,逐个区间去导出,用mysqldump -w where条件,再导入到新实例,innodb_force_recovery影响整个innodb存储引擎的恢复状况,该值默认为0,表示当需要恢复时,需要执行所有的恢复 *** 作,当不能进行有效恢复时,如数据页发生了corruption,mysql数据库可能宕机,并把错误写入错误日志中。innodb_force_recovery=6表示mysql数据库已经有比较严重的损坏,就算把数据dump出来也不能保证dump出来的数据是没有问题的

欢迎分享,转载请注明来源:内存溢出

原文地址: https://outofmemory.cn/sjk/991790.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-05-21
下一篇 2022-05-21

发表评论

登录后才能评论

评论列表(0条)

保存