Could not connect to the MySQL server because of an unknown error



Woke up today to an email from my VPS stating:

The system could not connect to the MySQL server because of an unknown error.

The system was unable to authenticate to the local MySQL server on “localhost”.

The connection driver reported the following error: Lost connection to MySQL server at 'handshake: reading inital communication packet', system error: 104
This notice is the result of a request from “mysqlconnectioncheck”.

This notice was generated “Tuesday, January 12, 2016 8:13:39 AM UTC”.

“Remote MySQL Connection Failure” notifications are currently configured to have an importance of “High”.

No clue as to why I decided to open a support ticket and have KH check it out which they very efficiently did.

According to the Technician the VPS has been running out of memory, the memory usage has been consistently high and that we am more than likely going to either have to further optimize your site's code and databases or upgrade your VPS package.

The tech also checked if there was any malicious traffic but there was non, concluding again that we need to either further optimize your site's code or upgrade your VPS to allow more available memory.

I then ask why are we using so much memory and that I also noticed that ever since we switch to a WHM/cPanel VPS (via a KH recommendation) we are consistently running between 78 and 85% memory usage as compared to our old VPS running on PLESK. On the PLESK system we were running below 50% memory. Same amount of site, same amount of traffic, same code.

Well again the same answer: "a combination of PHP, Apache and MySQL. To resolve these issues and prevent them from happening in the future, either you or a developer will have to optimize your sites code or you will have to upgrade your VPS to the next tier."

I am posting this to see if anyone has experienced this issue. I do not understand if PLESK is such an inferior product why WHM/cPanel is sucking up so much memory to the point where we have to upgrade (again because we upgraded in Dec) to the next tier. By the way we have a VPS-2 with 2G and now a VPS-2 with 2.25 (.25 xmas gift).

I have been relatively happy with the KH service but this issue really does not sit too well with me at all as I cannot trust if my sites will be up due to potential memory issues which I never had.
There can be dozens of different reason causing excessive resource usage. The one time I began having memory issues was back when I had my dedi with Host Gator and I found it was due to more spam coming in which my spam filter was having trouble keeping up. Your issue is likely not related to that since memory is cheaper these days and packages come with more of it. Let's start with, what package (amount of memory) do you currently have? In WHM's resource usage what's showing at the top for memory usage or CPU usage. You can also install a plugin called munin to monitor past usage. Certainly if support determined that some of your PHP/MySQL scripts are eating up memory then even a slightly higher amount of traffic could make a noticeable impact on memory usage.
Hello phpAddict,

I have a VPS-2 with 2.25G of memory although the panel says 2.35G. The Memory usage varies between 75 to 58%. I also have munin running to monitor the resource usage.

The strange situation is that the vps only used between 47 to 55% of the memory whereas this brand new and updated VPS 75 to 85% which is a significant change. Have not added any new sites.