Error on screen · Fix guide

“Error establishing a database connection”: what it means and how to fix it

WordPress stores your posts, pages and settings in a database. This message means it can’t connect to it. The content is normally fine. The connection is the problem, and it’s usually one of a handful of causes.

Site down right now? Call us 0191 580 4040 Mon-Fri, 9am-5:30pm
Not urgent? Contact us

What this usually means

  • The database name, user, password or host in wp-config.php is wrong or has changed
  • The database server is down, overloaded or out of space
  • The database user has lost its permissions
  • The database is corrupted

Steps to fix it

  1. Check your host first

    Look at their status page and ask whether the database server has a problem.

  2. Compare your details

    Open wp-config.php and check DB_NAME, DB_USER, DB_PASSWORD and DB_HOST against your hosting panel.

  3. Test the connection

    Try logging in to phpMyAdmin or your host’s database tool with the same details.

  4. Repair only if needed

    If tables are damaged, WordPress has a repair tool. Turn it on, run it, then turn it off straight away.

wp-config.php
define( 'WP_ALLOW_REPAIR', true );

When to get help

If the details are correct and your host says the database is up, or you suspect corruption, send us the details. Don’t send passwords, we’ll arrange secure access.

Send us the details

Frequently asked questions

Have I lost my posts?

Almost certainly not. The data is in the database. WordPress just can’t reach it.

Why does it come and go?

Often the database server is overloaded. A traffic spike or a busy shared server can cause short outages.

Will repairing the database delete anything?

The tool tries to fix damaged tables. Take a backup first.

Call us Get in touch