在mac终端通过命令安装mysql,提示错误,解决方法如下:
(1)安装命令:brew install mysql
(2)提示错误:
Error:Could not create /usr/local/Cellar
Check you have permission to write to /usr/local
解决方法:sudo chown -R $(whoami) /usr/local,
很悲催,又报错,chown: /usr/local: Operation not permitted错误,原因是brew和Mac版本不匹配。
解决方法:先卸载已安装的homebrew,命令如下:
/usr/bin/ruby -e "$(curl -fsSL /Homebrew/install/master/uninstall)"
然后重新安装:
/usr/bin/ruby -e "$(curl -fsSL /Homebrew/install/master/install)"
通过该方法直接获取最新的homebrew,然后再安装mysql。
(3)提示错误:
Error: Git must be installed and in your PATH!
xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools), missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrun
解决方法:xcode-select --install
(4)安装mysql后程序中mysql链接失败,原因是mysql对应的版本不对-_-!!!,用brew命令安装对应版本的mysql即可。