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
本文解决了一种常见的MySQL8.0数据库连接错误,即因默认密码模式为caching_sha2_password导致的问题。通过调整密码模式为mysql_native_password,并在my.cnf中设置default_authentication_plugin,成功解决了SQLAlchemy无法连接数据库的难题。
1240

被折叠的 条评论
为什么被折叠?



