Homebrewで入れたMySQL5.1を停止できない件の対策

現象


MySQLを停止しようとするとエラーがでる

$ mysql.server stop
Shutting down MySQL
....... ERROR! Manager of pid-file quit without updating file.
 ERROR! Failed to stop running server, so refusing to try to start.

原因


Homebrewで作られたmysqlのplistの設定で、死なないようになってる

  • その為、停止処理がまだ生きているプロセスを発見してエラーを出す

対策


plistのKeepAliveの値をtrueから、falseに修正する

$ vim ~/Library/LaunchAgents/com.mysql.mysqld.plist
  <key>KeepAlive</key>
  <false/>


KeepAliveは、そのプロセスを常に起動した状態にするか否かを設定するオプション

KeepAlive <boolean or dictionary of stuff>
     This optional key is used to control whether your job is to be kept continuously running or to let
     demand and conditions control the invocation.


変更後、plistを再読込させる

$ launchctl unload -w ~/Library/LaunchAgents/com.mysql.mysqld.plist
$ launchctl load -w ~/Library/LaunchAgents/com.mysql.mysqld.plist


無事終了/起動できるようになった

$ mysql.server stop                                             
Shutting down MySQL
... SUCCESS!
$ mysql.server start
Starting MySQL
. SUCCESS!
$ mysql.server restart
Shutting down MySQL
.. SUCCESS!
Starting MySQL
. SUCCESS!