苹果 Mac下 mysql忘记密码解决方法Mysql ERROR 1045 (28000): Access denied for user 'root'@'localhost'

在terminal命令行终端依次执行以下命令即可:

sudo /usr/local/mysql/support-files/mysql.server stop

cd /usr/local/mysql/bin

sudu su

./mysqld_safe --skip-grant-tables &

control + D退出编辑

alias mysql=/usr/local/mysql/bin/mysql

mysql

use mysql

flush privileges;

set password for 'root'@'localhost'=password('new password'); (new password为用户自定义新密码)

问题解决。

你可能感兴趣的:(数据库)