DJango pick Operating system username instead of user name present in settings file

Question:

About the issue

I created the project using command django-admin startproject test and updated the settings file to have mysql database details. Apart from that nothing added/updated/deleted in code.

Database details in config file

DATABASES = {
    'default': {
        'ENGINE': 'django.db.backends.mysql',
        "Name": "django",
        "User": "root",
        "Password": "",
        "Host": "localhost",
        "Port": "3306"
    }
}

Then ran the command python manage.py runserver and gave me very strange error.

It says Access denied for user pankaj@localhost

Question

Settings file has username = root, why django pick operating system username

enter image description here

Asked By: Pankaj

||

Answers:

Django settings names must be all uppercase.

DATABASES = {
    'default': {
        'ENGINE': 'django.db.backends.mysql',
        "NAME": "django",
        "USER": "root",
        "PASSWORD": "",
        "HOST": "localhost",
        "PORT": "3306"
    }
}
Answered By: Dauros
Categories: questions Tags: ,
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.