java.sql.SQLException: Unable to load authentication plugin 'caching_sha2_password'.解决方法


mysql高版本默认的身份验证方式已经发生改变,在项目中中要使用对应版本的mysql连接驱动,特别是针对低版本,比如mysql5.0升级到mysql8.0,对应连接驱动也要升级到mysql8.0。否则就会报错java.sql.SQLException: Unable to load authentication plugin 'caching_sha2_password。

但是若不想更改驱动,依旧想使用mysql5.0的连接驱动,去连接mysql8.0服务器。那么可以在mysql8.0服务器执行以下语句,更改特定连接用户的权限验证方式。

 ALTER USER 'root'@'%' IDENTIFIED WITH mysql_native_password BY 'root';


免责声明!

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



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