升级到 Yosemite 之后,之前安装的 MySQL StartupItem 貌似就失效了。
一个解决方式是自己创建一个 launchd 脚本解决。
sudo vi /Library/LaunchDaemons/com.mysql.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>com.mysql.mysqld</string>
<key>ProgramArguments</key>
<array>
<string>/usr/local/mysql/bin/mysqld_safe</string>
<string>--user=mysql</string>
</array>
</dict>
</plist>
然后加载这个 launchd 脚本。
sudo chown root:wheel /Library/LaunchDaemons/com.mysql.mysql.plist
sudo chmod 644 /Library/LaunchDaemons/com.mysql.mysql.plist
sudo launchctl load -w /Library/LaunchDaemons/com.mysql.mysql.plist
1
ibigbug 2014-12-20 23:14:39 +08:00
其实我觉得 launchctl 好难用。何不直接用 supervisor 来管理?
|