navicate:2059 Authentication plugin caching_sha2_password

发布时间 2023-05-05 20:38:26作者: keras

场景:

解决:

show variables like 'default_authentication_plugin';

image

然后看全部用户的密码模式

select host,user,plugin from mysql.user;
image
之前全部是caching_sha2_password 这个是修改过的

按照网上的解决方案

ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'root';
结果: 退出之后就进不去mysql了
image
所以只能充值密码了,但是好多都没用,我的mysql是8,一下是解决方案

  1. 管理员模式进入cmd
  2. 关闭mysql服务 net stop mysql
  3. mysqld --console --skip-grant-tables --shared-memory 免密登录
  4. image
  5. 另起一个cmd,mysql -uroot -p 直接回车,不用输入密码
  6. 下一步也是坑,网上的命令一点用也没有,还报错

use mysql;
ALTER user root@'localhost' identified by '123456';
然后出现 ERROR 1290 (HY000): The MySQL server is running with the --skip-grant-tables option so it cannot exe
需要 flush privileges;
ALTER user root@'localhost' identified by '123456';
quit
然后启动mysql,但是 net start mysql
发生系统错误 5。
拒绝访问。
Win+R services.msc 手动启动mysql服务 ok