先删除当前的mysql文件
打开终端窗口
使用mysqldump备份你的数据库将文本文件!
停止数据库服务器
sudo rm /usr/local/mysql
sudo rm -rf /usr/local/mysql*
sudo rm -rf /Library/StartupItems/MySQLCOM
sudo rm -rf /Library/PreferencePanes/My*
edit /etc/hostconfig and remove the line MYSQLCOM=-YES-
rm -rf ~/Library/PreferencePanes/My*
sudo rm -rf /Library/Receipts/mysql*
sudo rm -rf /Library/Receipts/MySQL*
sudo rm -rf /private/var/db/receipts/*mysql*
mysql5.7下载地址
https://dev.mysql.com/downloads/mysql/
下载dmg
安装时记住保存推送的临时密码,类似“PfyQtykYg6=N”
安装后到/usr/local/mysql下启动碰到“ERROR 2002 (HY000): Can't connect to local MySQL server through socket”
这时启动mysql服务器“sudo /usr/local/mysql/support-files/mysql.server start”
再登陆mysql,第一次登陆需要修改密码
搞定收工~