完全删除mysql并重新安装它(不到15分钟).
1.从系统中卸载和清除MYSQL
>备份数据库.
>停止并终止任何MySQL进程.使用ps -ax检查进程grep mysql
>卸载mysql
brew remove mysql
brew cleanup
>删除所有残留文件
sudo rm /usr/local/mysql
sudo rm -rf /usr/local/var/mysql
sudo rm -rf /usr/local/mysql*
sudo rm ~/Library/LaunchAgents/homebrew.mxcl.mysql.plist
sudo rm -rf /Library/StartupItems/MySQLCOM
sudo rm -rf /Library/PreferencePanes/My*
>卸载以前的自动登录
launchctl unload -w ~/Library/LaunchAgents/homebrew.mxcl.mysql.plist
>删除以前的配置.从/ etc / hostconfig中删除行MYSQLCOM = -YES-
>删除以前的首选项
sudo 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*
sudo rm -rf /private/var/db/receipts/*mysql*
sudo rm -rf /private/var/mysql
>可选,重启电脑.我没有.
2.安装MYSQL
>安装Mysql
brew install mysql
>设置为在启动时运行
brew services start mysql
>确保安装
mysql_secure_installation