1.添加文件 代码如下: touch /Library/LaunchDaemons/com.mysql.mysql.plist 2.添加内容 代码如下: KeepAlive Label com.mysql.mysqld ProgramArguments /usr/local/mysql/bin/mysqld_safe --user=root 3.添加后重启 代码如下: sudo launchctl load -w /Library/LaunchDaemons/com.mysql.mysql.plist