Forums

manage.py migrate access denied for user

Hi, I'm following the django tutorial here https://docs.djangoproject.com/en/1.10/intro/tutorial02/, and am trying to follow the step 'python manage.py migrate'. However, I get this error:

django.db.utils.OperationalError: (1044, "Access denied for user 'cs411spring2017'@'%' to database 'cs411spring2017$cs411'")

My settings are:

DATABASES = {
    'default': {
        'ENGINE': 'django.db.backends.mysql',
        'NAME': '<username>$<database-name>',
        'USER': '<username>',
        'PASSWORD': '<password>',
        'HOST': '<username>.mysql.pythonanywhere-services.com',
    }
}

I have managed to log in through the bash console using mysql -u <username> -p <password> commands. I've also googled and searched through the previous posts with similar issues, but none of the solutions have worked.

Okay nevermind it works now, my database name had a wrong capitalization haha.

Ah, that would explain it. Glad you worked it out :-)

I have the same problem and cannot fix it ((( Is there anything that I should do in the python MySQL command line? Please help anybody (

Make sure that you have all the connection details that are on the Databases page correct.

I already solved it but it took a whole day :( The problem was that I wrote the database name only in the settings, but seems the database_name becomes like user$database_name which is unexpected for me :) Thanks!