1. 程式人生 > 資料庫 >mysql 無法連線提示 Authentication plugin 'caching_sha2_password' cannot be loaded

mysql 無法連線提示 Authentication plugin 'caching_sha2_password' cannot be loaded

 mysql 無法連線提示 Authentication plugin 'caching_sha2_password' cannot be loaded

可能是密碼沒有設定或者,密碼設定型別不符,可參考如下步驟解決

1 檢視當前賬戶,和密碼

select user,host,password from user;

或者是否設定了authentication_string

select user,host,authentication_string,plugin from mysql.user;

2 如果沒有設定,就重置密碼

grant all privileges on *.* to 'yourname'@'localhost' identified by 'yourpassword'

或者對應第二種情況

ALTER USER 'XXXX'@'%' IDENTIFIED WITH mysql_native_password BY 'XXXXXXXX';

3 最後需要重新整理下許可權

flush privilege

4 如果是不重要的使用者名稱,也可以通過新建使用者賦予許可權,

grant all privileges on *.* to 'xxx'@'localhost' identified by 'xxxx' ;