【问题标题】:Django+MySQL - "Authentication plugin 'caching_sha2_password' cannot be loaded"Django + MySQL - “无法加载身份验证插件'caching_sha2_password'”
【发布时间】:2019-12-25 16:48:37
【问题描述】:

运行命令时: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。出于安全原因,我宁愿不采用此解决方案。

版本:

  • mysql 8.0.17 for Win64 on x86_64(MySQL 社区服务器 - GPL)
  • python 3.7.4
  • Django 2.2.4
  • mysqlclient 1.4.4

【问题讨论】:

    标签: python mysql django python-3.x mysql-connector


    【解决方案1】:

    试试

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

    【讨论】:

    • 这没有解决原来的问题。
    • 感谢您抽出宝贵时间回答我的问题。但是,我在问题中指出,出于安全原因,我宁愿不使用本机密码解决方案(请参阅最后一段)。
    猜你喜欢
    • 2020-12-07
    • 1970-01-01
    • 2018-10-03
    • 2019-04-14
    相关资源
    最近更新 更多