Guides

'Error establishing a database connection': what does it mean?

, 1 min read, by Web Rescue team

A long corridor of servers in a data centre

"Error establishing a database connection" means WordPress can't reach the database that holds your pages, posts and settings. It's usually one of three things: the connection details in wp-config.php are wrong, the database server is down or overloaded, or a database table is corrupted.

1. Check the connection details

Open wp-config.php and compare DB_NAME, DB_USER, DB_PASSWORD and DB_HOST with the database shown in your hosting control panel. A password change or a site move is a common cause.

2. Check the database server

If the details are right, the database server may be down or hitting its connection limit. Check your host's status page; on shared hosting a busy neighbour can cause it.

A man working on network equipment in a dark server room
Most of the time the database is fine and the connection details are wrong.

3. Repair the database

If the admin area shows a different error about the database needing repair, add define('WP_ALLOW_REPAIR', true); to wp-config.php, visit /wp-admin/maint/repair.php, then remove the line afterwards. Take a backup first.

Still down? We'll get it back up.

Rather we just fixed it?

Tell us what's wrong and when to ring. Two minutes, no account, no call centre. The technical questions come after and you can skip them.

  1. LoggedYour name, number and the problem are saved the moment you send them.
  2. Called the same dayA UK engineer rings you at the time you picked.
  3. Diagnosed and quotedWe find the cause and tell you the price before any work starts.
  4. Fixed and verifiedWe test it with you, explain what we changed and stand behind the fix.
Same-day call

Your job ticket

Job no.New
How should we contact you?

WhatsApp is usually best, and you can send screenshots.

Spam check
  • Microsoft MVP and Microsoft 365 partner
  • AWS Solutions Architect
  • WordPress certified
  • Apple developer
  • Google IT Support certified
  • UniFi partner
  • Shopify