I am having a lot of crashes on my server lately. Restarting the server does bring it back up. But offcourse I would like a permanent solution. My var/logs is being "flooded" with errors like thes two:

  • SQLSTATE[HY000] [2002] Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock
  • SQLSTATE[HY000] [2013] Lost connection to MySQL server at 'waiting for initial communication packet', system error: 95

The shop is running on a VPS. Which did the trick for a couple off years without errors. It is not a high traffic shop and it has a couple off hundred products.

The logs are close to empty at this moment and also all caches and database tables which can be cleaned have been cleaned.

Is this a matter off getting a heavier server or is there another problem which I have not been able to track down at this moment?

FYI: In the recent past the shop has been hacked. Maybe there is a connection? The shop is running on Magento 1.9.1 with all security patches.

  • are you connecting to mysql remotely? if you have mysql issues you need to post your my.cnf file and output from mysqltuner.pl
    – MagenX
    Dec 29, 2015 at 6:24

1 Answer 1


I recommend:

About Security

  1. Change all system users passwords / certificates
  2. Change all mysql users (including root) passwords
  3. Install at least one tool to avoid BF Attacks like fail2ban
  4. Maintain updated your OS, if you're using ubuntu, you can turn on unattended updates.
  5. Validate all admin users registered in Magento (keep just those you know well - like you:)
  6. Use MageReport to keep your site up to date and secure.

About Server Load

  1. Add a performance/resource monitor to your system, you can use newrelic (It has a 30 days free trial) and you can complement newrelic data with Google Analytics
  2. Try to pair your log events with the sever load.

I'm pretty sure that if you follow these steps and track the data with some regularity you will be able to find the reason behind mysql shutdown in a few days.

Maybe you just must upgrade your server, but before take some performance measures.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.