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.

Want to learn more? Join the DigitalOcean Community!

Join our DigitalOcean community of over a million developers for free! Get help and share knowledge in Q&A, subscribe to topics of interest, and get courses and tools that will help you grow as a developer and scale your project or business.

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

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