Mysql Stop / waiting / crash, already added swap

December 30, 2014 1.3k views

Hello Friends,

Received this error - Database connection error (2): Could not connect to MySQL.
My Sql Stop / Waiting .

I looked several solutions at google and I just found 2 of them :-

  1. Less space - But no visitors is on my site and it's have plenty of space.
  2. Add swap - Already added a swap of 1GB

Please let me know best possible solutions so that mysql won't get crashed.
Or provide me any script which auto start mysql server.

  • step 1: here is a script you can install to check if MySQL and Apache are running, and if not: restart them:

    step 2: it will be helpful to find possible things that could be causing the crash. what application are you running? WordPress? if so, there are some things to check.

  • @sierracircle Those are good steps, but I'd supplement that with a step 0: analyze the mysql log file for events leading to failure.

    @viveksingh On Ubuntu, the mysql log file is /var/log/mysql/mysql.error and on Fedora this is usually /var/log/mysqld.log. Look for warnings and errors towards the end of the log file. Also, see if the process is actually still running and look at what socket it's listening to ( type ps -ef | grep mysql then look for the 'socket=' value). The client that is producing the connection error may be listening at a different location, so make sure the client is configured to communicate through the same socket.

  • Hi, same issue here. What arre those other things to check when using WP? thks

Be the first one to answer this question.