連接數據庫報錯Unable to load authentication plugin caching_sha2_password

報錯Exception during pool initialization.

java.sql.SQLException: Unable to load authentication plugin 'caching_sha2_password'.

 

報錯與數據庫有關的,應該是從MySQL 8.0.4開始, 默認的認證插件從mysql_native_password 變爲caching_sha2_password

參考https://dev.mysql.com/doc/refman/8.0/en/caching-sha2-pluggable-authentication.html,創建新用戶和密碼

參考sql:
CREATE USER 'sha2user'@'localhost'IDENTIFIED WITH caching_sha2_password BY 'password';

 


 

 

root賬號修改爲caching_sha2_password的任然不行。

 

進入mysql命令行,使用如下命令解決:

ALTER USER 'yourusername'@'localhost' IDENTIFIED WITH mysql_native_password BY 'youpassword';

 

 

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章