在网上看到各种教程,都会出现ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql.sock'
1. 确保环境没有mysql
brew remove mysql
brew cleanup
2. 安装
brew install mysql
3. 启动
brew services start mysql
设置开机启动: launchctl load ~/Library/LaunchAgents/homebrew.mxcl.mysql.plist (设置启动的命令可以通过 brew info mysql获得)
4.登录
mysql -uroot