Last Updated: February 25, 2016
·
3.919K
· Rei Ayanami

MySQL use unix socket in Django settings

Django docs suggest "HOST" field hackery, but there's much cleaner way:

DATABASES = {
    "default": {
        "ENGINE": "django.db.backends.mysql",
        # ...
        "OPTIONS": {
            "unix_socket": "/tmp/mysql-dev.sock",
        }
    }
}