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

运行命令: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")

这些是相关设置:

DATABASES = {
    'default': {
        'ENGINE': 'django.db.backends.mysql',
        'NAME': 'polls',
        'USER': 'root',
        'PASSWORD': '<my-password>',
        'HOST': 'localhost'
    }
}

我已经看到解决该问题的解决方案,例如this thread。他们建议将引擎更改为mysql.connector.django,但是django推荐的引擎是mysqlclient,因此我想使用它。
其他建议是use naive password instead of sha2。出于安全原因,我宁愿不使用该解决方案。

版本:

适用于x86_64上Win64的mysql 8.0.17(MySQL Community Server-GPL)
python 3.7.4
Django 2.2.4
mysqlclient 1.4.4

参考方案

尝试

ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY '<my-password>';

当单击更改密码为空白页但密码已更改时django - python

我创建登录页面。我的问题是“忘记密码”。用户输入邮件,django发送带有链接的消息。单击时必须更改密码。完成后,单击“更改密码”,我们将在下一页上移动,但该页面为空白。但是密码已更改。account / urls.pyfrom django.urls import path, reverse_lazy from django.contrib.auth im…

django-compressor未与django-shop一起安装 - python

我无法使用django-shop安装django-compressor。出现这样的错误。Failed building wheel for rcssmin ================================= Failed building wheel for rjsmin -----------------------------------…

R'relaimpo'软件包的Python端口 - python

我需要计算Lindeman-Merenda-Gold(LMG)分数,以进行回归分析。我发现R语言的relaimpo包下有该文件。不幸的是,我对R没有任何经验。我检查了互联网,但找不到。这个程序包有python端口吗?如果不存在,是否可以通过python使用该包? python参考方案 最近,我遇到了pingouin库。

如何用'-'解析字符串到节点js本地脚本? - python

我正在使用本地节点js脚本来处理字符串。我陷入了将'-'字符串解析为本地节点js脚本的问题。render.js:#! /usr/bin/env -S node -r esm let argv = require('yargs') .usage('$0 [string]') .argv; console.log(argv…

Django表单;使用ModelForm覆盖选择 - python

我想做的是根据页面隐藏或显示一些选择。例如,models.pyUSA = 'usa' FRANCE = 'france' CHINA = 'china' GERMANY = 'germany' SPAIN = 'spain' TOPICS = ( (USA, …