一次服务器断电,造成innodb引擎表(日志表)损坏的解决办法
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了一次服务器断电,造成innodb引擎表(日志表)损坏的解决办法相关的知识,希望对你有一定的参考价值。
1、mysql日志报错
innodb引擎提示数据库没有正常关闭,报innodb错误
180112 0:49:28 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 2580576839 180112 0:49:28 InnoDB: Error: page 1 log sequence number 2580582651 InnoDB: is in the future! Current system log sequence number 2580576839. InnoDB: Your database may be corrupt or you may have copied the InnoDB InnoDB: tablespace but not the InnoDB log files. See InnoDB: http://dev.mysql.com/doc/refman/5.5/en/forcing-innodb-recovery.html InnoDB: for more information. 180112 0:49:28 InnoDB: Error: page 5 log sequence number 2580579963 InnoDB: is in the future! Current system log sequence number 2580576839. InnoDB: Your database may be corrupt or you may have copied the InnoDB InnoDB: tablespace but not the InnoDB log files. See InnoDB: http://dev.mysql.com/doc/refman/5.5/en/forcing-innodb-recovery.html InnoDB: for more information. 180112 0:49:29 InnoDB: Error: page 65565 log sequence number 2580577006 InnoDB: is in the future! Current system log sequence number 2580576839. InnoDB: Your database may be corrupt or you may have copied the InnoDB InnoDB: tablespace but not the InnoDB log files. See InnoDB: http://dev.mysql.com/doc/refman/5.5/en/forcing-innodb-recovery.html InnoDB: for more information. 180112 0:49:29 InnoDB: Error: page 65566 log sequence number 2580577176 InnoDB: is in the future! Current system log sequence number 2580576839. InnoDB: Your database may be corrupt or you may have copied the InnoDB InnoDB: tablespace but not the InnoDB log files. See InnoDB: http://dev.mysql.com/doc/refman/5.5/en/forcing-innodb-recovery.html InnoDB: for more information. 180112 0:49:29 InnoDB: Starting an apply batch of log records to the database... InnoDB: Progress in percents: 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 180112 0:49:29 InnoDB: Assertion failure in thread 140330795001600 in file rem0rec.c line 569 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. 16:49:29 UTC - 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. 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、查看mysql服务状态,提示mysql没在运行,但是锁定文件存在
ERROR! MySQL is not running,but lock file (/var/lock/subsys/mysql) exists
3、重启mysql服务,提示错误
[[email protected] subsys]# /etc/init.d/umail_mysqld restart ERROR! MySQL server PID file could not be found! Starting MySQL. ERROR! The server quit without updating PID file (/usr/local/u-mail/data/mysql/default.pid).
日志报下面的错误:
180112 9:12:44 InnoDB: Cannot initialize created log files because 180112 9:12:44 InnoDB: data files are corrupt, or new data files were 180112 9:12:44 InnoDB: created when the database was started previous 180112 9:12:44 InnoDB: time but the database was not shut down 180112 9:12:44 InnoDB: normally after that. 180112 9:12:44 [ERROR] Plugin 'InnoDB' init function returned error. 180112 9:12:44 [ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed.
将数据库下ib_logfile文件移动走后(因为最开始看日志的时候提示了InnoDB: tablespace but not the InnoDB log files. See ),可以重启mysql服务。
4、以为重启mysql成功后就可以,但是没想到innodb引擎表已经损坏了。
日志提示:
180112 9:37:40 [ERROR] Cannot find or open table umail/core_auth_log from the internal data dictionary of InnoDB though the .frm file for the table exists. Maybe you have deleted and recreated InnoDB data files but have forgotten to delete the corresponding .frm files of InnoDB tables, or you have moved .frm files to another database? or, the table contains indexes that this version of the engine doesn't support. See http://dev.mysql.com/doc/refman/5.5/en/innodb-troubleshooting.html how you can resolve the problem
(1)用phpmyadmin进去看提示正在使用,修复提示Unknown storage engine 'InnoDB '错误。
(2)mysql命令控制台输入show engines;查看,也没有innodb引擎。
5、解决办法
(1)使用drop tables 表名;,删除innodb表
(2)停止与mysql服务相关的服务
(3)使用show processlist;命令查看是否有锁定
(4)将创建这几个表的sql文件放在一个路径下
(5)到mysql命令控制台输入source /usr/local/kx-mail/data/mysql/default/base_table.sql导入
(6)重启mysql服务
以上是关于一次服务器断电,造成innodb引擎表(日志表)损坏的解决办法的主要内容,如果未能解决你的问题,请参考以下文章