Follow us on Social Media:

MySQL Database Administrator

Boost Your Quick Knowledge in MySQL DBA Work, Concepts, Tips and Trick

Friday, 2 February 2018

How to recover Your crashed/corrupted databases?.

Recover Your crashed/corrupted databases.

We have tried our best effort to scrape out some information which hopefully help to diagnose the issue, but sometime it's really painful to recover the same. 
So we are sharing some points regarding this concern...

On Linux -->>

Steps to get it back up.

1. Stop mysqld Service.
2. Backup /var/lib/mysql/ib*     [Backup MySQL datafolder]
3. Add the following line into /etc/my.cnf:
innodb_force_recovery = 3
4. Restart mysqld.
5. Dump all tables:# mysqldump -u root --password=pwd --routines --all-database > /home/getmysql.sql
6. Drop all databases which need recovery.
7. Stop mysqld.
8. Remove /var/lib/mysql/ib*
9. Comment out or remove innodb_force_recovery = 3 in /etc/my.cnf
10. Restart mysqld. Look at mysql error log. By default it should be /var/lib/mysql/server/getmysql.err to see how it creates new ib* files.
11. Restore databases from the dump:mysql < getmysql.sql


On Windows -->>

Steps to get it back up.

1. Stop mysql Service.
2. Backup C:\ProgramData\MySQL\MySQL Server 5.6\data    [Backup MySQL datafolder]
3. Add the following line into C:\Program Files\MySQL\MySQL Server 5.6\my.ini:
innodb_force_recovery = 3
4. Restart mysql Service.
5. Dump all tables:# mysqldump -u root --password=pwd --routines --all-database > d:\getmysql.sql
6. Drop all databases which need recovery.
7. Stop mysql service.
8. Remove C:\ProgramData\MySQL\MySQL Server 5.6\ibdata*
9. Comment out or remove innodb_force_recovery = 3 in C:\Program Files\MySQL\MySQL Server 5.6\my.ini
10. Restart mysql service. Look at mysql error log. By default it should be C:\ProgramData\MySQL\MySQL Server 5.6\data\getmysql.err to see how it creates new ib* files.
11. Restore databases from the dump:mysql < getmysql.sql

Hopefully it will recover you crashed database. If you have still facing any error kindly collect screenshot and some related information and Share with us by Click Here

No comments:

Please Like and Subscribe us ....

Please visit the website on daily basis , Your New articles will publish at any moment. Please Subscribe us for getting Latest Updates...