非正常關機時,innodb故障導致mysql無法啟動的解決方法
一次非正常關機,mysql無法啟動。查看err日志,顯示:
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: Error: trying to access page number 4294899072 in space 0,
InnoDB: space name ./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. www.2cto.com
120331 1:03:41 InnoDB: Assertion failure in thread 3078932288 in file fil0fil.c line 4409
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. www.2cto.com
21:03:41 UTC - mysqld got signal 6 ;
沒辦法,只好在/etc/my.cnf中寫入
[mysqld] innodb_force_recovery = 4
但是仍然無法啟動。
改為:innodb_force_recovery = 6
數據庫可以讀出來,在6的情況下,是無法修改數據庫的,也無法插入,只能導出。
用mysqldump導出,再把innodb_force_recovery改為0,但是數據無法導入。
最後還是刪除了數據庫重建。
這是第二次遇到這種錯誤,標記一下。
作者 lsstarboy