查找并确定自己需要安装的版本
brew search mysql
指定版本安装
brew install mysql@5.6
配置环境变量
vim ~/.bash_profile
增加一行
'export PATH="/usr/local/opt/mysql@5.6/bin:$PATH"'
执行命令
source ~/.bash_profile
启动服务
mysql.server start
brew services start mysql@5.6
停止服务
mysql.server stop
brew services stop mysql@5.6
初始化,设置密码
mysql_secure_installation