Django+MySQL - “无法加载身份验证插件‘caching_sha2_password’”

Eya*_*lan 7 python mysql django mysql-connector python-3.x

运行命令时:python manage.py runserver我收到以下错误:

django.db.utils.OperationalError: (2059, "Authentication plugin 'caching_sha2_password' cannot be loaded: The specified module could not be found.\r\n")
Run Code Online (Sandbox Code Playgroud)

这些是相关设置:

DATABASES = {
    'default': {
        'ENGINE': 'django.db.backends.mysql',
        'NAME': 'polls',
        'USER': 'root',
        'PASSWORD': '<my-password>',
        'HOST': 'localhost'
    }
}
Run Code Online (Sandbox Code Playgroud)

我已经看到了解决问题的解决方案,例如在这个线程中。他们建议将引擎更改为mysql.connector.django,但是 django 推荐的引擎是mysqlclient,因此我想使用它。其他建议是使用 naive password 而不是 sha2。出于安全原因,我宁愿不使用此解决方案。

版本:

  • mysql 8.0.17 for Win64 on x86_64 (MySQL Community Server - GPL)
  • 蟒蛇 3.7.4
  • Django 2.2.4
  • mysql客户端 1.4.4