If your website suddenly stops loading correctly, or your error logs or phpMyAdmin show a message like "Table './yourdatabase/wp_options' is marked as crashed and should be repaired", one of your database's tables has become corrupted. This is usually fixable in a few minutes, and it doesn't normally mean you've lost any data.
What Causes a Crashed Table
A table becomes "crashed" when a write to it is interrupted before it finishes. The most common causes are:
- A script or process was stopped partway through writing to the table, for example during a large import or an abrupt restart.
- A disk space or disk error problem occurred while MySQL was writing to the table.
- Two processes, such as a plugin and a cron job, tried to write to the same table at the same time.
This happens most often on WordPress and other Softaculous-installed apps, since they write to the database constantly as visitors browse the site.
How to Repair a Crashed Table Using phpMyAdmin
The fix is the same whether you're on cPanel or DirectAdmin, since both give you access to the same phpMyAdmin tool.
- Open phpMyAdmin from your control panel.
- In the left sidebar, click the database that contains the affected website.
- Tick the checkbox next to the table named in the error message. If you're not sure which table it is, tick the checkbox at the top of the list to select all tables.
- Scroll to the bottom of the table list and open the With selected dropdown.
- Click Repair table.
phpMyAdmin will run the repair and show a status message for each table. A table that repaired successfully will show OK in its status column.
Take a quick backup of the database first if you can. Repairing a table is a standard, safe MySQL operation, but it's good practice to have a backup on hand whenever you're working on a table that's already showing problems.
If the Table Still Won't Repair
Occasionally a table is too badly damaged for phpMyAdmin's repair tool to fix in one pass. If that happens:
- Run the repair a second time. Some tables need two passes before they clear.
- Restore just that table from a recent backup instead of repairing it.
- If you don't have a usable backup, contact ZIPROF support with the exact error message and the table name so it can be looked at from the server side.
Preventing It From Happening Again
- Keep regular backups so a crashed table is never a serious problem.
- Avoid interrupting large database imports or long-running scripts partway through.
- If a particular table crashes repeatedly, ask your developer whether it can be converted from MyISAM to InnoDB, which handles unexpected interruptions more gracefully.
For help finding phpMyAdmin in your control panel, see How to Access phpMyAdmin in cPanel and DirectAdmin.