I am trying to dockerise my Django app.
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
When I run docker-compose -up
, I get the following error.
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')
Upon searching, I found the solution was to use command: --default-authentication-plugin=mysql_native_password
or downgrade mysql. Tried the first command but it’s not working. I don’t want to downgrade as well.
How do I get it to work?
Additional details:
- Using Docker on Windows.
- Distro: Ubuntu 20.04 LTS (WSL2).
- Connector: mysqlclient==1.4.6.
2
Answers
Stopping the container using
docker-compose down
and then restarting them did the trick. I was using CTRL + C prior to that.your error is showing you require mariadb plugin. Please verify again