mac|mac mysql 密码忘记 如何修改

Mac 下 MySQL 的 root 密码忘记

from JoinPerson
关闭mysql服务器
sudo /usr/local/mysql/support-files/mysql.server stop 或者系统偏好里有个 MySQL 里关闭
进入 /usr/local/mysql/bin 目录
cd /usr/local/mysql/bin
获取权限
sudo su
重启服务器
./mysqld_safe --skip-grant-tables &
重开个终端
mysql -uroot -p (提示输入密码时随便输入即可)
【mac|mac mysql 密码忘记 如何修改】获取权限,要不它不让你改
flush privileges;
设置新密码
set password for 'root'@'localhost'=password('新密码');
但是执行最后一步的时候报错
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'set password for 'root'@'localhost'=password('12')' at line 2

    推荐阅读