Chapter 12 · 12.7
Checking, repairing and optimising a database
Does your website show an error about a table, such as "Table is marked as crashed" or "Incorrect key file for table"? Or do you want to make a database smaller and faster after cleaning it up? You can do this with the buttons under Database Operations.
How to do it
- First, make an export of the database (see Exporting a database). A repair rarely goes wrong, but it's good to have a copy just in case.
- Go to Databases and click Manage next to the database.
- Scroll to Database Operations and click the button you need.
After a few seconds, you'll see the result, for example "Database check was successful".

| Button | What does it do? | When? |
|---|---|---|
| Check | Checks whether all tables are in order and reports errors. | If you get an error message about a table, or if you're not sure. |
| Repair | Tries to repair damaged tables. | If Check finds an error, or in case of "marked as crashed". |
| Optimize | Clears empty space in the tables, so the database becomes smaller and often faster. | After clearing out a lot of data, such as old revisions, spam comments or log tables. |
In phpMyAdmin
You can also work per table. Open phpMyAdmin (see Opening and using phpMyAdmin), click the database on the left, tick the tables and choose Check table, Repair table or Optimize table from the With selected list at the bottom.
Good to know
- Most tables used by modern software use InnoDB. These rarely get damaged, and Repair doesn't do much for them. For the older MyISAM type, repairing does help.
- Optimising doesn't magically make a database fast. A slow website is more often caused by plugins or too much data than by the database itself (see My website is slow).
- If repairing doesn't work, restore a backup of the database using WebOké Backups (see Can I also do this in My WebOké? WebOké Backups) or your own export (see Importing a database, including large files).
Tip: Using WordPress? A plugin like WP-Optimize clears out old revisions, drafts and spam. Then optimise the database here.
