MySQL8.0之后更改密码方式改变,此方法适用于登录之后修改密码:
ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY '你的密码';
忘记密码则需要跳过密码验证:
定位默认安装路径C:\Program Files\MySQL\MySQL Server 8.0
地址栏直接输入cmd,在cmd中输入
skip-grant-table
跳过验证
mysql -uroot -p
无密码登录
use mysql;
update user set authentication_string='' where user='root';
清空旧密码,再设置新密码即可