Skip to content

Instantly share code, notes, and snippets.

@leihuagh
Created December 14, 2018 19:54
Show Gist options
  • Save leihuagh/fa279e95fd103b1fe4751e20021ccf43 to your computer and use it in GitHub Desktop.
Save leihuagh/fa279e95fd103b1fe4751e20021ccf43 to your computer and use it in GitHub Desktop.
django connect to mysql
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.mysql',
'NAME': '<database name>',
'USER': '<username>',
'PASSWORD': '<password>',
'HOST': 'localhost',
'PORT': '3306',
'OPTIONS': {
'init_command': 'SET innodb_strict_mode=1',
'sql_mode': 'STRICT_TRANS_TABLES',
'charset': 'utf8mb4'
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment