先停止所有mysql有关进程。 打开控制台:依次输入以下命令
sudo rm /usr/local/mysqlsudo rm -rf /usr/local/mysql*sudo rm -rf /Library/StartupItems/MySQLCOMsudo rm -rf /Library/PreferencePanes/My*vim /etc/hostconfig and removed the line MYSQLCOM=-YES-rm -rf ~/Library/PreferencePanes/My*sudo rm -rf /Library/Receipts/mysql*sudo rm -rf /Library/Receipts/MySQL*sudo rm -rf /var/db/receipts/com.mysql.* 最后这条很多文章都丢了,切记切记。
2019-08-19T08:56:48.924753Z 1 [Note] A temporary password is generated for root@localhost: gdi;4y:K/C)eIf you lose this password, please consult the section How to Reset the Root Password in the MySQL reference manual./usr/local/MySQL/bin/mysql -u root -p mysqladmin -uroot -pgdi;4y:K/C)e password123 /usr/local/MySQL/bin/mysql -u root -p'gdi;4y:K/C)e' SET PASSWORD FOR 'root'@'localhost' = PASSWORD('新的密码');
# 添加环境变量
export PATH=${PATH}:/usr/local/mysql/bin
mysql -uroot -p