Check and repair a database
Tables can become damaged after a crash or full disk. Symptoms include "table is marked as crashed", missing posts, or the database error in Fix "Error establishing a database connection".
Important: Export the database first. See Export a database.
Option 1: phpMyAdmin
- Open Account → Hosting → your site → Databases and click Open phpMyAdmin. See Use phpMyAdmin.
- Click your database, tick all tables (Check all).
- In the With selected menu, choose Check table, then Repair table for any marked bad. Optimize table reclaims space.
Option 2: WP-CLI
cd ~/public_html
wp db check
wp db repair
wp db optimize
Option 3: mysqlcheck
mysqlcheck -u yourusername_shop -p --check yourusername_bakery
mysqlcheck -u yourusername_shop -p --auto-repair --check yourusername_bakery
mysqlcheck -u yourusername_shop -p --optimize yourusername_bakery
What the results mean
| Status | Meaning |
|---|---|
| OK | Fine |
| Table is already up to date | Fine |
| Corrupt | Repair it |
Table doesn't support repair |
InnoDB tables repair differently. Restore from backup, or export and re-import |
InnoDB tables, which WordPress uses today, rarely need repair. If repair doesn't help, restore a recent daily copy from Backups, or ask us to do it. See Back up and restore WordPress.
Keep it healthy
- Keep free disk space. See See what's using your storage.
- Delete old revisions, transients, and spam comments.
- Run
wp db optimizeoccasionally.
Still stuck? Ask us and we'll walk you through it.