【问题标题】:Plugin caching_sha2_password could not be loaded: /mariadb19/plugin/caching_sha2_password.so: cannot open shared object file无法加载插件缓存_sha2_password:/mariadb19/plugin/caching_sha2_password.so:无法打开共享对象文件
【发布时间】:2021-01-29 19:11:46
【问题描述】:

我正在尝试 dockerise 我的 Django 应用程序。

docker-compose.yml

version: "3.8"

services:
  db:
    image: mysql:8
    command: --default-authentication-plugin=mysql_native_password # this is not working
    restart: always
    environment:
      MYSQL_ROOT_PASSWORD: rootmypass
    ports:
      - '3306:3306'
  cache:
    image: redis
    environment:
      REDIS_HOST: localhost
      REDIS_PORT: 6379
    ports:
      - '6379:6379'
  web:
    build: .
    command: python manage.py runserver 0.0.0.0:8000
    volumes:
      - .:/code
    ports:
      - "8000:8000"
    depends_on:
      - db
      - cache

当我运行docker-compose -up 时,我收到以下错误。

django.db.utils.OperationalError: (1156, 'Plugin caching_sha2_password could not be loaded: /usr/lib/x86_64-linux-gnu/mariadb19/plugin/caching_sha2_password.so: cannot open shared object file: No such file or directory')

经过搜索,我发现解决方案是使用command: --default-authentication-plugin=mysql_native_password 或降级mysql。尝试了第一个命令,但它不起作用。我也不想降级。

如何让它工作?

其他详情:

  • 在 Windows 上使用 Docker。
  • 发行版:Ubuntu 20.04 LTS (WSL2)。
  • 连接器:mysqlclient==1.4.6。

【问题讨论】:

标签: mysql django linux docker


【解决方案1】:

使用docker-compose down 停止容器然后重新启动它们就可以了。在此之前我使用的是 CTRL + C。

【讨论】:

  • 我觉得应该是docker-compose down
  • 这对我没有帮助
  • 不确定为什么,我只运行了 docker compose down 和 docker compose up,它可以工作!谢谢!
【解决方案2】:

您的错误显示您需要 mariadb 插件。请再次验证

【讨论】:

    猜你喜欢
    • 2015-05-23
    • 2011-12-23
    • 2013-04-21
    • 2013-05-05
    • 1970-01-01
    • 2016-05-11
    • 1970-01-01
    • 1970-01-01
    • 2017-05-21
    相关资源
    最近更新 更多