Skip to main content

innodb force recovery

What we will need to do for the recovery is to stop mysql and put it in innodb_force_recovery to attempt to backup all databases.

service mysqld stop
mkdir /root/mysqlbak
cp -rp /var/lib/mysql/ib* /root/mysqlbak
vim /etc/my.cnf

You can start from 1 to 4, go up if it does not start and check mysql logs if it keeps crashing.

innodb_force_recovery = 1

service mysqld start
mysqldump -A > dump.sql

Drop all databases that needs recovery.

service mysqld stop
rm /var/lib/mysql/ib*

Comment out innodb_force_recovery in /etc/my.cnf

service mysqld start

Then check /var/lib/mysql/server/hostname.com.err to see if it creates new ib's.
Then you can restore databases from the dump:mysql < dump.sql