2059, “Authentication plugin ‘caching_sha2_password’ cannot be loaded: /usr/lib64/mysql/plugin/caching_sha2_password.so: cannot open shared object file: No such file or directory”
今天用sqlalchemy連接mysql8.0數據庫,一直報錯,記錄下解決方案
系統默認密碼模式是caching_sha2_password
如需修改密碼:必須使用mysql_native_password
select user,plugin from user;
然後用下面sql重置下密碼,就可以連接了
alter user 'bittorrent'@'%' identified with mysql_native_password by 'bittorrent';
commit;
當然了,爲了防止下次修改密碼,導致加密模式變化,就是在my.cnf添加
#設置mysql 8.0 的加密方式爲 mysql_native_password (默認爲:caching_sha2_password)
default_authentication_plugin=mysql_native_password