When I type in my URL, a page pops up saying "error establishing database connection"

When I type in my URL, a page pops up saying “error establishing database connection”

My hosting company tells me the problem is on this end. Please advise. Site has been down for 5 days.

That message can only come from your origin server.

What is the website?

shannonwilliams.photography

That’s a standard Wordpress error page. It needs fixing on your origin server, nothing to do with your Cloudflare settings.

I shared that with them - they responded by having me check WHOIS.*** - and confirming my name-servers are pointed to cloudflare. ???

Yes, they are. And your site traffic is travelling through Cloudflare.
https://cf.sjr.org.uk/tools/check?3dc58a315d6a49b9afdfb304b1e4e685

But that doesn’t stop the database on your origin server from working.

If you want, you can edit your DNS and set the A record for shannonwilliams.photography to “DNS only” which will bypass Cloudflare’s proxy. Or you can show the records and I can check directly.
https://dash.cloudflare.com/?to=/:account/:zone/dns

You will still see the same page.

I’ve found a Bluehost IP address used earlier by your site, so I assume that’s it. Here is the result of connecting directly to their server. No Cloudflare here at all. And there is the same 500 code and database error.

dig +short -x 162.241.244.55
box5115.bluehost.com.
curl -I https://162.241.244.55/ -H "Host: shannonwilliams.photography" --insecure
HTTP/2 500
strict-transport-security: max-age=63072000; includeSubDomains;preload
x-xss-protection: 0
x-content-type-options: nosniff
referrer-policy: strict-origin-when-cross-origin
x-frame-options: SAMEORIGIN
content-security-policy: upgrade-insecure-requests;
expires: Wed, 11 Jan 1984 05:00:00 GMT
cache-control: no-cache, must-revalidate, max-age=0
host-header: c2hhcmVkLmJsdWVob3N0LmNvbQ==
content-type: text/html; charset=UTF-8
date: Fri, 22 Dec 2023 22:23:03 GMT
server: Apache

curl https://162.241.244.55/ -H "Host: shannonwilliams.photography" --insecure
<!DOCTYPE html>
<html dir='ltr'>
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
	<meta name="viewport" content="width=device-width">
			<title>Database Error</title>
	<style type="text/css">
		html {
			background: #f1f1f1;
		}
		body {
...
...
...
<body id="error-page">
	<div class="wp-die-message"><h1>Error establishing a database connection</h1></div></body>
</html>

Editing your wp-config.php so the database points to localhost should fix the issue:

/** MySQL hostname */
define( 'DB_HOST', 'localhost' );
1 Like

thank you

1 Like