Knowledgebase:
Repair crashed MySQL tables
Posted by Ashish S, Last modified by Ashish S on 26 May 2015 07:21:50 PM

Table corruption in MySQL is a very frequent issue. This primarily happens due to failed/forced transactions. MySQL primary supports two type of engines MyISAM and InnoDB. It is to be noted that the repair utility provided by MySQL can only be used for tables using MyISAM. Crashed tables using InnoDB cannot be repaired using the repair tool. Now, the commands to repair tables/databases in MySQL are as follows:

mysqlcheck -A  [To check and repair all databases on the server]

mysqlcheck -r Database_name [where Database_name is the name of the database to be checked]

Another thing to be noted here is that the -r option can fix everything except unique keys that aren’t unique.

Control panels like cPanel provide an option to repair tables from the interface itself. In cPanel this can be done via cPanel >> MySQL Databases >> Modify Databases >> Check DB. However, please note that this will work for MyISAM tables only.

 

(1 vote(s))
Helpful
Not helpful