【原创】mysql 登录 caching-sha2-password 错误

自己也是新手,网上关于这个问题有很多,不过对于新手,他们没有写具体怎么执行。

解决问题:mysql8.0以上,用客户端方式登录密码报错误  caching-sha2-password 错误

过程如下:

1、还要修改配置文件中的内容 :my.ini文件路径  C:\ProgramData\MySQL\MySQL Server 8.0   ,修改内容如下

找到default_authentication_plugin ,这行,把原来的注释掉,修改为mysql_native_password 方法,如下。保存。

# 默认使用“mysql_native_password”插件认证
default_authentication_plugin=mysql_native_password

2、首先用mysql的exe程序直接登录的方式,进入mysql。就是桌面上的图标

3、新建sql查询 ,

4、输入下面的内容

    ALTER USER 'root'@'localhost' IDENTIFIED BY '写你自己的登录密码' PASSWORD EXPIRE NEVER; #修改加密规则 
   ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY '写你自己的登录密码'; #更新用户的密码 

   FLUSH PRIVILEGES; #刷新权限 

         alter user 'root'@'localhost' identified by '写你自己的登录密码';

在mysql中执行就可以了。,这部分可以参考 :https://blog.csdn.net/u010026255/article/details/80062153

猜你喜欢

转载自blog.csdn.net/u014710355/article/details/81270581
今日推荐