- 编辑一个mysql启动文件
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=root</string>
</array>
</dict>
</plist>
上面xml中的/usr/local/mysql/为我的mysql所在目录。
- 加载这个启动文件
sudo launchctl load -w /Library/LaunchDaemons/com.mysql.mysql.plist
原文链接:http://blog.csdn.net/kakashi8841/article/details/41597371
网友评论