Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

StormShadow's avatar

URGENT Help needed! Mysql Error Connection Refused! Forge, Digital Ocean

Hi There

My site running on digital ocean / forge suddenly stared throwing 'PDOException' with message 'SQLSTATE[HY000] [2002] Connection refused'

Everything was running fine in production. Locally working fine as well

Any help would be greatly appreciated!

0 likes
5 replies
zoransa's avatar
zoransa
Best Answer
Level 23

did you try to reboot server also did anybody play with iptables?

StormShadow's avatar

@zoransa thanks for the reply, rebooting server did it

"Hello, IT, have you turned it off and on again?".

Perhaps I need to move to a bigger droplet

Thanks

alenn's avatar

You don't need bigger droplet, this happend to me several times and my app wasn't big at all. I believe this is problem with DigitalOcean servers

zoransa's avatar

heheh mark the answer then

Also you can make small shell script to check is httpd/nginx and mysql up and if not to try to restart them and email you.

booni3's avatar

I have this same problem. Rebooting SQL does fix the issue but it drops out every few days. I have very little database queries going on and the last time this happened was over the weekend when there would have been zero.

We have a few crons running but these do not touch the database.

Does anyone have any ideas on how to debug this?

Please or to participate in this conversation.