Repairing Corrupted MySQL Database Because of Interrupted ALTER TABLE Command
The DDL (Data Definition Language) commands are used to define (or modify) the definition of a database table. Likewise in MySQL, the ALTER TABLE command is one of the DDL commands that is used to change the structure of the table. Using this command, you can perform the following tasks:
Add/delete columns in a table,
Create or drop indexes,
Change the type of the columns,
Rename the table name or any other component,
Change the table type or any table comment.
Sometimes, the database table may get corrupt due to abnormal system shutdown when the ALTER TABLE command is taking place. Because of this, you are unable to perform modifications on the database table. In such cases, you should take appropriate corrective measures to rectify the problem. However, if you are not able to address the issue then you should use a repair MySQL database software to recover database.
Consider a scenario wherein you are using the ALTER TABLE command to modify the structure of a table in MySQL 5.1. While the operation is in process, there is a abrupt system shutdown. You open the database and try to rename the table but unable to do so. An error message is displayed, that is:
“Error on rename of ‘./database/’ to ‘./database/’ (Errcode: 17)”
Cause
The root cause of this error message is that the database table got corrupt during the system shutdown. Other reasons for table corruption could be virus infections, hardware issues, etc.
Resolution
To resolve this error, you should perform either of the following methods:
Delete (or move) all the files that start with either A- or B-.
Use the REPAIR TABLE command to repair the corrupted table.
The aforementioned methods should be able to provide a solution for the problem. However, if the issue is still not resolved then you should use a third-party MySQL database repair software to repair MySQL database. Such read-only tools are able to res the database using fast yet sophisticated scanning algorithms.
Database Recovery for MySQL is a MySQL recovery software that repairs corrupt MySQL databases from all instances of corruption. It is able to repair MySQL database created in InnoDB and MyISAM database engines. This MySQL repair software repairs various types of database files such as .ibdata, .ibd, .frm, .myd, .myi, and .frm. Also, this tool supports recovery of MySQL database created in MySQL 4.x and 5.x. It is compatible with Windows 7, Vista, Server 2003, XP, and Server 2000.