Skip to content

Why does WordPress lose the database connection?

This error appears when WordPress can’t open a connection to your database server. Without that connection, WordPress can’t load settings, users, content, products, or orders — so the site fails before it can render anything. It often happens after hosting changes, migrations, DNS moves, credential updates, traffic spikes, or database/server instability. Sometimes it’s a simple credentials mismatch. Other times it’s a deeper reliability issue (connection limits, database service failure, corrupted tables). This page is for urgent incidents where the site is inaccessible and revenue or enquiries are at risk. We isolate the cause, restore the connection safely, and confirm the site is stable again.

Process

How We Fix a WordPress Database Connection Error

A controlled recovery process (no trial-and-error).


  • Diagnosis: We confirm whether the failure is credentials, database server availability, connection limits, or table corruption (using hosting access, checks, and logs).

  • Stabilisation: We apply the minimum safe fix — correct credentials, restore DB service access, repair corrupted tables, or address connection/resource limits.

  • Verification: We validate wp-admin access, key pages, and business-critical journeys (forms, checkout, account logins) before closing the incident.

sometric illustration showing a three-step WordPress database recovery process: diagnosis, controlled stabilisation, and verification of system stability.

Common causes

Most Common Causes of “Error Establishing a Database Connection”

What breaks the database link (and what we check first).


  • Incorrect database credentials: DB name, username, password, or host changed (often after migrations, staging-to-live swaps, or hosting panel updates).

  • Database server outage or instability: the database service is down, restarting, overloaded, or blocked by firewall/network rules at the host level.

  • Connection limits / traffic spikes: too many concurrent connections, slow queries, or resource caps causing new connections to fail.

  • Corrupted tables: crashed tables or storage issues preventing WordPress reading required data.

Isometric illustration showing multiple common causes of a WordPress database connection error converging into a single failed database link.
When the database link fails, the priority is safe recovery and stable operation — not random changes.

How WPAssistant Works: Rescue Principles

Isometric 3D illustration of a magnifying glass identifying a bug in a code document, with a log file beside it, representing root-cause diagnosis and technical troubleshooting

Root-cause diagnosis

We confirm whether this is credentials, server availability, limits, or corruption — using evidence, not assumptions.

isometric 3d illustration of a control panel with a single slider being adjusted by a wrench and gear, shield icon representing safety, and a small before and after comparison card, symbolising minimal safe changes and controlled website fixes

Minimum safe change

We apply the smallest reliable fix that restores the connection without collateral damage.

Isometric 3D illustration showing end-to-end checkout verification with a checklist, shopping cart, and email confirmation connected in a single workflow, representing complete purchase journey testing and order validation

Business-critical testing

We verify wp-admin, key pages, forms, checkout, and integrations before closing the incident.

Isometric 3D illustration of a report document with simple charts, a speech bubble, and a handshake symbol connected together, representing clear communication, reporting, and handoff verification in a digital workflow.

Clear handover

You get a short summary of what failed, what we changed, and what to do next.

WordPress Database Connection Error: What We Fix

When WordPress can’t connect to the database, it can’t load content, users, orders, or settings. The result is usually a full outage on the front-end, wp-admin, or both.

Typical rescue outcomes

We restore the database connection, stabilise the database service, and remove the underlying cause (credentials mismatch, server outage, corrupted tables, connection limits, or hosting constraints). We then verify the parts of the site that matter: key pages load, logins work, forms submit, and checkout/payments function where applicable.

Related rescue pages (recommended)

If the database error is part of a wider incident, these pages cover common neighbouring causes:

Site Down (Incident Response) · Site Broke After Migration · WordPress Critical Error · Checkout Issues Hub · Rescue Packages & Pricing

No open-ended billing. Scope is agreed before work begins. If the issue is bigger than expected, you’ll know before any additional work is done.

 

  • Fast stabilisation: restore database access and get the site loading again safely.
  • Real diagnosis: confirm whether it’s credentials, server outage, limits, or corruption — not guesswork.
  • Minimum safe change: the smallest fix that restores the connection without collateral damage.
  • Verification: confirm wp-admin, key pages, forms, and checkout work again.
  • Clear next steps: what caused it, what we changed, and how to reduce repeat risk.

Database Error FAQs: Quick Answers

Short answers to the most common questions when WordPress shows “Error establishing a database connection”.
What does "Error establishing a database connection" mean?

It means WordPress can't connect to the database server to load content and settings. Common causes are incorrect credentials, database service downtime, connection limits, or corrupted tables.

Can this happen after a migration or hosting move?

Yes. Migrations often change database hostnames, users, passwords, or network rules. We validate the configuration end-to-end and restore a stable connection.

Can you fix it if I can’t access wp-admin?

Yes. This issue often blocks wp-admin as well. We work from hosting/server access, confirm the failure point, restore connectivity, then verify the site from the user side.

Is it always just the wrong password in wp-config.php?

Not always. Credentials are common, but database server outages, resource limits, and corrupted tables can look identical from the front-end. That’s why we confirm the real cause before changing anything.

Do you guarantee the issue will be fixed?

We provide best-effort incident response. We diagnose the root cause and apply the minimum safe change to restore stability where possible. Outcomes can’t be guaranteed due to hosting and third-party factors.

Need help now?

Start a WordPress Rescue

If your site is down, unstable, or something broke after an update, plugin change, or migration, tell us what’s happening. We’ll review the details and confirm the next steps before any work starts.

Include your website URL, what changed before the issue, and any error message or screenshot. That helps us move faster.

Start a WordPress rescue request