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


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

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

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

It says Access denied for user [email protected]


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

enter image description here

Asked By: Pankaj



Django settings names must be all uppercase.

    '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.