website is down (error establishing database connection)

christinefung

Registered
Jan 5, 2021
2
1
1
australia
cPanel Access Level
Website Owner
hello there,
we have upgraded our cPanel plan for the website [REDACTED] its been two days but it's still down saying "Error establishing a database connection". can someone tell us what's wrong there or how long time it will take to get live, please?
thank you
 
Last edited by a moderator:

cPRex

Jurassic Moderator
Staff member
Oct 19, 2014
3,134
394
243
cPanel Access Level
Root Administrator
Hey there! I'm sorry to hear about the database connection issues. I wouldn't normally think that would be related to the type of hosting plan, but to a problem with either the database connection information (user, password, database name) in your connection string or a problem with the database server itself.

If you can confirm the database connection details are correct on your site you'd want to speak with your hosting provider or datacenter to have them check your account as they would have access to the database logs on the machine to see more details on the issue.
 
  • Like
Reactions: christinefung

keat63

Well-Known Member
Nov 20, 2014
1,899
253
113
cPanel Access Level
Root Administrator
When your hosts give you a new account, they would only normally do so once it was created and working, so I'd suggest that any database issues are not going to fix themselves.
I'd go as far to say that anything more than 5 minutes and you have a problem on your hands, something is broken.

Your hosts provider would be the best place to start.
These guys have deep access inside your account.
Any reputable host should have this fixed in an hour. (maybe a few hours for an email ticket)
 
  • Like
Reactions: cPRex

jxmot

Member
Sep 24, 2014
22
1
53
cPanel Access Level
Website Owner
@cPRex I'm having the same problem establishing a local connection (from served PHP files) to the MySQL database. This was working fine up until the update to cPanel 92.0 (build 8). External connections like using Workbench are OK. After a some investigation into the settings the PHP code was using and workbench I think I figured out what is wrong.

The server that Workbench connects to through an SSH login is 127.0.0.1, the server that the PHP code was using was "somedomain.com". When I changed "somedomain.com" to 127.0.0.1 it began to work again. So either I had it wrong right from the beginning using the "somedomain.com" or/and something has changed in the cPanel 92.0 (build 8) update.

What do you think?
 

cPRex

Jurassic Moderator
Staff member
Oct 19, 2014
3,134
394
243
cPanel Access Level
Root Administrator
Hey @jxmot,

Are you using MySQL 5.6? That's the only version that received any type of update during the 92.0.8 change:


If you're using another version of MySQL I don't believe that update would be related.
 

jxmot

Member
Sep 24, 2014
22
1
53
cPanel Access Level
Website Owner
Thanks @cPRex for getting back to me.

I just checked and the version of MySQL being reported is 5.7.32. This "problem" has occurred very recently. It's good that I know how to fix it on my end, but I'm curious to know why... if just to have a better understanding of why it occurred and to prevent it in the future.

Thanks again!
 

cPRex

Jurassic Moderator
Staff member
Oct 19, 2014
3,134
394
243
cPanel Access Level
Root Administrator
Thanks for letting me know about the OS. That would mean that CloudLinux isn't a factor, but I don't have any other details on what may have been the cause of that change as we didn't make any updates that would have been applied to your specific system based on your OS or database version.