MySQL主從複製報錯Authentication

系統資料庫使用主從配置時,發現今天開始,從庫並沒有同步主從上的日誌,在從庫上執行 show slave status;

顯示報錯:

Last_IO_Error: error connecting to master ‘repl@127。0。0。1:3306’ - retry-time: 60 retries: 2 message: Authentication plugin ‘caching_sha2_password’ reported error: Authentication requires secure connection。

考慮到我的MySQL8 ,

檢視主庫:

SELECT plugin FROM `user` where user = ‘repl’;

原來是主庫repl的plugin是caching_sha2_password 導致連線不上,修改為mysql_native_password即可解決。執行以下語句:

ALTER USER ‘repl’@‘%’ IDENTIFIED WITH mysql_native_password BY ‘原先賬戶的密碼’;