1

This question bas many answers, I tried what I found – did not work

So, I tried sudo mysqld stop. Still I see the mysql processes running:

0   317     1   0 11:15AM ??         0:00.02 /bin/sh /usr/local/mysql/bin/mysqld_safe --datadir=/usr/local/mysql/data --pid-file=/usr/local/mysql/data/anarinsky-mbp.smartdestinations.com.pid


74  3562   317   0 11:40AM ??         0:00.41 /usr/local/mysql/bin/mysqld --basedir=/usr/local/mysql --datadir=/usr/local/mysql/data --plugin-dir=/usr/local/mysql/lib/plugin --user=mysql --log-error=/usr/local/mysql/data/anarinsky-mbp.smartdestinations.com.err --pid-file=/usr/local/mysql/data/anarinsky-mbp.smartdestinations.com.pid

The same happens if I do “sudo kill -9 3562”.

Trying to go to /Library/LaunchDaemons does not retrieve any mysql entries

ls /Library/LaunchDaemons | grep mysql

The service command does not work:

-bash: service: command not found

My Os X version is 10.9.2

Alwaysblue
  • 9,948
  • 38
  • 121
  • 210
Alex
  • 7,007
  • 18
  • 69
  • 114
  • Here's a suggestion; https://coolestguidesontheplanet.com/start-stop-mysql-from-the-command-line-terminal-osx-linux/ The kill command requires a process id (sudo kill -9 PIDxxx) and it will always work if you have the right pid. – john elemans Oct 03 '16 at 16:20
  • Possible duplicate of [How do you stop MySQL on a Mac OS install?](http://stackoverflow.com/questions/100948/how-do-you-stop-mysql-on-a-mac-os-install) – Gerard Roche Oct 03 '16 at 16:26
  • Sure, I used PID of the process in kill-9. As I wrote I tried multiple recepies before – Alex Oct 03 '16 at 17:31

3 Answers3

4

There are two answers I know, it might not help since you search a long time.

1.if you install mysql from dmg, you can close it in "system preferences".

2.And besides that, you can start/stop/restart mysql by:

sudo /usr/local/mysql/support-files/mysql.server start
sudo /usr/local/mysql/support-files/mysql.server stop
sudo /usr/local/mysql/support-files/mysql.server restart
zhenbo xu
  • 547
  • 5
  • 10
  • 2
    doesnt work, it keeps getting restarted and those commands also give an error ERROR! MySQL server PID file could not be fou – PirateApp Mar 14 '18 at 07:07
  • 5
    System Preferences > MySQL > Stop Mysql worked for me. To find out where mysql is installed try: `type -a mysql` – Connor Leech Jul 02 '18 at 14:30
2

To install Homebrew, open Terminal/iTerm and run following command or check https://brew.sh/

Install mysql

  • $ brew install mysql.

Install brew services first

  • $ brew tap homebrew/services.

Start mysql

  • $ brew services start mysql.
1

In order to avoid mysqld from auto restarting after killed, try execute all these 3 commands:

$ brew services stop mysql
$ sudo launchctl unload /Library/LaunchDaemons/com.mysql.mysql.plist
$ sudo launchctl unload /Library/LaunchDaemons/com.oracle.oss.mysql.mysqld.plist
tmwong
  • 66
  • 4