1、'系统偏好设置' > MySQL > 'Stop MySQL Server'
2、打开一个终端: sudo /usr/local/mysql/bin/mysqld_safe --skip-grant-tables
3、新打开一个终端:
sudo /usr/local/mysql/bin/mysql -u root
UPDATE mysql.user SET authentication_string=PASSWORD('新密码') WHERE User='root';
FLUSH PRIVILEGES;
\q
4、重启mysql