27

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
ZygD
  • 377
  • 1
  • 3
  • 11

4 Answers4

21

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.

18

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
Daniel t.
  • 9,619
0

I had this problem too... In my case,I used Generic MySql version, I run mysql as root user :

/path/to/mysql/support-files/mysql.server start --user=root
0

Underlying issue is probably that your hostname is changing and if you do not specify the pid-file in my.cnf it will use .pid as the file. If I have my MacBook at home I will see one hostname but when it wakes up on the corporate network it will see the same name with ".local" at the end.