打开cmd:mysql -uroot -p
进入mysql依次执行下面语句
ALTER USER 'root'@'localhost' IDENTIFIED BY 'password' PASSWORD EXPIRE NEVER; #修改加密规则
ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'password'; #更新一下用户的密码
FLUSH PRIVILEGES; #刷新权限
alter user 'root'@'localhost' identified by 'xzx123456';#重置密码,xzx123456就是变更后的密码