MySQL server PID file could not be found

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

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.