rt,本方法仅适用brew安装的MySQL
1、终端登陆MySQL
$ mysql -u root -p
password #登入mysql
2、修改账户密码加密规则并更新用户密码
mysql> ALTER USER 'root'@'localhost' IDENTIFIED BY 'password' PASSWORD EXPIRE NEVER; #修改加密规则
mysql> ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'password'; #更新一下用户的密码
mysql> \g
3、刷新权限并重置密码
mysql> FLUSH PRIVILEGES; #刷新权限
mysql> \g
3、再重置下密码:
mysql> alter user 'root'@'localhost' identified by '123456';
mysql> \g
网友评论