django - Why do I get this error while running django project even after adding mysql to settings?
问题描述
When I try to run the django project, I get this error:
django.db.utils.OperationalError: (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")
解决方案
这似乎是一个数据库错误。您的数据库设置为caching_sha2_password
用作身份验证插件。您需要从您的 mysql 配置中更改它。
在您的 mysql 配置文件中,您可能需要更改default_authentication_plugin
参数:
[mysqld]
default_authentication_plugin=mysql_native_password
您需要重新启动 mysql 服务器才能使此更改生效。
您也可以使用以下 sql 语句由用户更改它:
ALTER USER 'user'@'host' IDENTIFIED WITH mysql_native_password BY 'password';
如果您不依赖 mysql,您可以将数据库引擎更改为 sqlite 并运行项目。如果没有编码错误,它应该可以顺利运行。解决 mysql 问题后,您可以切换回 mysql 后端。
推荐阅读
- docker - 如何查看 docker 容器的实时调试日志
- vb.net - 如何从 AS3 和 VB.NET 获得相同的 MD5 哈希?已经有代码了,不能用
- python - Python keras:多标签值的 to_categorical 给出 ValueError: invalid literal for int() with base 10
- matlab - “mexschurfun.mexmaci64”无法打开,因为无法验证开发者
- c++ - CRTP 和静态成员初始化
- mysql - 获取百分比计算并更新列
- html - CSS Grid 自动流密集只改变窄元素的流
- excel - Excel - 如何将 70 个项目的值平均分成 6 组
- javascript - 从 Thymeleaf 到 JavaScript 的布尔值问题
- spring-cloud - 使用 Feign、Ribbon 和 Eureka 管理容错