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