Mac下设置MySQL开机自启

来源:互联网 发布:html在线图片编辑源码 编辑:程序博客网 时间:2024/06/04 20:15

自从我的MBP升级到Yosemite后MySQL不知道怎么就不能开机自启了,刚刚找到一篇文章解决了这个问题。

首先,在终端里输入:

<span style="font-family: Arial, Helvetica, sans-serif;">sudo vi /Library/LaunchDaemons/com.mysql.mysql.plist</span>
然后,输入启动文件内容:

<?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>
注意这里“/usr/local/mysql”是MySQL所在目录。

继续在终端里输入:

sudo launchctl load -w /Library/LaunchDaemons/com.mysql.mysql.plist
搞定。



0 0
原创粉丝点击