Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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+.

like image 958
alstr Avatar asked Mar 30 '20 09:03

alstr


2 Answers

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.

like image 161
obotezat Avatar answered Oct 04 '22 16:10

obotezat


Connector/Python still supports Python 2.7, which was dropped by Django 3. We are currently working on adding support for Django 3, stay tunned.

like image 28
Nuno Mariz Avatar answered Oct 04 '22 15:10

Nuno Mariz