Home / WordPress / Repair a Corrupted WordPress Database: Safe Methods

Repair a Corrupted WordPress Database: Safe Methods

Repair corrupted WordPress database tables using built-in repair mode or phpMyAdmin, then validate site integrity.

Views: 23 Unique: 17 Updated: 2026-03-16

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

  1. Add in wp-config.php:
define("WP_ALLOW_REPAIR", true);
  1. Open /wp-admin/maint/repair.php and run Repair (or Repair and Optimize).
  2. Remove the line from wp-config.php after finishing.

Method B) phpMyAdmin repair

  1. Select all WordPress tables.
  2. 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
Back to category