mysql8忘记密码后重置密码

一、cmd窗口关掉服务(8表示mysql版本)mysql

net stop mysql8

二、无密码启动mysql服务web

mysqld --console --skip-grant-tables --shared-memory

在这里插入图片描述
三、另开一个cmd窗口,空密码登陆mysqlsql

mysql.exe -uroot

四、用sql命令把root密码设置为空svg

update mysql.user set authentication_string='' where user='root';

五、刷新权限,密码就重置为空了code

flush privileges;

六、咱们能够查看下修改好的密码xml

select host,user,plugin,authentication_string from mysql.user;

在这里插入图片描述