centos 7 修复mysql,centos mysql /mariadb非正常关闭导致数据库损坏的恢复

当CentOS 7上的MySQL因非正常关闭而损坏时,通过检查日志发现错误信息,尝试设置`innodb_force_recover`参数进行修复。首先备份数据库,然后在`my.cnf`中添加配置,从1到6逐步尝试,最终成功启动MySQL。但无法进行数据修改,通过mysqldump导出关键表,并删除损坏的ib*文件和数据库文件夹,重启MySQL。之后重建数据库并导入备份,恢复了用户表。最后,设置bin-log和crond脚本进行定期备份,确保数据安全。
摘要由CSDN通过智能技术生成

昨天在进行网站用户维护的时候,发现网站无法登陆,发现是后台mysql没有启动。

反复重启服务器无果,手动启动mysql

service mysql start

提示

Starting MySQL..The server quit without updating PID file (/usr/local/mysql/var/www.mydomain.com.pid).[FAILED]

搜索了一下 Starting MySQL..The server quit without updating PID file 相关的信息,尝试了一些方法无效,似乎也不对症。

于是查看log:

tail -f -n 100 /usr/local/mysql/var/www.mydomain.com.err

看到如下信息:

181113 12:23:09 mysqld_safe Starting mysqld daemon with databases from /usr/local/mysql/var

181113 12:23:09 [Note] /usr/local/mysql/bin/mysqld (mysqld 5.5.48) starting as process 1204 …

181113 12:23:09 [Note] Plugin ‘FEDERATED’ is disabled.

181113 12:23:09 InnoDB: The InnoDB memory heap is disabled

181113 12:23:09 InnoDB: Mutexes and rw_locks use GCC atomic builtins

181113 12:23:09 InnoDB: Compressed tables use zlib 1.2.3

181113 12:23:09 InnoDB: Initializing buffer pool, size = 16.0M

181113 12:23:09 InnoDB: Completed initialization of buffer pool

181113 12:23:09 InnoDB: highest supported file format is Barracuda.

InnoDB: Log scan progressed past the checkpoint lsn 8659431036

181113 12:23:09 InnoDB: Database was not shut down normally!

InnoDB: Starting crash recovery.

InnoDB: Reading tablespace information from the .ibd files…

InnoDB: Restoring possible half-written data pages from the doublewrite

InnoDB: buffer…

InnoDB: Doing recovery: scanned up to log sequence number 8659436630

InnoDB: Error: trying to access page number 3489660288 in space 0,

InnoDB: space name /usr/local/mysql/var/ibdata1,

InnoDB: which is outside the tablespace bounds.

InnoDB: Byte offset 0, len 16384, i/o type 10.

InnoDB: If you get this error at mysqld startup, please check that

InnoDB: your my.cnf matches the ibdata files that you have in the

InnoDB: MySQL server.

181113 12:23:09 InnoDB: Assertion failure in thread 140223550441248 in file fil0fil.c line 4578

InnoDB: We intentionally generate a memory trap.

InnoDB: Submit a detailed bug report to http://bugs.mysql.com.

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.

04:23:09 UTC – mysqld got signal 6 ;

This could be because you hit a bug. It is also possible that this binary</

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值