Question

Getting a Mysql Database error in debug.log, Server crashes

[14-Sep-2022 16:28:32 UTC] PHP Warning: mysqli_real_connect(): Error while reading greeting packet. PID=501493 in /var/www/yolosand/public/wp-includes/wp-db.php on line 1753 [14-Sep-2022 16:28:32 UTC] PHP Warning: mysqli_real_connect(): (HY000/2006): MySQL server has gone away in /var/www/yolosand/public/wp-includes/wp-db.php on line 1753 [14-Sep-2022 16:28:32 UTC] PHP Warning: mysqli_set_charset(): Error executing query in /var/www/yolosand/public/wp-includes/wp-db.php on line 884 [14-Sep-2022 16:28:36 UTC] PHP Warning: mysqli_real_connect(): (HY000/2002): Connection refused in /var/www/yolosand/public/wp-includes/wp-db.php on line 1753

Everyday the server will go down for 3-5min and then be back up. I have tried adding a swap space but that didnt solve the issue. I use the server as a multisite and have 10 websites on there.


Submit an answer


This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Hi there,

It sounds like your MySQL server might be crashing due to resource limitations.

I could suggest a couple of things:

  • Follow the steps here on how to tweak your MySQL instance for better performance:

https://www.digitalocean.com/community/questions/how-to-tweak-mysql-mariadb-configuration-for-increased-performance-and-stability

  • Add a bit of extra RAM to the server

  • Add a swap file in case that you don’t have one already:

https://www.digitalocean.com/community/tutorials/how-to-add-swap-space-on-ubuntu-22-04

Best,

Bobby

alexdo
Site Moderator
Site Moderator badge
September 15, 2022

Hello @sandyturquoiseanchor

Can you confirm if MySQL goes down and then you need to manually restart it or does the issue auto-resolves?

You can examine the logs and check if the droplet is running out of memory due to the MySQL activity.

Regards

Try DigitalOcean for free

Click below to sign up and get $200 of credit to try our products over 60 days!

Sign up

card icon
Get our biweekly newsletter

Sign up for Infrastructure as a Newsletter.

Sign up
card icon
Hollie's Hub for Good

Working on improving health and education, reducing inequality, and spurring economic growth? We’d like to help.

Learn more
card icon
Become a contributor

You get paid; we donate to tech nonprofits.

Learn more
Welcome to the developer cloud

DigitalOcean makes it simple to launch in the cloud and scale up as you grow – whether you’re running one virtual machine or ten thousand.

Learn more ->
DigitalOcean Cloud Control Panel