(1) '系统偏好设置' > MySQL > 'Stop MySQL Server'
(2) sudo /usr/local/mysql/bin/mysqld_safe --skip-grant-tables
(3) 新开另一个terminal,执行:
sudo /usr/local/mysql/bin/mysql -u root
UPDATE mysql.user SET authentication_string=PASSWORD('新密码') WHERE User='root';
FLUSH PRIVILEGES;
\q
(旧版的mysql请使用:UPDATE mysql.user SET Password=PASSWORD('新密码') WHERE User='root';)
4. '系统偏好设置' > MySQL > 'start MySQL Server'