連接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