Database connection error
Your site is fine. It just can't reach its own memory.
"Error establishing a database connection" is WordPress admitting that the code loaded but the database — where every post, product, and order actually lives — didn't answer. Alarming to see; usually one of four causes; almost always recoverable.
Diagnosis within one business day (Mon–Fri). Flat quote before any fix.
What’s actually happening
WordPress is two halves: PHP files that build pages, and a MySQL database holding everything those pages say. This error means half one couldn't reach half two — wrong credentials, a database server that's down or overloaded, corrupted tables, or a database that outgrew its quota.
The reassuring part: your content is almost certainly still there. Databases rarely vanish; they get unreachable. The dangerous part is what people do next — restoring random backups and re-running installers at the exact moment precision matters most.
The usual causes, ranked
After twenty-seven years of these calls, the odds are well mapped. Start at the top.
The database server is down or overloaded
On shared hosting, the database machine is a separate service that can crash or buckle under a neighbor's load while your files stay up. Often intermittent — the error that comes and goes with traffic.
Wrong credentials after a migration or host change
wp-config.php holds the database name, user, password, and host. Any migration that changed those without updating the file produces exactly this error, permanently, until corrected.
Corrupted tables
Crashes mid-write can corrupt a table — classically wp_options — leaving the database up but the queries failing. WordPress even ships a repair mode for precisely this.
A full database quota
Hosting plans cap database size; logs, transients, and spam comments fill it; writes start failing. The slow-motion version of this error.
What you can safely try first
Nothing below can make things worse — that’s the selection criterion. Anything riskier belongs in professional hands, on a backup.
- 1
Check whether it's everyone, everywhere
Front end and wp-admin both erroring? Does your host's status page report database issues? Five minutes of it-might-be-them beats an hour of it-must-be-me.
- 2
Wait out one traffic spike
If the error is intermittent and correlates with busy hours, it's load, not corruption — a real problem, but a capacity conversation rather than an emergency repair.
- 3
Note what changed
Migration? New host? A plugin that touches the database? The error's birthday is half its diagnosis. Don't edit wp-config on a hunch — one typo converts a maybe into a definitely.
Stop and call when…
- The error followed a migration — credentials and host values need careful, not casual, correction
- Repair mode reports crashed tables it can't fix
- It's intermittent under load and your host says everything's fine
From there it’s our job: a look within one business day, flat quote, and the $249 flat repair covers most cases of exactly this.
Site Down or White Screen — buy it now, skip the hunt.
500 and 502 errors, a white screen, a database connection error, a site that broke after a PHP update.
Back online first, then the cause. A full backup once it is up, and a note on what failed and how to keep it from happening again. We start within one business day (Monday–Friday) of payment. Full refund if we can't fix it.
Questions we hear a lot.
Is my content gone?
Almost certainly not. This error means unreachable, not erased — the database is a locked room, not a burned one. Content loss requires something rarer and louder. The urgency is real, but it's downtime urgency, not data-loss urgency.
Should I use WordPress's database repair mode?
It exists for the corrupted-table case and it's legitimate — but it requires temporarily adding a config line that opens repair access, which must be removed after. Done carefully it's safe; forgotten, it leaves a door open. It's a five-minute job worth doing precisely.
Why does this keep happening at busy times?
That pattern is the database buckling under connection load — too many simultaneous visitors for the hosting tier, or queries that grew inefficient as the site grew. The fix is optimization or capacity, and the arithmetic of which one pays is exactly what we quote.
What does the flat fix cover?
Diagnosis, the repair — credentials, table repair, quota triage, or the host escalation with evidence — and the plain-English note on cause and prevention. $249, refunded if we can't fix it.
Related symptoms & help
Errors travel in packs. If this one visited, check its friends.
- 500 Internal Server ErrorThe database error's louder cousin.
- White Screen of DeathWhen the failure forgets to explain itself.
- Slow WebsiteDatabase strain's early warning sign.
- Emergency RepairDown now? The emergency lane.
- Website RepairEvery platform, flat quotes.
- SSL ExpiredExpired SSL certificate
- Login LoopWordPress login loop
- Maintenance ModeStuck in maintenance mode
Your content's still there. Let's reconnect it.
Send the symptom, get a look within one business day and a flat quote from the developer who's fixed this exact thing more times than either of us can count.
