Hi guys,
I can’t use Django with MySQL. I tried and searched a lot of related articles but still couldn’t.
I tried with “Shell”, “Docker” but still failed.
My code here:
.gitlab-ci.yml
image: python:2.7.15
services:
- mysql:latest
variables:
MYSQL_DATABASE: ${MYSQL_DATABASE}
MYSQL_ROOT_PASSWORD: ${MYSQL_ROOT_PASSWORD}
cache:
paths:
- .cache/pip
- venv/
stages:
- build
- test
before_script:
- python -V # Print out python version for debugging
- pip install -r req.txt
Build:
stage: build
script:
- python manage.py test --pattern="sign_in.py"
settings.py
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.mysql',
'NAME': 'ipc_management',
'USER': os.environ.get('MYSQL_USER'),
'PASSWORD': os.environ.get('MYSQL_PASSWORD'),
'HOST': 'mysql'
}
}
If I use python, I can not use MySQL.
errors:
It’s mariadb not mysql
django.db.utils.OperationalError: (2059, “Authentication plugin ‘caching_sha2_password’ cannot be loaded: /usr/lib/x86_64-linux-gnu/mariadb18/plugin/caching_sha2_password.so: cannot open shared object file: No such file or directory”)