首页 > 代码库 > brew 安装 mysql

brew 安装 mysql

在网上看到各种教程,都会出现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

4.登录

     mysql -uroot

brew 安装 mysql