1、cmd窗口关掉服务(8表示mysql版本)
net stop mysql8
2、无密码启动mysql服务
mysqld --console --skip-grant-tables --shared-memory
3、另开一个cmd窗口,空密码登录mysql
mysql.exe -uroot
4、用sql命令把root密码设置为空
update mysql.user set authentication_string='' where user='root';
5、刷新权限,密码就重置为空了
flush privileges;
6、我们可以查看下修改好的密码
select host,user,plugin,authentication_string from mysql.user;