Mac brew install mysql error fixes

今天尝试在我本地安装mysql,通过 brew install [email protected]命令后显示安装成功,但日志显示了一行字让我菊花一紧,感觉要出事情。安装日志如下:

A "/etc/my.cnf" from another install may interfere with a Homebrew-built server starting up correctly.

果不其然,当尝试用 mysql.server start命令启动 mysq 时出错:

 ERROR! The server quit without updating PID file 

这个时候用 ps -ef | grep mysql 并不能抓取到任何 mysql进程。

在网上搜了一圈下来,各种方案都无法解决,然后尝试使用 brew 来启动 mysql。

启动命令如下:brew services start [email protected]

居然有效,反馈: Service `[email protected]` already started, use `brew services restart [email protected]` to restart.

二话不是执行:brew services restart [email protected]

执行结果:

Stopping `[email protected]`... (might take a while)

==> Successfully stopped `[email protected]` (label: [email protected])

==> Successfully started `[email protected]` (label: [email protected])

看到成功了,执行了下 ps -ef | grep mysql。居然还是没有任何mysql进程,我X,什么鬼?

尝试执行 mysql -u root

得到错误信息:Can't connect to local MySQL server through socket '/tmp/mysql.sock'

好吧,还是得再去网上爬方案,半个小时过去了,也没任何进展,心一横,自己去硬闯一下:

1. 先卸载mysql:brew uninstall [email protected]

2. 清理垃圾数据: brew cleanup 

3. 执行 sudo find / -name '*mysql*' 查找 mysql 残余文件

4. 删除所有找到得 mysql残余文件和文件夹

5. 再安装 mysql, brew install [email protected]

最后执行 mysql.server start 成功了,莫名得成功了,唉。。。

总结:

    1. 始终不知道哪里得环境导致最开始mysql失败。

    2. brew services start/restart [email protected]是个什么鬼命令,明启动成功也显示start successfully

    3. 清理mysql残余文件和文件夹,感觉 /usr/local/var/mysql 目录清理后比较有效果,导致后来mysql安装成功。

猜你喜欢

转载自my.oschina.net/simonton/blog/1820894
今日推荐