【问题标题】:'caching_sha2_password' plugin failing on Windows [duplicate]'caching_sha2_password'插件在Windows上失败[重复]
【发布时间】:2018-10-29 04:40:02
【问题描述】:

我目前正在尝试使用 Python 的 Django 框架创建一个 Web 应用程序,同时通过 MySQL 创建数据库。我正在运行 Windows 10、Django 2、Python3.6 和 MySQL 8。我尝试了很多修复,但似乎没有任何效果。当我尝试在本地运行测试用例或运行服务器时,我收到相同的错误:django.db.utils.OperationalError: (2059, "Authentication plugin 'caching_sha2_password' cannot be load: The specified module could not be found.\r \n")

【问题讨论】:

  • 有人有解决这个问题的办法吗?

标签: python mysql django windows web


【解决方案1】:

MySQL 8 版本出现此问题, 要么使用 MySQL 5.7,要么使用来自 https://dev.mysql.com/downloads/connector/python/ 的官方驱动程序,而不是使用来自 django https://docs.djangoproject.com/en/2.0/ref/databases/#mysql-db-api-drivers 站点的 MySQL API 驱动程序。

【讨论】:

    【解决方案2】:

    您可以运行 MySql (>=8.0) 容器,将以下内容作为要执行的命令(实际上是作为 entrypoint.sh 的参数):

    --default-authentication-plugin=mysql_native_password
    

    例如,

    docker run --rm -d -e MYSQL_DATABASE=test -e MYSQL_ROOT_PASSWORD=password mysql/mysql-server:latest --default-authentication-plugin=mysql_native_password
    

    (找到解决方案here。)

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2016-12-03
      • 2018-10-16
      • 1970-01-01
      • 2014-02-24
      • 2020-03-23
      • 2013-05-11
      • 2018-11-20
      相关资源
      最近更新 更多