WordPress Error Establishing a Database Connection
Workaround available Self-hosted WordPress (WordPress.org) Updated November 13, 2026Based on 4 user reportsHow we research
Quick answer
This error means WordPress cannot talk to MySQL. Check the database credentials in wp-config.php first, then check with your host for a downed database server or a full quota.
Most likely fix: Check wp-config.php credentials
How to fix it
Try these in order — the most common fix is first.
1. Check wp-config.php credentials
- Open wp-config.php over FTP or the file manager.
- Compare DB_NAME, DB_USER, DB_PASSWORD and DB_HOST with the values in your hosting panel's MySQL section. DB_HOST is not always 'localhost' on managed hosts.
- Save and reload.
Did this fix it?2. Ask your host about the database server
- Check your host's status page and open a ticket asking whether MySQL is running and whether your account has hit its database quota or connection limit.
- This is the most common fix on shared hosting after a traffic spike.
Did this fix it?3. Repair the database
- Add define('WP_ALLOW_REPAIR', true); to wp-config.php.
- Visit yoursite.com/wp-admin/maint/repair.php and click Repair Database.
- Remove the line afterwards because the repair page needs no login.
Did this fix it?4. Reset the database password
- In your host's panel, set a new password for the database user, then put the same password in wp-config.php.
Did this fix it?5. Scan for compromise
- If credentials are correct and the host reports no problem, scan the site (for example with Sucuri SiteCheck) and restore from a clean backup if it is infected.
Did this fix it?
Symptoms
Every page, front end and wp-admin, shows 'Error establishing a database connection' in plain text.
Why it happens
- Wrong DB_NAME, DB_USER, DB_PASSWORD or DB_HOST in wp-config.php
- The MySQL server is down or overloaded
- The database user lost its privileges, or the password was changed
- Host database quota full
- Corrupted database tables
- A hacked site
This guide also covers
- error establishing a database connection
- wordpress database connection error
- wordpress error establishing database connection fix
Still not working?
If WordPress keeps failing, you're not alone. See every WordPress problem users report or the alternatives people switch to.
Done fighting WordPress? Our small team builds your own WordPress alternative, made for how you work. On your domain or hosted by us. Price agreed together.
Get a quoteThe same problem in other apps
All not loading, error messages & connection guides →
- Squarespace Domain Not Connecting (Squarespace)
- Wix Site Not Loading or Can't Be Reached (Wix)
Other WordPress errors
- WordPress White Screen of Death
- WordPress Critical Error: 'There Has Been a Critical Error on This Website'
- WordPress 500 Internal Server Error
- WordPress Too Many Redirects (ERR_TOO_MANY_REDIRECTS)
- WordPress Stuck in Maintenance Mode: 'Briefly Unavailable for Scheduled Maintenance'
- WordPress 'Allowed Memory Size Exhausted' Fatal Error
- WordPress 'Updating Failed. The Response Is Not a Valid JSON Response'
- WordPress Posts Return 404 Not Found