Forums

Django manage.py Access Denied Error, but Website Works Fine

Getting the following error message when running 'python manage.py' commands in console:

django.db.utils.OperationalError: (1045, "Access denied for user 'stevetone'@'ip-xxxxxxxxxx.ec2.internal' (using password: YES)")

Normally I would think that it indicates a db password error, but the application is working fine; it's just the manage command that is failing. Both use the same settings file that contains the database connection info.

Using Django 1.10, Python 2.7. Strangely, when I change back to an old Django 1.7 virtual env, the command works.

Anyone have an idea what I need to correct?

This might have something to do with my "real" db user name, the one with the ip address appended. When I run the following command to check privileges:

select user, host from mysql.user;

I get a similar error.

I think I am on to a solution. Never mind :)

For anyone running into this, if you are using environmental variables to set your DB password, and you change the password, you need to change the value in 2 places. I had only changed it in the settings file.

Thanks for posting that! Another useful resource for anyone else who runs into this is this help page about using environment variables for web app credentials.