M HYPE SPLASH
// general

mysql process won't die on mac

By Emma Valentine

I have a problem in the setup of mysql using homebrew and so I decided to uninstall and start with a clean slate. Following the answer here I try to kill the process by

  1. Getting the process id through: ps -ax | grep mysql
  2. Using kill -9 PID to kill the process

My problem is that the PID keeps changing, even if I didn't run the kill command. As an example, here's the result from running ps -ax | grep mysql 3 times consecutively:

➜ ~ ps -ax | grep mysql@5.7 7251 ttys000 0:00.00 grep --color=auto --exclude-dir=.bzr --exclude-dir=CVS --exclude-dir=.git --exclude-dir=.hg --exclude-dir=.svn --exclude-dir=.idea --exclude-dir=.tox mysql@5.7
➜ ~ ps -ax | grep mysql@5.7 7257 ttys000 0:00.00 grep --color=auto --exclude-dir=.bzr --exclude-dir=CVS --exclude-dir=.git --exclude-dir=.hg --exclude-dir=.svn --exclude-dir=.idea --exclude-dir=.tox mysql@5.7
➜ ~ ps -ax | grep mysql@5.7 7263 ttys000 0:00.00 grep --color=auto --exclude-dir=.bzr --exclude-dir=CVS --exclude-dir=.git --exclude-dir=.hg --exclude-dir=.svn --exclude-dir=.idea --exclude-dir=.tox mysql@5.7

Among the million things I tried, I

  1. launchctl unload -w ~/Library/LaunchAgents/**file_name_containing_mysql** and then deleted this file altogether
  2. Another suggestion I found online was running sudo launchctl unload /Library/LaunchDaemons/com.oracle.oss.mysql.mysqld.plist (in my case this is the only process under LaunchDaemons that had mysql in it). The result was:

/Library/LaunchDaemons/com.oracle.oss.mysql.mysqld.plist: Could not find specified service Unload failed: 113: Could not find specified service

One interesting thing also was a suggestion to stop the service of brew using sudo. Tried this as well:

sudo brew services stop mysql@5.7
Stopping `mysql@5.7`... (might take a while)
==> Successfully stopped `mysql@5.7` (label: homebrew.mxcl.mysql@5.7)

The magical thing is that I got this AFTER UNINSTALLING MYSQL@5.7. Yeah you read this right.

And after all this, running ps -ax | grep mysql still shows mysql process running.

So in short what I'm trying to do is, kill all mysql processes. What have I not done that kill this for good?

1 Answer

I'll leave the answer to this here, in case someone falls upon this and learns a lesson that would save some precious hours.

➜ ~ ps -ax | grep mysql@5.7 7251 ttys000 0:00.00 grep --color=auto --exclude-dir=.bzr --exclude-dir=CVS --exclude-dir=.git --exclude-dir=.hg --exclude-dir=.svn --exclude-dir=.idea --exclude-dir=.tox mysql@5.7

The result of this ps, is not actually a process. It probably is the process of grepping but nothing more. I spent so much time trying to kill something that was already dead. But what do you say, learning never comes easy!

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy