Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
913 views
in Technique[技术] by (71.8m points)

macos - Quit MySQL without it restarting on El Capitan

I'm running OS X 10.11 El Capitan with its built-in server stack (Apache 2.4.16, MySQL 5.6.26).

I need to quit mysql, but killing the process immediately restarts it.

Here's what I've tried so far:


Killing the process

$ ps aux | grep mysql to get the PID returns

74 49484     1   0 10:23AM ??         0:00.46 /usr/local/mysql/bin/mysqld --user=_mysql --basedir=/usr/local/mysql --datadir=/usr/local/mysql/data --plugin-dir=/usr/local/mysql/lib/plugin --log-error=/usr/local/mysql/data/mysqld.local.err --pid-file=/usr/local/mysql/data/mysqld.local.pid --port=3307

Then, $ sudo kill -9 49484 kills the process, but it immediately restarts with with a higher PID.


Unloading mysqld from launchd

$ launchctl list | grep mysql returns nothing, so there is nothing to $ launchctl unload


Stopping the mysql server

$ /usr/local/mysql/support-files/mysql.server stop fails with "ERROR! MySQL server PID file could not be found!" despite the fact that mysql is running and the PID file is up-to-date in /usr/local/mysql/data/mysqld.local.pid.


The above are all suggested solutions I found on Stack Overflow, none of which work for me on El Capitan. On Yosemite, simply killing the process was sufficient but with the El Capitan update, mysql is immediately restarted.

Thanks.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

What finally worked for me was stopping MySQL through the Mac System Preferences interface. That killed mysql without it coming back.

enter image description here


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...