MySQL server PID file could not be found

162,699

Solution 1

In your mysql configuration file - my.cnf, check for the parameter pid-file and see where it points. If it is not there, set it manually to -

pid-file    = /var/run/mysqld/mysqld.pid

Create the directory /var/run/mysqld/ and give it proper permissions -

  mkdir /var/run/mysqld
  touch /var/run/mysqld/mysqld.pid
  chown -R mysql:mysql /var/run/mysqld

Solution 2

This question is a bit outdated but I thought I'd post how I resolved this issue when it happened to me on my Mac (OS X El Capitan 10.11.4).

Check the status just to be sure

mysql.server status

ERROR! MySQL is running but PID file could not be found

Find all running mysql processes

ps aux | grep mysql

It will list out all the processes using mysql (including the command you just executed)

Kill off all the mysql pids

sudo kill <pid1> <pid2> <pid3> ...

This should kill off all the mysql processes

Now try to fire mysql up

mysql.server start

Starting MySQL . SUCCESS!

Hope this helps someone!


EDIT: Alternative solution from @DanielTate

This worked for me JasperSoft Wiki - uninstall-mysql-mac-os-x. I had to brew uninstall mysql then delete ALL of the files then reinstall and follow the home brew install instructions


EDIT 2: Alternative solution from @JanacMeena

There is a nice write-up of their solution in this post on Medium.

Share:
162,699
simpleengine
Author by

simpleengine

A programmer from the Left Coast of Canada

Updated on September 18, 2022

Comments

  • simpleengine
    simpleengine over 1 year

    I can start MySQL fine,

    /usr/local/mysql/support-files/mysql.server start
    Starting MySQL
    SUCCESS! 
    

    But any MySQL action after that I get the error:

    MySQL server PID file could not be found

    /usr/local/mysql/support-files/mysql.server stop
    ERROR! MySQL server PID file could not be found!
    

    Where do I find the server PID file on Mac with OSX 10.8? I am wondering if it is a permission problem. The mysql.sock file is a symlink pointing to the file in the tmp/ directory.

    sudo ln -s /tmp/mysql.sock /var/mysql/mysql.sock
    
    • Janac Meena
      Janac Meena almost 4 years
      This can be caused by so many factors, i.e. permissions, ownership, corrupted data - to see a summary of how to determine which one, check this article: medium.com/@7anac/…
  • simpleengine
    simpleengine about 11 years
    Okay, I am trying this. I will let you know how it goes
  • simpleengine
    simpleengine about 11 years
    Great, you are a genius. It works. The only thing that was missing was the line pid-file in my.cnf I had to run /usr/local/mysql/support-files/mysql.server restart twice to remove the error
  • mOna
    mOna about 8 years
    I cannot find pid-file in my.cnf .. could I add this line pid-file = /var/run/mysqld/mysqld.pid ??
  • Daniel t.
    Daniel t. about 8 years
    yes, if you are getting "PID file not found" error.
  • mOna
    mOna about 8 years
    @Danielt.thanks for your reply. I tried what you said.. the error is now changes to ERROR! The server quit without updating PID file (/var/run/mysqld/mysqld.pid). do u have any idea?! :|
  • Daniel t.
    Daniel t. about 8 years
  • Mangano
    Mangano over 7 years
    ERROR! The server quit without updating PID file
  • Rockin4Life33
    Rockin4Life33 over 7 years
    @Nisanio Along with ERROR! The server quit without updating PID file does it give reference to a .pid file? Maybe something similar to ERROR! The server quit without updating PID file (/usr/local/mysql/data/<userName>.<pidFileName>.pid)
  • Daniel Tate
    Daniel Tate over 7 years
    This worked for me community.jaspersoft.com/wiki/uninstall-mysql-mac-os-x. I had to brew uninstall mysql then delete ALL of the files then reinstall and follow the home brew install instructions
  • Rockin4Life33
    Rockin4Life33 over 7 years
    @DanielTate Thanks for adding that in w/the link. Should be helpful to others!
  • Snekse
    Snekse about 5 years
    ps aux | grep [m]ysql will help prevent grep from grepping itself
  • gvanto
    gvanto over 4 years
    I did the above step and still getting error: [15:57:53][~]#sudo mysql.server restart ERROR! MySQL server PID file could not be found! Starting MySQL .. ERROR! The server quit without updating PID file (/var/run/mysqld/mysqld.pid).
  • Janac Meena
    Janac Meena almost 4 years
    @Nisanio did you figure out how to solve that issue?
  • Rockin4Life33
    Rockin4Life33 almost 4 years
    @JanacMeena I've updated my answer to include Daniel Tate alt solution from comments, in the case Nisanio doesn't get back to you w/a solution. Hopefully this helps unblock you, if not post back with more details; maybe I — or the community — can be of assistance
  • Janac Meena
    Janac Meena almost 4 years
    @Rockin4Life33 thanks for your response, but I was able to solve this issue by deleting my ibdata files and ib-log files.
  • Janac Meena
    Janac Meena almost 4 years
    For reference, I documented my solution here: medium.com/@7anac/…
  • Rockin4Life33
    Rockin4Life33 almost 4 years
    @JanacMeena, thank you for the write-up on Medium and posting the link. I've updated the answer to contain your solution.