How to repair and optimise database tables
Use phpMyAdmin to check, repair and optimise MySQL tables, and understand when corruption is really the problem.
Checking tables
- Open Extra Features › phpMyAdmin and select the database.
- On the Structure tab, tick Check all.
- From With selected, choose Check table.
Each table reports OK or an error.
Repairing
If a table reports it’s crashed or corrupt:
- Export the database first, even if a table is damaged. How to export a database (backup with phpMyAdmin)
- Tick the affected tables.
- 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.
- phpMyAdmin won’t open, logs out or times outFix common phpMyAdmin problems: login loops, session expiry, blank pages, import timeouts and ‘max_input_vars’ warnings.
- “Error establishing a database connection” in WordPressFix WordPress’s database connection error: check wp-config.php credentials, database user permissions, the database host and damaged tables.
Spotted something out of date or unclear? Tell us and we’ll fix it.