25

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
2
  • 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/… May 8, 2020 at 13:51
  • I also experienced this issue on CentOS 6. After the investigation, I found out that it was just caused by the disk space that is 100% full. I freed up some disk space by removing old backup files and MySQL server was alive again!
    – phagento
    Sep 27, 2022 at 2:06

4 Answers 4

17

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
7
  • Okay, I am trying this. I will let you know how it goes Feb 20, 2013 at 23:29
  • 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 Feb 20, 2013 at 23:34
  • I cannot find pid-file in my.cnf .. could I add this line pid-file = /var/run/mysqld/mysqld.pid ??
    – mOna
    Feb 29, 2016 at 10:01
  • yes, if you are getting "PID file not found" error.
    – Daniel t.
    Mar 2, 2016 at 23:32
  • @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?! :|
    – mOna
    Mar 11, 2016 at 14:18
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.

10
  • 2
    ERROR! The server quit without updating PID file
    – Nisanio
    Aug 7, 2016 at 19:59
  • 1
    @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) Aug 7, 2016 at 20:13
  • 1
    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 Aug 25, 2016 at 2:31
  • 1
    ps aux | grep [m]ysql will help prevent grep from grepping itself
    – Snekse
    Apr 4, 2019 at 15:40
  • 1
    @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 May 6, 2020 at 19:36
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.

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.