Skip to content

Instantly share code, notes, and snippets.

@nickretallack
Created April 20, 2017 22:37
Show Gist options
  • Save nickretallack/a60e73c59659ad2926c7d726926f4159 to your computer and use it in GitHub Desktop.
Save nickretallack/a60e73c59659ad2926c7d726926f4159 to your computer and use it in GitHub Desktop.
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.mysql',
'HOST': 'localhost',
'NAME': 'db',
'USER': 'root',
'PASSWORD': '',
'OPTIONS': {
'charset': 'utf8mb4',
'init_command': 'set collation_connection=utf8mb4_unicode_ci',
},
},
}
$ ./manage.py shell
>>> from django.db import connection
>>> cursor = connection.cursor()
>>> cursor.execute("show variables like 'collation_connection'")
>>> print cursor.fetchall()
((u'collation_connection', u'utf8mb4_general_ci'),)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment