Troubleshooting
Corrupted tables in a MySQL database
Symptoms
An error that mentions a table doesn't prove it is corrupted. Keep the exact code and message: invalid SQL, permissions, lack of disk space, locks or a missing table each need a different procedure.
Before repairing:
- Confirm with a check that the specific table is marked as corrupted.
- Identify its engine in phpMyAdmin.
REPAIR TABLEworks for engines such as MyISAM and, on MariaDB, Aria; it doesn't repair InnoDB. - Keep a backup you can restore. A repair can lock the table or discard damaged data.
Repairing with phpMyAdmin
In phpMyAdmin, select only the confirmed table with a compatible engine and use Repair table. Don't select the whole database as a first step.
Repairing with cPanel
In cPanel > Manage My Databases you may see Repair Database. This action works on the whole database; use it only with a backup available and after confirming that it contains tables this tool can repair.
Repairing over SSH
If you are an advanced user and have SSH access enabled, you can run the repair with the following command:
mysqlcheck -u USUARIO -p BASE TABLA mysqlcheck -u USUARIO -p --repair BASE TABLA
On MariaDB servers, the equivalent command may be mariadb-check. If the table is InnoDB, the server shows errors of its own or there is no valid backup, stop and contact support; don't force a recovery on the shared service.
Validate after the repair
Keep the full output of the check and the repair. Compare counts and application features against a known reference; a table opening again doesn't prove that no damaged records were discarded.
If the error comes back, investigate disk space, logs and server status with support before repeating the repair. Don't add a scheduled repair task as a substitute for diagnosis, and don't run tools against the physical files of a database in use.
The REPAIR TABLE reference details the engines and limits. For InnoDB, recovery has to be planned according to the error and the backup available.
You may also find useful
- Joomla 1.0 and 1.5 with MySQL 8, error with the reserved word "groups" Get a Joomla 1.0 or 1.5 site working with MySQL 8 by escaping the reserved word groups in the com_co...
- PrestaShop: "An exception occurred while establishing a connection to figure out your platform version" Fix for the SQLSTATE[HY000] [2026] SSL_CTX_set_default_verify_paths failed error when installing or...
- Why cPanel and phpMyAdmin show different sizes for a database Explains why cPanel and phpMyAdmin calculate different sizes, how to find the large tables and when...
- Error "Shop not found at line xxx in file classes/shop/Shop.php" Track down Shop not found by checking the requested URL, shop_url and the scope of PS_SHOP_DEFAULT b...
Something wrong or out of date? Tell us and we will review it.