1.打开MySQL的命令行,输入数据库密码
2.修改加密规则:ALTER USER 'root'@'localhost' IDENTIFIED BY 'password' PASSWORD EXPIRE NEVER;
3.更新用户密码:ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'password';
4.刷新权限: FLUSH PRIVILEGES;
转载:https://zhuanlan.zhihu.com/p/97939548