连接mysql出现“Unable to load authentication plugin 'caching_sha2_password”错误


这是mysql 8.0版本才出现的问题,原因是mysql 8.0 默认使用 caching_sha2_password 身份验证机制 —— 从原来的 mysql_native_password 更改为 caching_sha2_password。

  解决办法:

    可以更换版本但是感觉治标不治本,建议修改身份验证机制

    1、登陆mysql

      在mysql的bin目录下打开cmd(默认是C:\Program Files\MySQL\MySQL Server 8.0\bin)

      输入:mysql -uroot -p     接着输入密码

    2、登陆mysql成功之后输入:

      alter user 'root'@'localhost' identified by 'root' password expire never;

      alter user 'root'@'localhost' identified with mysql_native_password by 'root'

      flush privileges;

      其中root为mysql密码

完美解决

 


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM