mysql 8.x 忘记密码

1. net  stop mysql ,停止服务

2. 开启跳过验证登陆的服务  

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

3.新开一个窗口,无密码登陆 mysql

  mysql -u root -p

4.重置密码

  use mysql

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

5.quit 退出,关闭所有窗口

6.新开窗口,net  start mysql 启动服务

7.使用步骤4重置空的密码进行登陆

8.修改密码

  ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY '123456';

参考文章:https://www.cnblogs.com/jerrys/p/10626408.html

原文地址:https://www.cnblogs.com/bytecodebuffer/p/15153192.html