先在系統(tǒng)偏好設(shè)置中關(guān)閉mysql服務(wù)
打開(kāi)終端依次輸入命令
cd /usr/local
sudo mysqld_safe --skip-grant-tables
新建終端窗口
輸入命令
mysql
UPDATE user SET authentication_string=PASSWORD('密碼') WHERE user = 'root';
exit
在系統(tǒng)偏好設(shè)置中打開(kāi)mysql服務(wù)即可正常使用