Skip to content
Advertisement

Django 3.x error: ‘mysql.connector.django’ isn’t an available database backend

Having recently upgraded a Django project from 2.x to 3.x, I noticed that the mysql.connector.django backend (from mysql-connector-python) no longer works. The last version of Django that it works with is 2.2.11. It breaks with 3.0. I am using mysql-connector-python==8.0.19.

When running manage.py runserver, the following error occurs:

django.core.exceptions.ImproperlyConfigured: 'mysql.connector.django' isn't an available database backend.
Try using 'django.db.backends.XXX', where XXX is one of:
    'mysql', 'oracle', 'postgresql', 'sqlite3'

I am aware that this is not an official Django backend but I have to use it on this project for reasons beyond my control.

I am 80% sure this is an issue with the library but I’m just looking to see if there is anything that can be done to resolve it beyond waiting for an update.

UPDATE:

mysql.connector.django now works with Django 3+.

Advertisement

Answer

For Django 3.0 and Django 3.1 I managed to have it working with mysql-connector-python 8.0.22. See this https://dev.mysql.com/doc/relnotes/connector-python/en/news-8-0-22.html.

User contributions licensed under: CC BY-SA
4 People found this is helpful
Advertisement