0

I want to set the mysql database using mysql-connector-python for setting up a web site made with Django using a database backend but I get this error:

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'

My credentials (name, user, password, host, port) works fine, so the problem isn't here.

DATABASES = {
    'default': {
        'ENGINE':   'mysql.connector.django',
        'NAME':     'library',
        'USER':     'username',
        'PASSWORD': 'password',
        'HOST':     '127.0.0.1',
        'PORT':     '3306',
        'OPTIONS': {
            'autocommit': True,
            'use_pure': True,
        },
    }
}

I'm using python 3.8.5 and mysql-connector-python 8.0.21 and I understand that mysql-connector-python, starting from version 8.0.13, has a bug, which makes it impossible to use with Django and to avoid the bug I added ‘use_pure’: True in database options. But it doesn't work.

I found this question but it doesn't say anything about using ‘use_pure’: True.

If the mysql-connector-python isn't compatible with python 3, what can I use instead? (I can't wait for the support release).

3
  • Is there a reason you are not using 'ENGINE': 'django.db.backends.mysql' like the Django docs suggest ? Commented Sep 24, 2020 at 12:26
  • @Ralf, I tried this but it works only local. If I try to push it to my webpage and use it remotely I receive error messages. Commented Sep 24, 2020 at 12:42
  • Hi. Support for Django 3.0 and 3.1 (with Python 3) will be released soon with a new version of Connector/Python. Commented Oct 6, 2020 at 11:18

1 Answer 1

0

you do not have the option to use mysql connector, you have to install mysql-client from https://www.lfd.uci.edu/~gohlke/pythonlibs/#mysqlclient and try installing all the wheels incase you get errors, while installing using pip install

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.