错误内容:
Error: Failure while executing; `/bin/launchctl bootstrap gui/501 /Users/bruce/Library/LaunchAgents/homebrew.mxcl.mysql.plist` exited with 5.
- “homebrew.mxcl.mysql.plist” 是 Homebrew 安装的 MySQL 服务的启动配置文件。
查看启动文件内容:
<?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>homebrew.mxcl.mysql</string>
<key>LimitLoadToSessionType</key>
<array>
<string>Aqua</string>
<string>Background</string>
<string>LoginWindow</string>
<string>StandardIO</string>
<string>System</string>
</array>
<key>ProgramArguments</key>
<array>
<string>/opt/homebrew/opt/mysql/bin/mysqld_safe</string>
<string>--datadir=/opt/homebrew/var/mysql</string>
</array>
<key>RunAtLoad</key>
<true/>
<key>WorkingDirectory</key>
<string>/opt/homebrew/var/mysql</string>
</dict>
</plist>
- 在终端中直接执行
/opt/homebrew/opt/mysql/bin/mysqld_safe
,查看提示,发现是有文件的权限不对。 ls -l [文件路径]
发现此文件与相同路径下的同级文件所有者不一致,其它都是用户,此文件所有者为root。sudo chown -R [user] [文件路径]
更改所有者。- 再执行
brew services start mysql
,启动ok