首先在mysql文件 bin目录下net stop mysql  关闭mysql服务 并查看任务管理器中是否存在mysql.exe 如果存在禁用此服务

当关闭之后 点击开始 输入CMD   右键以管理员方式打开WIN命令操作

Mysql 忘记密码 解决 并附加中间遇到的问题

 

定位到你的Mysql安装包目录

Mysql 忘记密码 解决 并附加中间遇到的问题

当定位到bin下时输入mysqld --console --skip-grant-tables --shared-memory 关闭服务 (适用于8.0以上版本)

如果是其他版本 可以用mysqld -nt --skip-grant-tables 

输入完成后打开新的窗口 同样定位到bin下 输入mysql

show databases

use mysql

然后查询 select user,host,password from user; 

查询时有可能没有password  如果查不到 改为authentication_string

修改 update mysql.user set password=password('123456') where user='root' and host='localhost';

如果没有password  改为authentication_string 

改为authentication_string 时仍报错

修改语句ALTER USER '账号root'@'localhost' IDENTIFIED WITH mysql_native_password BY  '密码root';

flush privileges刷新

重启mysql 登录成功

 

 

 

 

相关文章:

  • 2022-01-10
  • 2022-12-23
  • 2021-11-14
  • 2022-01-15
  • 2021-06-29
  • 2022-01-15
  • 2021-10-14
  • 2021-05-27
猜你喜欢
  • 2021-10-16
  • 2022-01-14
  • 2021-11-06
  • 2021-12-15
  • 2021-11-28
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案