homebrewで入れたmysql, LauchAgentsで管理してたけど止めたいとき


>>> mysql.server stop                                                
Shutting down MySQL
.. ERROR! The server quit without updating PID file (/usr/local/var/mysql/hoge.pid).

pidファイル updateできないのでエラーになったので

>>> open ~/Library/LaunchAgents/homebrew.mxcl.mysql.plist
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
  <key>KeepAlive</key>
  <true/>
  <key>Label</key>
  <string>homebrew.mxcl.mysql</string>
  <key>ProgramArguments</key>
  <array>
    <string>/usr/local/opt/mysql/bin/mysqld_safe</string>
    <string>--bind-address=127.0.0.1</string>
    <string>--datadir=/usr/local/var/mysql</string>
  </array>
  <key>RunAtLoad</key>
  <true/>
  <key>WorkingDirectory</key>
  <string>/usr/local/var/mysql</string>
    <key>UserName</key>
    <string>koichi.yanagimoto</string>
</dict>
</plist>

が出てくるので、

<key>KeepAlive</key>
  <false/>

にします。

>>> launchctl unload ~/Library/LaunchAgents/homebrew.mxcl.mysql.plist

>>> launchctl load ~/Library/LaunchAgents/homebrew.mxcl.mysql.plist

して、

>>> mysql.server stop

Shutting down MySQL
.. SUCCESS!

SUCCESS!