Repair & Optimize WordPress Database

If your WordPress site is slow, showing errors, or behaving unexpectedly, repairing the database can often resolve the issue.


How to Repair the Database

  1. Open your wp-config.php file
  2. Add the following line:
define('WP_ALLOW_REPAIR', true);
  1. Save the file
  2. Visit this URL in your browser:
https://yourdomain.com/wp-admin/maint/repair.php
  1. Choose one of the options:
    • Repair Database
    • Repair and Optimize Database

Important

  • No login is required to access this page
  • Remove the line from wp-config.php after use:
// Remove this after repair
define('WP_ALLOW_REPAIR', true);

When to Use This

  • Database connection errors
  • Slow backend performance
  • Corrupted tables

Tip: Always take a database backup before running repairs.