What this problem is
Your database has corrupted tables, causing errors, missing content, or a database connection error.
Why it happens
- Server crashes or abrupt shutdowns
- Disk issues or quota exhaustion
- MySQL problems under high load
Prerequisites
- Full database backup (before repair)
- Access to wp-config.php and/or phpMyAdmin
Diagnosis
In phpMyAdmin, check tables for errors. WordPress may also show: One or more database tables are unavailable.
Detailed steps
Method A) WordPress built-in repair
- Add in
wp-config.php:
define("WP_ALLOW_REPAIR", true);
- Open
/wp-admin/maint/repair.phpand run Repair (or Repair and Optimize). - Remove the line from
wp-config.phpafter finishing.
Method B) phpMyAdmin repair
- Select all WordPress tables.
- Choose Repair table.
Expected results
- Tables repaired and site errors stop
What to do if it fails
- Restore from backup if repairs worsen corruption
- Ask hosting to run MySQL checks or restore from server backups
Best practices
- Keep automated backups and monitor disk/inodes to avoid corruption events