4

I am currently trying to create a web application with Python's Django framework, while creating the databases through MySQL. I am running Windows 10, Django 2, Python3.6, and MySQL 8. I have tried many fixes but nothing seems to work. When I try to run test cases or run the server locally, I receive the same error: django.db.utils.OperationalError: (2059, "Authentication plugin 'caching_sha2_password' cannot be loaded: The specified module could not be found.\r\n")

Ulysse BN
  • 10,116
  • 7
  • 54
  • 82

2 Answers2

2

This problem occurs with MySQL 8 version, Either use MySQL 5.7 or use official driver from https://dev.mysql.com/downloads/connector/python/ instead of using MySQL API driver from django https://docs.djangoproject.com/en/2.0/ref/databases/#mysql-db-api-drivers site.

nandal
  • 2,544
  • 1
  • 18
  • 23
2

You can run the MySql (>=8.0) container with the following as the command to be executed (actually, as a parameter for entrypoint.sh):

--default-authentication-plugin=mysql_native_password

For example,

docker run --rm -d -e MYSQL_DATABASE=test -e MYSQL_ROOT_PASSWORD=password mysql/mysql-server:latest --default-authentication-plugin=mysql_native_password

(Found the solution here.)

Berci
  • 544
  • 1
  • 7
  • 10