Lost connection to database

Posted December 21, 2014 2.8k views


I end up whit a connection lost to my database a couple off times a day and the only thing for me to fix this is to reboot the server.

I even have trouble then to login to my ISPConfig control panel.

What is wrong? Way is this happen?

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.

Submit an Answer
1 answer

The most common reason for MySQL to become unavailable or crash is a lack of available memory. If you are running a LAMP stack on a small droplet this can occur since droplets do not have a swap partition to use when the physical memory has been exhausted. There are a few things you can do to resolve this:

1.) Upgrade to a larger droplet plan.
2.) Set up swap space on your droplet.
3.) Optimize your MySQL and Apache processes.

by Justin Ellingwood
Swap space can be used as an "overflow" area for your system when you run out of RAM. The operating system can store data that would normally be kept in RAM on the hard drive in a specially formatted file. In this guide, we'll demonstrate how to create and use one of these files in Ubuntu 14.04.