1

So, I was re-configuring my SQL and decided to move back from my.conf to settings.py (context: https://docs.djangoproject.com/en/3.2/ref/databases/#mysql-notes)

'read_default_file': '/path/to/my.cnf',

# my.cnf
[client]
database = NAME
user = USER
password = PASSWORD
default-character-set = utf8

So I was shifting from my.conf to settings.py I got an error

TypeError: 'default-character-set' is an invalid keyword argument for connect

My code:

'Options':{
      'default-character-set': utf8
      }

1 Answer 1

1

The option is charset

'Options':{
    'charset': 'utf8mb4'
}
Sign up to request clarification or add additional context in comments.

3 Comments

Why it's different from the one in my.cnf?
as you error smessage stated, your option 'default-character-set' is not known, mybe it is because of the added white space, but i couldn't find any mention that such option exists, mine does, so use it and program after your hearts ontent
Using charset does work for me. I have tried removing the spaces it didn't work

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.