cancel
Showing results for 
Search instead for 
Did you mean: 
Go to solution

Error establishing database connection

I got an email from GoDaddy on 12/19 saying that they had updated my hosting account, moving my account to a new IP address. The a-name records were updated properly, I checked. However, I am now getting a WordPress error when I try to go to the site:

 

When I go to the website, it now says "Error establishing a database connection." When I go to a specific WP page, such as "/wp-admin/" it says:

 

"Error establishing a database connection
This either means that the username and password information in your wp-config.php file is incorrect or we can’t contact the database server at p50mysql283.secureserver.net. This could mean your host’s database server is down.

Are you sure you have the correct username and password?
Are you sure that you have typed the correct hostname?
Are you sure that the database server is running?
If you’re unsure what these terms mean you should probably contact your host. If you still need help you can always visit the WordPress Support Forums."

 

My website is http://bobjenkinswrites.com.

 

I have not changed any of the wp-config information, so that should not be the problem. I have seen other people on these forums with the same problem, and it looks like all they had to do was bring it to GoDaddy's attention before it was fixed. Is there anything I have to do or can do to remedy this problem? The site has now been down for almost two weeks. Thanks.

12 REPLIES 12
Employee
Employee

Re: Error establishing database connection

p50mysql283.secureserver.net is an internal server name, if you get migrated to a new server it can break your connection.

 

In your hosting, in the details of the site's database it should have a hostname. You'll have to edit the wp-config.php for the site from the file manager and change the hostname set there to match.

Solution

Re: Error establishing database connection

Whew! I fixed it, though it wasn't easy. Here's how, for anyone who runs into the same problem:

 

I logged in and went into my products. Under Web Hosting, I found the hosting correlating to this site and clicked "options," then in the upper right of that popup clicked "Launch control center." Under "databases," I clicked to launch MySQL, and next to the one database I had running WordPress, clicked "Actions > Details." The last thing listed there was the hostname. There's also a code snippet that GoDaddy provides, which listed the hostname as $hostname. In the wp-config.php file, this correlates to 'DB_HOST'. I saw the old database server listed there, and replaced the value of that variable with the one provided by GoDaddy, the new one, saved and uploaded, and the problem was fixed. Thanks!

Re: Error establishing database connection

This just happened to two sites I manage and when I chatted with support they didn't say anything about this, and tried to get me to pay $99 for premium support. I suggest you share this with chat support so they know this might be an issue. And also maybe have someone edit the email mentioned in the original post to include information about how you will need to update the DB hostname in your wp-config file if you're running a wordpress site.

Employee
Employee

Re: Error establishing database connection

Your config files being pointed to a specific server is actually a little odd.

 

The thing is, that hostedresource name doesn't change if your site gets migrated, and that's what your site should have already been pointed to. Most people didn't have to do a thing.

 

I agree that if you were offered the service to fix it, it makes sense for you to have been emailed what the service would actually be doing so you could make an informed decision about trying to do it yourself. Here's the article: https://www.godaddy.com/help/update-wordpress-database-connection-string-26356

Re: Error establishing database connection

You say that my config files being pointed to a specific server is odd. Is there a way, instead, to make that a relative link rather than an absolute reference, so that this kind of thing doesn't happen if Go Daddy migrates the server again? For example, directed it to .local rather than a specific IP?

Re: Error establishing database connection

Oh yeah, now that you mention it, it's usually just "localhost" right? Well, just so you know, I installed both of these sites through GoDaddy and all that stuff was put in there automatically during setup (not by me). So you may want to look into that.

 

So just to clarify, we can just set it as "localhost" and it will point to wherever the server is, even if it gets moved, correct? I haven't checked all of the sites I manage yet, but one that I just did last month just has "localhost" and is working fine, so I just want to confirm that if I make sure they all have "localhost" I don't have to worry about this happening again.

 

Thanks for your help!

Employee
Employee

Re: Error establishing database connection

The server names that end in secureserver.net are absolute links to a server. The cname that ends in hostedresource.net is a relative link, the IP for that gets updated if the database gets moved to a different server.

 

I wasn't talking about localhost. That's the server name for our cPanel hosting because the database runs on the same physical machine as your web server. That's not the case with older hosting, localhost doesn't work.

New

Re: Error establishing database connection

Thanks! I had the exact same problem for a site that I volunteer to help with. I took me all day of running down suggested fixes until I found your actual fix.

Re: Error establishing database connection

I spent almost 2 days to fix it but nto able to do it. very frustrated.  Can you pleaes help with step by step instructions. Thank you so much,

Super User III
Super User III

Re: Error establishing database connection

@itekpeop

 

If you're getting a database error, have you tried these steps? https://www.godaddy.com/help/update-wordpress-database-connection-string-26356

 



I am a GoDaddy End User - Just Like You
Check out my site! | I drink and I know things. Especially about websites and web hosting.
* Please note that I offer free advice on this forum. If you would like personalized help, please contact me. Otherwise, please ask your question in the proper forum so the answer can assist EVERYONE in the community and not just you. Thanks! *

Once your issue is resolved,
please be sure to come back and click accept for the solution

Get Better Support on the Community Boards!
Etiquette When Asking for Help from the Community


Re: Error establishing database connection

try the method in the video

Re: Error establishing database connection

Hey, I have a website with the name of Plumbers Near Me and i was having the same issue "Error establishing database connection". Now it is fixed. 
Thanks for posting.