我想在启动时自动启动 MySQL 服务器。这在小牛队是可能的,但在优胜美地似乎不起作用。
edit:似乎这也适用于 El Capitan
@dcc 非常接近。这是 MySQL 在 Yosemite 上再次自动启动的方式:
The com.mysql.mysql.plist
in /Library/LaunchDaemons
:
<?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>
另外我还根据以下内容更改了权限这个答案 https://stackoverflow.com/questions/5555589/mysql-5-5-10-mac-10-6-x-auto-start#5557091
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
如果还有补充请在下方分享!
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)