This is the most common WordPress error. It means WordPress cannot connect to the MySQL database that stores all your content, settings, and user accounts. The causes range from corrupted databases to incorrect credentials.
What This Error Looks Like
Your website shows: Error establishing a database connection instead of your normal homepage. The WordPress admin area also shows the same error.
Fix 1: Check Your Database Credentials
- Open cPanel → File Manager.
- Navigate to your WordPress installation directory (usually
public_html). - Find and edit the
wp-config.phpfile. - Look for these lines:
define( 'DB_NAME', 'database_name' ); define( 'DB_USER', 'username' ); define( 'DB_PASSWORD', 'password' ); define( 'DB_HOST', 'localhost' ); - Verify these match your actual database details in cPanel → MySQL Databases.
- If any are incorrect, update them and save the file.
Fix 2: Repair the Database
- Go to cPanel → MySQL Databases.
- Scroll to Modify Databases.
- Select your WordPress database from the dropdown.
- Click Repair Database.
- Try loading your website again.
Fix 3: Check for Corrupt Tables
- Go to cPanel → phpMyAdmin.
- Select your WordPress database.
- Look for tables marked with "in use" or showing errors.
- Select all tables, and from the dropdown select Repair table.
Fix 4: Check if the Database Server Is Down
- Go to cPanel → MySQL Databases.
- Check if you can see your databases listed. If the page is blank or shows an error, the database server may be temporarily down.
- Contact support to check the server status.
Fix 5: Check Disk Space
- Go to cPanel and check the disk usage bar on the right sidebar.
- If your account is at 100% disk usage, the database cannot write new data.
- Free up space by deleting unnecessary files, old backups, or large logs.
Important Notes
- Always back up your database before attempting repairs. Go to cPanel → Backup Wizard → Backup → MySQL Databases.
- Never edit
wp-config.phpwithout knowing what you are doing — a typo can make things worse. - This error can also be caused by too many connections to the database (traffic spike). This is a server-side issue — contact support.
Troubleshooting
- Error persists after all fixes: The issue may be server-side. The MySQL service may need to be restarted. Submit a ticket with your cPanel username and domain name.
- Website works intermittently: This usually means the database server is overloaded. It resolves on its own during low-traffic periods. If persistent, contact support about database performance.
- Error started after a plugin/theme update: A plugin may have corrupted the database. Try renaming the
wp-content/pluginsfolder via File Manager to disable all plugins, then re-enable them one by one. - Error only appears on some pages: The specific table that page uses may be corrupted. Use phpMyAdmin to check for broken tables and repair them.
- Cannot access phpMyAdmin either: The MySQL server is likely down. Contact support immediately — this affects all accounts on the server.
Need help? Contact our support team.