InnoDB database recovery

If mysql shutdown unexpectly, innodb might crashed and not possible to
repair through phpmyadmin or mysql konsole.

Solution:
1) check the innodb log file size

-rw-rw—- 1 mysql mysql 104857600 Oct20 17:50 ib_logfile0
-rw-rw—- 1 mysql mysql 104857600 Oct 20 17:01 ib_logfile1
So the size is 104857600

2) now edit /etc/my.cnf
add these two line on top, edit the log size according to server
innodb_force_recovery=6
innodb_log_file_size=104857600

3) restart mysql
service mysql restart

4) now dump database
mysqldump database_name > database_name.sql

5) Now exit recovery mode by removing those two line that has been added

6) restart mysql
service mysql restart

7) now drop the tables from the database, and restore it using the
.sql file that has been dumped.

that’s all

 

InnoDB database recovery

Leave a Reply

Your email address will not be published. Required fields are marked *

Fork me on GitHub