1.关闭MySQL:系统偏好设置->MySQL->Stop MySQL Server
2.打开终端:sudo /usr/local/mysql/bin/mysqld_safe --skip-grant-tables
点击回车,MySQL会自动开启
3.重新创建新的终端窗口:
/usr/local/mysql/bin/mysql
进入mysql命令模式
use mysql
进入mysql数据库
flush privileges;
set password for 'root'@'localhost'=password('新密码');
搞定!!
亲测版本:/usr/local/mysql/bin/mysql -V
/usr/local/mysql/bin/mysql Ver 14.14 Distrib 5.7.15, for osx10.11 (x86_64) using EditLine wrapper