1. 程式人生 > 實用技巧 >Navicat12版本連線,MySQL8.0版本,連接出現 Authentication plugin 'caching_sha2_password' cannot be loaded

Navicat12版本連線,MySQL8.0版本,連接出現 Authentication plugin 'caching_sha2_password' cannot be loaded

1、在使用Navicat Premium 12,連線MySQL8.0版本資料庫時會出現Authentication plugin 'caching_sha2_password' cannot be loaded的錯誤。

  出現這個問題的原因是mysql8.0版本之前的版本中加密規則是mysql_native_password,而在mysql8之後,加密規則是caching_sha2_password。

  解決問題的方法有兩種,一種是升級navicat驅動,另一種是把mysql使用者登入密碼加密規則還原成mysql_native_password。

2、此處,使用第二種解決方法,如下所示:

1
ALTER USER 'root'@'localhost' IDENTIFIED BY 'password' PASSWORD EXPIRE NEVER; #修改加密規則 2 3 ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'password'; #更新一下使用者的密碼

具體操作,如下所示:

然後,重新整理許可權並重置密碼,FLUSH PRIVILEGES; #重新整理許可權。

1 FLUSH PRIVILEGES;  -- 重新整理許可權
2 
3 alter user '
root'@'localhost' identified by 'password'; -- 重置密碼命令

此時,再次使用Navicat Premium 12連線MySQL8.0資料庫就會發現,可以連線成功了。