This is kind of a common problem and may have several reasons. Sometimes when we simply want to restart the MySQL Server, we can get such an error:
ERROR! MySQL server PID file could not be found!

First of all, always check if the /tmp partition is full. This can happen when MySQL can’t write to the /tmp partition to create a lock file.
$ df -h

Also, this may be because, somehow the /tmp partition has been cleared and the MySQL server is looking for the PID file there. So easy-peasy just create a new pid file and restart the server.
$ touch /tmp/mysql.sock
$ service mysqld restart

It can also help to check the status, sometimes it helps. For example sometimes you can get an error like this :
$ service mysqld status
ERROR! MySQL is not running, but lock file (/var/lock/subsys/mysql) exists

Well, it’s kind of obvious, just remove the lock file and restart the server.

$ rm /var/lock/subsys/mysql
$ service mysqld restart

If none of these help, and you’re getting an error like this:
$ service mysqld restart
ERROR! MySQL server PID file could not be found!
Starting MySQL. ERROR! The server quit without updating PID file (/var/lib/mysql/mydomain.com.pid).

Then there might be a more complicated problem. Check the log file at /var/lib/mysql/mydomain.com.err
$ tail /var/lib/mysql/mydomain.com.err
120602 16:54:09 mysqld_safe mysqld from pid file /var/lib/mysql/mydomain.com.pid ended

This line tells us that we have a compatibility problem with some of our tables and mysql fails to start in safe mode.

Now let’s change the way mysql starts to work around this situtation.

$ { echo “mysql_enable=\”YES\””; echo “mysql_args=\”–skip-grant-tables –skip-networking\””; } >> /etc/init/rc.conf

Time to restart

$ /etc/init.d/mysqld restart

You should a get successfull restart. Now try and upgrade the server.
$ mysql_upgrade

If it says you have the latest version, still force it.
$ mysql_upgrade –force

It will check every database if it’s ok. After that, we can return things to normal, comment out the last line we’ve added to /etc/init/rc.conf

$ sed -i ‘/mysql_args/s/^/#/’ /etc/init/rc.conf
$ service mysqld restart

Hope this helps.

6 Responses to MySQL Server Won’t Start : PID File Errors
  1. Thanks 🙂

  2. You are a gem man ! life saver ! Thanks – it works like a charm.

  3. […] MySQL Server Won’t Start : PID File Errors – Plugged … – Popular Posts. MySQL Server Won’t Start : PID File Errors 37,998 views; Install mod_python on Centos 6 27,809 views (Zimbra Mail Server) Unable to determine …… […]

  4. […] MySQL Server Won’t Start : PID File Errors – Plugged.in – This is kind of a common problem and may have several reasons. Sometimes when we simply want to restart the MySQL Server, we can get such an error: ERROR! MySQL … […]

  5. thank you 🙂
    many SO post didnt help but this one did


[top]

Leave a Reply

Your email address will not be published. Required fields are marked *

AlmaLinux, a CentOS alternative created by CloudLinux Team is now available. You can try the beta version by downloading it from our mirror site.

We’ve felt the need to post this reminder about the changes to the PCI-DSS standards to answer a few possible questions. Please note that it is possible that only some of the information provided below is directly related to your infrastructure, if not none. After PCI-DSS v3.2, the SCC has announced v3.2.1. This update does not […]

VeriTeknik became a member of AFCEA

VeriTeknik, now a member of the non-profit international organization called Afcea. Afcea is the abbreviation for Armed Forces Communications and Electronics Association. The professional association connects people, ideas and solutions globally. VeriTeknik’s main business areas involving Network Security, cryptology and secure communications are essential parts of the defense industry, besides VeriTeknik’s experience and knowledge on […]

On 24th of September, a standard util called “bash” on every Linux System declared to be vulnerable. Vulnerable systems are Linux, BSD, Mac OS X and other systems use “bash” as a command interpreter. In order to identify your server as vulnerable, please try the command below on your cli: env x='() { :;}; echo […]

  • 1
  • 2