Databases

How to fix "Table is marked as crashed and should be repaired" in MySQL

MySQL says a table is marked as crashed and should be repaired? Learn why tables crash, how to repair them in cPanel or phpMyAdmin, and how to use mysqlcheck on a VPS.

IntermediatecPanel hosting2 min read

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_options or wp_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

  1. Open cPanel → Databases → MySQL Databases.
  2. Under Modify Databases → Repair Database, choose the database and click Repair Database.
  3. Check the result shows the table as OK.

Repair the table in phpMyAdmin

  1. Open cPanel → Databases → phpMyAdmin and select the database.
  2. Tick the crashed table (or Check all).
  3. 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-databases

For 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.

Next steps

Was this guide helpful?

Still stuck?

Ask MdmHost AI for a quick answer, or open a ticket and our team will take a look. We are here 24/7.