Here are 4 different methods to fix the scary-looking error: “WordPress database error Table ‘./db/wp_options’ is marked as crashed and should be repaired”.
NOTE: It is critically important that you backup your database before performing any of the following suggestions. You’re fully responsible for undertaking this yourself, I can’t be held responsible if you break anything.
Option 1. Repair the crashed table
Step 1. Log in to your phpMyAdmin or connect to it via your cPanel back-end
Step 2. Select the database with the crashed table
Step 3. Put a checkmark next to each crashed table or select them all
Step 4. Select “Repair table” from the “With selected:” drop-down at the bottom of the list.
Let phpMyAdmin do its thing.
If the database table engine is MyISAM the check was successful:
but if the engine is InnoDB then the repair will fail with the error message: The storage engine for the table doesn’t support repair
If Repair does not work and the table is still crashed, try the following:
Option 2. Change crashed table engine
Step 1. Log in to your phpMyAdmin or connect to it via your cPanel back-end
Step 2. Select the database with the crashed table
Step 3. Click on the crashed table name
Step 4. Click on the tab
Step 5. Under Table options change the Storage Engine from MyISAM to InnoDB or vice versa.
Step 6. Click on the button under Table options section
Option 3. Re-import the crashed table
The table contains rows that have crashed, so exporting the table’s content will export all rows besides those that have crashed. And if the table’s crashing rows aren’t essential to the functioning of WordPress itself, such as transients, plugin settings, etc. – this will then put an end to the problem.
Export table content
Step 1. Log in to your phpMyAdmin or connect to it via your cPanel back-end
Step 2. Select the database with the crashed table
Step 3. Click on the crashed table name
Step 4. Click on the
Step 5. Click on the button
Truncate the table
After the table content was successfully exported and saved as a file on your device, you need to truncate the table (delete all content) and re-import the downloaded file.
Step 6. click on the tab
Step 7. Scroll down to the bottom and click on the Empty the table (TRUNCATE) link
Step 8. Click OK on the confirmation popup
and you will see the confirmation message:
Import the table
Now you need to import back the downloaded file to the table.
Step 9. Click on the
Step 10. Click on Choose FIle then select the exported file and click on Open.
Step 5. Click on the button at the bottom and wait for the import to finish.
Option 4. Restore the crashed table
Backups are important, and if you have regular daily backups you can easily restore the crashed table from the backup.
The restore process is different depending on the backup solution of plugin that you use.
- PHPMyAdmin: Restoring your database from backup using phpMyAdmin
- Softaculous: How to Restore a Backup
- Updraft: How do I restore my site with UpdraftPlus?