Error establishing a database connection on Cloudflare
Why it happens on Cloudflare
Cloudflare caches the error page itself, so visitors keep seeing the database error for minutes after the database is back.
The fix on Cloudflare
Purge everything in Cloudflare → Caching after the fix, and set a Cache Rule that bypasses cache for 5xx responses so a future outage does not stick.
Is Error establishing a database connection happening on your domain?
An external probe records whether the failure is constant or intermittent, and captures the exact minutes it occurs — which is what distinguishes wrong credentials from connection exhaustion.
Free, no signup. Runs from outside your network, which is the only way to tell a server fault from a local one.
If that didn't fix it
Cloudflare has its own failure mode, but Error establishing a database connection has a wider set of causes that apply everywhere. The most common one overall is: the database server is down or out of memory.
All causes and fixes for Error establishing a database connection