Cloudflare --> error establishing a database connection


#1

I’ve been using Cloudflare for years with no problems. And then, late last week, one of my sites (www.aldireviewer.com) suddenly started experiencing “Error establishing a database connection” when trying to access the backend, and intermittent error messages on the frontend. I spent the entire weekend troubleshooting: looked at wp-config, repaired and optimized the database, tested plugins, all that. No success. My hosting provider said no problems on their end.

Finally went and paused Cloudflare and redirected my nameservers back to my hosting provider … and the problem disappeared. I’ve tried going back several times and re-enabling Cloudflare and within a few minutes I get the error again. So I’ve been able to reproduce the problem consistently. The only time I have it is when I’m on Cloudflare, and when I’m off I don’t get the error.

I’m dumbfounded. I really want to use Cloudflare but I obviously can’t do that if I can’t access my site. I’m open to any suggestions, if anyone has any.


#2

Is your database hostname “localhost”? My first guess is the database is trying to access your hostname that’s behind Cloudflare, though the fact that it used to work is curious.


#3

Yes, it is.


#4

How about if you use Cloudflare’s name servers, but go to the Overview settings page under Advanced, and Pause Cloudflare. That way, you’ll only be using Cloudflare for DNS and nothing else.

If this is still broken, then I’d suspect some of your DNS records have changed at your host and you’ll need to double check all your DNS entries.


#5

It took a while, but I was eventually able, through a ton of trial and error, to figure out what was up: it was a glitch involving the SSL certificate on the host provider’s end, which was somehow triggering a database error when it interacted with Cloudflare. Once the host provider fixed the SSL error the Cloudflare problem stopped.


#6

This topic was automatically closed after 14 days. New replies are no longer allowed.