brew安装的mysql启动报错

brew安装的mysql,后来系统升级到最新版 OX10.11,再启动Mysql报错

$ sudo mysql.server start
Password:
Starting MySQL
.. ERROR! The server quit without updating PID file (/usr/local/var/mysql/xxxxMacBook-Pro.local.pid).

以上是前提。试了很多方法无果,最后重装mysql步骤如下:

$ brew remove mysql
$ brew cleanup
$ launchctl unload -w ~/Library/LaunchAgents/homebrew.mxcl.mysql.plist
$ rm ~/Library/LaunchAgents/homebrew.mxcl.mysql.plist
$ sudo rm -rf /usr/local/var/mysql

然后开始安装,有个惊异的发现

$ brew install mysql
Warning: You are using OS X 10.11.
We do not provide support for this pre-release version.
You may encounter build failures or other breakage.

百度之后发现一篇文章 http://www.neatstudio.com/archives/?article-2649.html 大体意思就是说brew使用到的目录因为新系统特性加了权限,所以无权限使用了。解决方案就是改变目录权限

$ sudo chown -R $(whoami):admin /usr/local 

然后执行下 brew doctor 看看是否还有其他问题,按照提示解决即可。

$ brew doctor
Please note that these warnings are just used to help the Homebrew maintainers
with debugging if you file an issue. If everything you use Homebrew for is
working fine: please don't worry and just ignore them. Thanks!

Warning: Some installed formula are missing dependencies.
You should `brew install` the missing dependencies:

    brew install libxml2

Run `brew missing` for more details.
$ brew install libxml2
==> Downloading https://homebrew.bintray.com/bottles/libxml2-2.9.2.el_capitan.bo
######################################################################## 100.0%
==> Pouring libxml2-2.9.2.el_capitan.bottle.1.tar.gz
==> Caveats
This formula is keg-only, which means it was not symlinked into /usr/local.

OS X already provides this software and installing another version in
parallel can cause all kinds of trouble.

Generally there are no consequences of this for you. If you build your
own software and it requires this formula, you'll need to add to your
build variables:

    LDFLAGS:  -L/usr/local/opt/libxml2/lib
    CPPFLAGS: -I/usr/local/opt/libxml2/include

==> Summary
  /usr/local/Cellar/libxml2/2.9.2: 275 files, 10M
$ brew doctor
Your system is ready to brew.

然后继续原来的计划 重新安装mysql

$ brew install mysql
==> Downloading https://homebrew.bintray.com/bottles/mysql-5.6.27.el_capitan.bottle.tar.gz
################################################                          66.9%
curl: (56) SSLRead() return error -9806
Error: Failed to download resource "mysql"
Download failed: https://homebrew.bintray.com/bottles/mysql-5.6.27.el_capitan.bottle.tar.gz
Warning: Bottle installation failed: building from source.
==> Installing dependencies for mysql: cmake
==> Installing mysql dependency: cmake
==> Downloading https://homebrew.bintray.com/bottles/cmake-3.3.2.el_capitan.bottle.tar.gz
######################################################################## 100.0%
==> Pouring cmake-3.3.2.el_capitan.bottle.tar.gz
==> Caveats
Emacs Lisp files have been installed to:
/usr/local/share/emacs/site-lisp/cmake
==> Summary

问题到此为止解决了,不过一开始就执行目录权限设置是不是就能直接解决问题?我是没机会试了,有幸看到这里的朋友可以试一下。

你可能感兴趣的:(mac-环境)