The error "Table is marked as crashed and should be repaired" means MySQL or MariaDB found a damaged MyISAM table and will not read from it until it is repaired. On WordPress this often shows as a broken site, missing posts or a database connection error. Repairing the table usually takes seconds.
Before you start
- Note the table name from the error, for example
wp_optionsorwp_posts. - Back up the database first (cPanel → Files → Backup or a JetBackup database snapshot).
Why MySQL tables crash
- A full disk while MySQL was writing – the most common cause on hosting accounts.
- The MySQL server stopping unexpectedly (out of memory or power loss on a VPS).
- The MyISAM storage engine, which is not crash-safe. InnoDB recovers automatically in most cases.
Repair the table in cPanel
- Open cPanel → Databases → MySQL Databases.
- Under Modify Databases → Repair Database, choose the database and click Repair Database.
- Check the result shows the table as
OK.
Repair the table in phpMyAdmin
- Open cPanel → Databases → phpMyAdmin and select the database.
- Tick the crashed table (or Check all).
- From With selected, choose Repair table.
You can also run:
REPAIR TABLE wp_options;Repair on a VPS with mysqlcheck
Check and repair every table in all databases:
mysqlcheck -u root -p --auto-repair --check --all-databasesFor a badly damaged MyISAM table, stop MySQL and use myisamchk -r /var/lib/mysql/dbname/tablename.MYI, then start it again.
Warning: Fix the cause first. If the disk is full, a repair can fail or the table crashes again immediately. Check disk space before repairing.
Prevent tables from crashing
- Convert MyISAM tables to InnoDB in phpMyAdmin (Operations → Storage Engine → InnoDB) or with
ALTER TABLE wp_options ENGINE=InnoDB;. - Keep enough free disk space; see cPanel disk space full.
- On a VPS, give MySQL enough RAM so the OOM killer does not stop it; see out of memory killer.
FAQ
Will repairing a table lose data?
Usually not, but badly damaged rows can be dropped. That is why you back up first.
What if repair fails?
Restore the database from JetBackup to a point before the crash, or open a ticket.
Do InnoDB tables need repair?
Rarely. InnoDB uses crash recovery; "repair" does not apply to it the same way.
