Error Establishing Database Connection in Every 18 to 24 hrs

When i created my site i used this command sudo ee site create example.com --wpredis it worked fine but i want to minify my css and html so what i did yesterday i i ran this code ee site update example.com --wp --w3tc so this code removed the wordpress redis cache and installed w3 total cache when i click on Purge All Cache my site was briked it says that error establishing database connection

I checked wp-config.php and every thing is fine, so what i did is i reboot my digitalocean droplet and my website started working again.

But i dont know the extact time. every 18 to 24 it shows that error establishing database connection so i need to reboot my droplet to start working again.

Any one expert here please help me to solve this issue… please

I had this happening to me recently, it turned out to be memory problems with MYSQL. If its the same issue, this should help https://easyengine.io/tutorials/mysql/mysqltuner/

The other thing I did was setup Monit to automatically restart MYSQL if it crashes, https://superdevresources.com/server-monitoring-program/

I’m a total noob though, so forgive me if I’m way off the mark.

2 Likes

This usually happens when max_children is not aligned with memory.

Check out this - https://easyengine.io/docs/prevent-mysql-crashing/

This MySQL crash generally happens only with DO 512 plan.

The Good News is Yesterday DO updated their existing plans. DO VMs start at $5/month for 1GB RAM, 25GB.

Still best solution is use AWS Cloud.

I’ve had the exact same problem with 32GB RAM the last few days… have followed https://easyengine.io/tutorials/mysql/mysqltuner/ and seems to have fixed it. Will run again in 24 hours