Skip to content
Menu
EmergenciesOctober 2, 2026

"Error establishing a database connection": causes and fixes

Your site shows a plain page with one line: Error establishing a database connection. No header, no menu, nothing else.

WordPress keeps your pages, posts, settings and users in a database. Every page view starts by connecting to it. This message means that connection failed, so WordPress has nothing to show.

The good news: in most cases your content is fine. The problem is the connection, not the data.

The four usual causes

  • The database server is down or overloaded. This is a hosting problem, and it’s common on busy shared hosting. Sometimes it clears up on its own within minutes.
  • The login details in wp-config.php are wrong. WordPress connects using a database name, user, password and host stored in wp-config.php. If any of them changed (after a move to a new host, or a password reset in the hosting panel), the connection fails.
  • The database is damaged. A crash or a full disk can leave tables corrupted.
  • Too many visitors at once. A traffic spike or a burst of bot traffic can use up the connections your host allows.

How to narrow it down

  1. Wait a few minutes and reload. If it comes back on its own, it was almost certainly the host’s database server. Note the time and tell your host, especially if it keeps happening.
  2. Check your host’s status page or support. If other sites on the same server are down, it’s on their side.
  3. Try yoursite.com/wp-admin. If the dashboard shows a different message saying database tables are unavailable or need repair, the database is damaged, not unreachable.
  4. Think about recent changes. A host move, a new hosting password or a change in the hosting panel points straight at the details in wp-config.php.

Fixes you can try

Check the database details

Open wp-config.php in your host’s file manager and find DB_NAME, DB_USER, DB_PASSWORD and DB_HOST. Compare them with the database details in your hosting panel. A single wrong character is enough to break the connection. Copy the file before you edit it.

Repair the database

If WordPress said tables need repair, add this line to wp-config.php:

define( 'WP_ALLOW_REPAIR', true );

Then visit yoursite.com/wp-admin/maint/repair.php and choose “Repair Database”. Remove the line as soon as you’re done, because that repair page doesn’t need a login while it’s switched on.

Ask your host

If the details are right and the database isn’t damaged, the server side is the likely cause. Your host can see their database server’s logs and connection limits, which you can’t.

Restore a backup

If the database is badly damaged, restoring a recent backup is usually the safest fix. This is where an off-site backup matters: if the only copy lives on the same server that failed, it may not help.

How to avoid it

You can’t stop every hosting outage, but you can make sure you find out fast and can recover. Uptime monitoring tells you within minutes when the site goes down, instead of a customer telling you days later. Daily off-site backups mean a damaged database is an inconvenience, not a disaster.

Need it fixed now?

If your site is down with this error, we can fix it for a flat $199, with no plan needed. We’ll find whether it’s the host, the settings or the database, get the site back, and tell you what happened.