Alex
Alex

Reputation: 7491

How to stop mysql on OsX from the command line

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

Upvotes: 2

Views: 14640

Answers (3)

tmwong
tmwong

Reputation: 96

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

Upvotes: 1

Jahirul Islam Mamun
Jahirul Islam Mamun

Reputation: 717

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.

Upvotes: 2

zhenbo xu
zhenbo xu

Reputation: 597

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

Upvotes: 4

Related Questions