Tuesday, November 29, 2011

How to Recover Corrupt MySQL Database - MySQL Recovery


MySQL database is an open source database with the best speed and reliability. Most of the branded organizations use it to save their money and time. It offers several syntax to optimize, backup and repair corrupt MySQL database. MySQL database can be corrupt due to several reasons like power failure, malware attack, system failure, hardware failure and many more. Sometimes repair syntax fails to fix the corruption at this situation, you should take help from any third party MySQL database repair software.

In this article, we will discuss a condition wherein a database administrator has tape backup of C drive only and how to recover corrupt MySQL database with the help that tape backup of C drive.

Recover MySQL Database with tape backup: To do this, you will have to follow the below points.

  1. Create a new MySQL server environment: Install a same version of MySQL server to restore corrupt MySQL database. For example, if you are at MySQL version 4.1.22, then install the same version.
  2. Stop MySQL Service: It is required for adding the data folders.
  3. Copy & Paste Database Folder: Copy the database folder from old MySQL database and paste them in new MySQL database folder. Database folder contains information about .frm, .myd and .myi files. The default database folder location is C:\Program Files\MySQL\MySQL Server x.x\Data\database-Folder-Name\.
  4. Restart MySQL Service: To restore new MySQL database.
  5. Check & Repair MySQL Database Tables: MySQL offers check & repair syntax to check and repair corrupt MySQL database tables as discussed above. Check syntax specifies that there is a corruption in the table and those corrupt tables can be repaired by the Repair syntax. It is very necessary for ensuring that there is no any corruption in the MySQL database tables.
  6. Make Backup: If corruption has been fixed by the above mentioned steps then make a backup to avoid data loss in future.


Summary: In the end, if check syntax specifies that corruption in the table and Repair syntax is unable to fix then it is recommended you to try any 3rd party MySQL database repair software to fix the corruption.

Note: Above mentioned steps will work with MyISAM database storage engine not with the InnoDB database storage engine.

No comments:

Post a Comment