升级OS X后,我的MySQL安装在启动时停止加载。
这在MySQL穿行说:
“启动项目安装将变量MYSQLCOM = -YES-添加到系统配置文件/ etc / hostconfig中。如果要禁用MySQL的自动启动,请将此变量更改为MYSQLCOM = -NO-。”
因此,我打开了该文件,并说:
# This file is going away AFPSERVER=-NO- AUTHSERVER=-NO- TIMESYNC=-NO- QTSSERVER=-NO- MYSQLCOM=-YES-
我假设OSX开发人员已添加,# This file is going away但我不确定。
# This file is going away
如果是这样,在OSX Yosemite上启动时启动MySQL的正确方法是什么?
这是固定的原因:
首先,创建一个新文件:/Library/LaunchDaemons/com.mysql.mysql.plist
<?xml version="1.0" encoding="UTF-8"?> <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>
然后更新权限并将其添加到launchctl:
launchctl
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