1、登录MySQL,使用命令
mysql -u root -p或mysql -u root -ppassword【ps:-ppassword后面的密码是你的root密码】
2、修改加密规则
ALTER USER 'root'@'%' IDENTIFIED BY 'password' PASSWORD EXPIRE NEVER;
3、更新用户密码
ALTER USER 'root'@'%' IDENTIFIED WITH mysql_native_password BY 'password';
4、刷新权限
FLUSH PRIVILEGES;
5、重置密码
alter user 'root'@'%' identified by '你的密码';
6、刷新权限
FLUSH PRIVILEGES;