Repair tables in MySQL

Table corruption in MySQL is a very frequent issue. This primarily happens due to failed/forced transactions. MySQL primarily 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. This option triggers the same commands mentioned above via backend.

The scope of this article is only to repair the tables using MyISAM.

  • MySQL
  • 0 Users Found This Useful
Was this answer helpful?

Related Articles

Directory and File Structure - Linux

Directory/Folder StructureFrom amongst the several directories found within your cPanel account,...

PHP require, require_once errors

If you an error that looks like one of these... Warning:...

PHP Parse error: syntax error, unexpected $end

This error is typically caused by a missing } used in PHP to denote content belonging to a WHILE,...

How to drop tables from a database in phpMyAdmin?

This article will demonstrate how to drop (permanently delete) tables from a database in...

How to drop tables from a database in phpMyAdmin?

This article will demonstrate how to drop (permanently delete) tables from a database in...

Powered by WHMCompleteSolution