DNS change and Eerror establishing connection

One of my sites is being migrated from a shared server to a VPS plan.
I got the notification this morning of the completed migration and I had to change the DNS in Cloudflare. I did. Since then, I cannot load the site properly. I get an “Error establishing database connection”.

I contacted my host, thinking I was missing something. Their tech did a host file mod to bypass cloud flare and it seems they are at least able to load further than I can (I can only load the main page on an incognito page, and then, can’t log in).

They suggested I clear the cache on Cloudflare, which I did. No change.

They can’t see anything wrong on their end, so they suggest I contacted you, in case there is something else I can do in Cloudflare.

The site is https://scrapbookcampus.com/ and if you load that page, can you click on the Login, on top? I can’t get to that page.

I’ll have to look. I never changed anything to the wp-config file, and it worked fine before.
I’ll be back.

It is set to “localhost”
That was not changed.

Then that’s strictly an internal issue. You’ll have to get your host to do more troubleshooting.

Even though when they bypass Cloudflare, it works fine?
I am confused here.

That’s not what you said (bold emphasis mine):

When i go to the main page, i can load it using an incognito window (not a regular one).
When I click on the Login link on top, i get the error.
When THEY bypass Cloudflare, they can load the main page and load the Login page (they sent me a screenshot). So they get further than I can when they bypass Cloudflare.

I find that if there is a redirect (like the Login link), a shortened link (using Pretty Link plugin) or even a search (like on the blog), i get the error. If “just navigate”, it works ok.

What would that mean?

That’s a good question. Clearly, there’s a database connection issue. But if it’s set to ‘localhost’, then that connection is bypassing Cloudflare. Next try: Change ‘localhost’ to 127.0.0.1

I don’t expect much improvement, because nobody should tamper with a ‘localhost’ DNS setting, but there’s always a first time. The next step would be to enable Debug Mode in WordPress. This is already more than someone should have to do. I have a handful of WordPress sites (as do many others), and they’re working fine with a localhost connection to their databases.

There’s always the bizarre chance the database is configured to only allow connections from a specific hostname, and with Cloudflare activated, your hostname (domain name) resolves to a different IP address.

As expected, no change.

I can’t log in, so I can’t enable that. I can’t use the Login redirect nor the /wp-admin/

I also have a dozen sites, and I never had to change that either.

I also find “interesting” that i can load the main page in incognito mode but not the regular Chrome browser I normally use.

Debug Mode is configured in wp-config.php

There’s always the chance those pages are cached on the server and aren’t querying the database.

Oh ok. Now, once it is enabled, what will it do or tell me? Or should the host take care of that?

Thanks. I’ll look into that.

1 Like

This topic was automatically closed 5 days after the last reply. New replies are no longer allowed.