(homebrew.mxcl.mysql [2274]):服务无法初始化:无法设置当前工作目录. error = 2:没有这样的文件或目录

如果我在我的mac上运行控制台并转到system.log,我看到该系统,日志充满了这个错误

Oct 31 15:57:59 abhisheks-mbp com.apple.xpc.launchd[1] (homebrew.mxcl.mysql[2185]): Service could not initialize: Unable to set current working directory. error = 2: No such file or directory, path = /usr/local/var/mysql: 17A405: xpcproxy + 11040 [1403][43FABD4F-8081-3087-91BC-95B588688D55]: 0x2
Oct 31 15:57:59 abhisheks-mbp com.apple.xpc.launchd[1] (homebrew.mxcl.mysql): Service only ran for 0 seconds. Pushing respawn out by 10 seconds.
Oct 31 15:58:03 abhisheks-mbp com.apple.xpc.launchd[1] (com.apple.preference.displays.MirrorDisplays): Service only ran for 0 seconds. Pushing respawn out by 10 seconds.

几个月前我用homebrew安装了mysql.但我已经删除它我不知道为什么它仍然试图运行它.

我试图删除mysql

~ > brew uninstall mysql
Error: No such keg: /usr/local/Cellar/mysql

但我仍然看到消息涌入.

解决方法:

您可能在过去使用brew服务启动mysql启用MySQL启动代理并忘记禁用brew服务(在卸载mysql之前),这将删除plist.

因此,使用以下方法手动卸载并从launchd数据库中删除代理:

launchctl unload ~/Library/LaunchAgents/homebrew.mxcl.mysql.plist
launchctl remove ~/Library/LaunchAgents/homebrew.mxcl.mysql.plist

然后删除文件:

rm ~/Library/LaunchAgents/homebrew.mxcl.mysql.plist

如果您执行了plist的自定义安装,则homebrew.mxcl.mysql.plist文件可能位于/ Library / LaunchAgents中.然后使用相同的命令,但调整上面的路径并添加sudo.

相关文章

最近做自动化测试时,深感自己对前端涉猎太少,加上对这块比...
homebrew本身就是一个git仓库。使用homebrew安装软件包时,会...
一、Homebrew安装、卸载等命令Homebrew的安装和卸载都非常简...
在mac系统中,使用homebrew可以很方便的管理包。按照官网的说...
我按照说明从这里使用brew安装mysqlhttps://gist.github.com...
我在macOS10.12.4上安装了nginx1.10.3和php5.5.38作为开发服...