Search code examples
mysqlsql-servermacoshomebrewosx-elcapitan

MySQL 5.7.13 Homebrew on OS X EL Capitan: ERROR! The server quit without updating the PID file on startup


For some reason, when I try to start up the server using the mysql.server start command, it gives the following error.

ERROR! The server quit without updating PID file(/usr/local/var/mysql/hostname.pid)

I have no idea why this was happening and really don't know what to do about it. When I try to login to the server (Even though it's not running) with mysql -u root which doesn't have a password as of now, it gives me this error.

ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql.sock'

I'm guessing this is because the server isn't started, but I can't get it started in the first place.

I've tried:

  • Creating the PID file touch /usr/local/var/mysql/hostname.pid
  • brew update brew doctor and brew upgrade before a reinstallation of mysql

But nothing I do seems to work. Any help would be great.

Update:

I checked the error log located in /usr/local/var/mysql/hostname.err and gathered this information that may be helpful to solving this problem. There is a line in that file that states the following.

[ERROR] Can't start server: Bind on TCP/IP port: Address already in use
[ERROR] Do you already have another mysqld server running on port: 3306 ?
[ERROR] Aborting

So I guess there's another mysql server running somewhere that I'm not aware of? How can I shut this down?

I ran ps -aef | grep mysql and got the following input. Excluding the ps process.

502 34914     1   0 12:17pm ??         0:00.02 /bin/sh /usr/local/opt/mysql/bin/mysqld_safe --bind-address=127.0.0.1 --datadir=/usr/local/var/mysql
502 35006 34914   0 12:17pm ??         0:00.22 /usr/local/Cellar/mysql/5.7.13/bin/mysqld --basedir=/usr/local/Cellar/mysql/5.7.13 --datadir=/usr/local/var/mysql --plugin-dir=/usr/local/Cellar/mysql/5.7.13/lib/plugin --bind-address=127.0.0.1 --log-error=/usr/local/var/mysql/hostname.err --pid-file=/usr/local/var/mysql/hostname.pid

Solution

  • I figured it out once I ran the ps -aef | grep mysql command. I had to end all of the mysql processes. I guess another mysql server was running preventing me from connecting with the port 3306.

    I killed the process using sudo kill -9 <pid>.