How to repair and optimise database tables

Use phpMyAdmin to check, repair and optimise MySQL tables, and understand when corruption is really the problem.

Guide2 min readLast updated
On this page
  1. Checking tables
  2. Repairing
  3. Optimising
  4. When it isn’t corruption
  5. If it doesn’t work

Checking tables

  1. Open Extra Features › phpMyAdmin and select the database.
  2. On the Structure tab, tick Check all.
  3. From With selected, choose Check table.

Each table reports OK or an error.

Repairing

If a table reports it’s crashed or corrupt:

  1. Export the database first, even if a table is damaged. How to export a database (backup with phpMyAdmin)
  2. Tick the affected tables.
  3. Choose Repair table.

Repair works fully on MyISAM tables. For InnoDB tables — the default for modern applications — “repair” isn’t supported in the same way; a corrupted InnoDB table is best recovered by restoring from a backup. Genuine InnoDB corruption is rare.

Optimising

Optimize table reclaims space left after large deletions and defragments data.

  • Useful after deleting many rows, such as clearing old logs or revisions
  • Unnecessary to run routinely on small databases

When it isn’t corruption

Most “database errors” on websites are connection problems — wrong credentials or privileges — not damaged tables. Check those first. Database connection failed

Every Traxio account includes a MySQL database with phpMyAdmin. If you’re still choosing a host, PHP and MySQL hosting is £0.99 a month.

If it doesn’t work

These guides cover the most common problems, starting with what you can see. Or browse every fix for a common problem.

Spotted something out of date or unclear? Tell us and we’ll fix it.

Keep going