MySQL或MariaDB日志提示[ERROR] mysqld got signal 6

本文详细介绍了当MySQL因异常断电或系统重启导致无法启动时的解决方案,包括设置恢复模式、备份数据库、清理数据和数据恢复的具体步骤。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

1、问题现象

由于异常断电或者系统异常重启时MySQL没有正常退出导致MySQL无法启动,启动时报错如下:
Version: ‘5.5.64-MariaDB’ socket: ‘/var/lib/mysql/mysql.sock’ port: 3306 MariaDB Server
200617 22:54:24 InnoDB: Assertion failure in thread 140689172858624 in file fut0lst.ic line 83
InnoDB: Failing assertion: addr.page == FIL_NULL || addr.boffset >= FIL_PAGE_DATA
InnoDB: We intentionally generate a memory trap.
InnoDB: Submit a detailed bug report to https://jira.mariadb.org/
InnoDB: If you get repeated assertion failures or crashes, even
InnoDB: immediately after the mysqld startup, there may be
InnoDB: corruption in the InnoDB tablespace. Please refer to
InnoDB: http://dev.mysql.com/doc/refman/5.5/en/forcing-innodb-recovery.html
InnoDB: about forcing recovery.
200617 22:54:24 [ERROR] mysqld got signal 6 ;
This could be because you hit a bug. It is also possible that this binary
or one of the libraries it was linked against is corrupt, improperly built,
or misconfigured. This error can also be caused by malfunctioning hardware.
To report this bug, see http://kb.askmonty.org/en/reporting-bugs
We will try our best to scrape up some info that will hopefully help
diagnose the problem, but since we have already crashed,
something is definitely wrong and this may fail.

2、解决方法

1、设置恢复模式启动mysql

参考:http://dev.mysql.com/doc/refman/5.5/en/forcing-innodb-recovery.html
vim /etc/my.cnf
添加配置项:
innodb_force_recovery = 1
其中后面的值设置为1、如果1不想再逐步增加为2/3/4/5/6等。直到能启动mysql为止,若不想尝试直接写6即可;

2、使用恢复模式重启mysql

systemctl restart mariadb
若启动时一直打印:200618 17:45:56 InnoDB: Waiting for the background threads to start
在my.cnf中的[mysqld]中增加:innodb_purge_thread=0再尝试重启。
启动成功后测试数据库连接:mysql -uroot -p123456;

3、备份全部数据库表:

mysqldump -uroot -p123456 --all-databases > all_mysql_backup.sql

4、删除mysql数据(清除之前务必先stop mysql服务):

systemctl stop mariadb
cp -r /var/lib/mysql/ /var/lib/mysql.bak
rm -rf /var/lib/mysql/*
重启mysql服务:
正常模式在启动mysql:
vim /etc/my.cnf
注释配置项:
#innodb_force_recovery = 1
#innodb_purge_thread=0
再重启:
systemctl restart mariadb

5、数据库恢复

设置密码123456:
mysqladmin -u root password 123456

6、使用之间备份的sql文件恢复数据:

mysql -uroot -p123456 -e “source /root/all_mysql_backup.sql”
查看恢复好的数据,搞定~!

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值