im trying to connect Mysql with django using docker, and i get this error
2061, 'RSA Encryption not supported - caching_sha2_password plugin was built with GnuTLS support'.
i tried changing user and creating a database with
// create a user //
CREATE USER 'user'@'localhost' IDENTIFIED BY 'user';
GRANT ALL PRIVILEGES ON *.* TO 'user'@'localhost' WITH GRANT OPTION;
CREATE USER 'user'@'%' IDENTIFIED BY 'user';
GRANT ALL PRIVILEGES ON *.* TO 'user'@'%' WITH GRANT OPTION;
// create a database //
CREATE DATABASE user_db;
BUT still the sqme error message
in the settings.py
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.mysql',
'NAME': 'user_db',
'USER': 'user',
'PASSWORD': 'user',
'HOST': 'db',
'PORT': '3306',
}
}
and in docker-compose:
db:
image: mysql:latest
environment:
MYSQL_DATABASE: 'user_db'
MYSQL_USER: 'user'
MYSQL_PASSWORD: user
MYSQL_ROOT_PASSWORD: root
volumes:
- ./data/mysql/db:/var/lib/mysql
ports:
- 3306:3306
thank you for your help.
I have solved this changing the conector to mysql-connector-python==8.0.26 instead mysqlclient==2.0.3
Also, connection settings
DATABASES = {
'default': {
#'ENGINE': 'django.db.backends.mysql',
'ENGINE': 'mysql.connector.django',
'NAME': getenv('MYSQL_DATABASE'),
'USER': getenv('MYSQL_USER'),
'PASSWORD': getenv('MYSQL_PASSWORD'),
'HOST': 'db',
'PORT': getenv('MYSQL_PORT', 3306),
'OPTIONS': {
'auth_plugin': 'mysql_native_password'
}
}
}