16

I'm starting to go nuts over this. I setup MySQL/Apache/PHP using the tutorial by Coolest Guides On The Planet. I'm guessing something went wrong as its not working as expected so I want to uninstall and try again.

The trouble is that I can't stop MySQL either by system preferences or command line. I keep trying suggestions on the net but so far unsuccessful. Can anyone help?

Matthew
  • 1,905
  • 3
  • 19
  • 26
LB79
  • 1,285
  • 2
  • 12
  • 20

9 Answers9

64

Finally got around the autostart - Thanks to all who contributed and allowed me to see the way.

To stop the auto start I used:

sudo launchctl unload -w /Library/LaunchDaemons/com.mysql.mysql.plist

And to kill the service I used:

sudo pkill mysqld
Community
  • 1
  • 1
LB79
  • 1,285
  • 2
  • 12
  • 20
  • yes! thank you. Couldn't figure out how to prevent it from auto starting back up. Even editing the com.mysql.mysql.plist to set autostart to false didn't help. this worked – DMTintner Mar 12 '16 at 13:53
  • 2
    Finally... thanks! Also instead of pkill you can just go to SysPreferenses/MySQL and press the stop button. – klm123 Jul 27 '16 at 17:30
  • 3
    Thanks! And in my machine I used this command `sudo launchctl unload -w /Library/LaunchDaemons/com.oracle.oss.mysql.mysqld.plist`. Notice that the plist file name is slightly different. – Hustlion May 30 '17 at 14:51
  • ```sudo launchctl unload -w /Library/LaunchDaemons/com.mysql.server.plist``` worked for me – Suhan Dharmasuriya Aug 07 '17 at 08:16
  • 1
    Thanks `sudo pkill mysqld` works for macOS High Sierra – Kuhan Feb 07 '18 at 04:42
  • Thanks for the answer. Super annoying that this isn't discussed on the Oracle site. Also, see comment below that the name now has ".oss" in it. – PeterT Oct 10 '18 at 17:47
  • 2
    Thanks Hutlion `sudo launchctl unload -w /Library/LaunchDaemons/com.oracle.oss.mysql.mysqld.plist` works in Mojave – brianfit Jan 06 '19 at 12:02
12

This is what worked for me. It was listed under a different plist name:

sudo launchctl unload -w com.oracle.oss.mysql.mysqld.plist
Benjamin W.
  • 46,058
  • 19
  • 106
  • 116
Clodel Gosuico
  • 121
  • 1
  • 2
  • I struggled with this for 8 hours. I upgraded from osx lion with mysql 5.5 to el capital and mysql 5.7. The new version installed correctly but for some reason I could never get it to start. Realized there was another mysql process already running but couldn't figure out how it was configured. Everytime I killed mysqld it re-appeared. Was caused by this launch control – Neil Oct 18 '16 at 13:55
12

For Mac Users kill -9 {pid} kept restarting the process. This was because I had MySQL Server running. On OSX I had to:

1- System Preferences.

2- Search for mysql.

3- Press the Stop MySQL Server button.

got it from a github issue, and it solved my problem

https://github.com/docker/compose/issues/4950#issuecomment-407145733

Ali Miskeen
  • 280
  • 4
  • 9
8

brew services stop mysql@5.6 worked for me, when all else failed.

dvvrt
  • 599
  • 7
  • 7
5

I also got the same problem, unable to stop MySql Sever through system preferences on macOS High Sierra.

I did brew uninstall mysql on my terminal window.

now I am able stop stop MySql Sever through system preferences.

Since mysql was installed on my mac 2 ways binary as well as home brew.

Kuhan
  • 495
  • 7
  • 17
4

in terminal

kill `pgrep mysqld`

this kills the mysqld process.

rrrkren
  • 121
  • 3
4

If you used brew then you can find out which version you are using by:

launchctl list|grep mysql

this will print something like

92555   0   homebrew.mxcl.mysql@5.7

In my case I'm using mysql@5.7

You can stop using:

brew services stop mysql@5.7
Nick Mitchell
  • 1,207
  • 13
  • 24
1

Try with issuing the following command in command line:

ps -xo pid,ppid,stat,command | grep mysqld

It will show you your processes, with their parent ID in the second column. Look for the mysqld and it's parent process. After locating it, issue a:

sudo kill pid

where pid is mysqld's parent process ID.

EDIT If you want to stop the process from launching again, try:

sudo launchctl unload  /System/Library/LaunchDaemons/mysqld.plist
Matthew
  • 1,905
  • 3
  • 19
  • 26
Nikola
  • 371
  • 1
  • 9
  • 19
  • in the cmd line response 603 597 U+ grep mysqld which is the parent process id? Thanks – LB79 Mar 31 '15 at 18:51
  • It's a 597. Try: `sudo kill 597` or if it fails, `sudo kill -9 597` – Nikola Mar 31 '15 at 22:45
  • The second command said process completed but in system prefs MySQL is still running – LB79 Apr 01 '15 at 19:10
  • 2
    Using sudo launchctl unload /System/Library/LaunchDaemons/mysqld.plist gives me /System/Library/LaunchDaemons/mysqld.plist: No such file or directory – LB79 Apr 02 '15 at 19:42
  • maybe try with `sudo launchctl unload /System/Library/LaunchDaemons/mysql.plist` – Nikola Apr 02 '15 at 21:19
1

I've installed mysql via homebrew, but stop mysql by using mysql stop command, mysql restart right now. try to execute command as follow if your mysql was installed via homebrew

brew services stop $(brew list | grep mysql)
Van丶
  • 11
  • 1
  • 3