Forums

password authentication failed (postgres)

Hello, I am attempting to login into the admin page for my site and am getting this 'password authentication failed' error. I followed the tutorial on your Help page entitled 'Configuring postgres for your app (eg Django)'. On my 'Databases' tab, I am able to start a Postgres console. I am using the user and password for my app, which I assume I'm supposed to use instead of the user and password for the Superuser (I also tried the Superuser name and password too). Do I need to change my password for the app to all lower case and no symbols? If so, how do I change my app password? Thank you.

Could you provide us with more details? What makes you think that Django admin password is the same that your postgres password?

Thanks, it helps to be clear that the Django admin password is different than the postgres password. When I go to https://www.honeone.one/admin and used the postgres login (which I realize is incorrect now), I got this error: django.db.utils.OperationalError: connection to server at "mbak000-3932.postgres.pythonanywhere-services.com" (10.0.0.216), port 13932 failed: FATAL: password authentication failed for user "postgres". I then went to the console and tried to create a superuser for the admin using the command 'python manage.py createsuperuser' and got the same error.

one moment, i am making progress... (i had the incorrect database login info in my settings.py file)

I created a superuser for my project and when i login to the admin site using this superuser login, i receive the following error message: psycopg2.OperationalError: connection to server at "mbak000-3932.postgres.pythonanywhere-services.com" (10.0.0.216), port 13932 failed: FATAL: password authentication failed for user "postgres" connection to server at "mbak000-3932.postgres.pythonanywhere-services.com" (10.0.0.216), port 13932 failed: FATAL: password authentication failed for user "postgres". to my knowledge, my username for my project is mbak000, my superuser username for the database is super, and my username for the database (for the app) is postgres.

I think there is a problem connecting to my postgres database. In my settings.py file (which uses a .env file), do I put in the database username and password for the superuser (superuser name is super) or do I put in the database username and password for the app (name is postgres). I have tried both and neither seems to work (i get the error in the previous comment above).

I see on the help document that I should put in the username and password for my app user. I am doing that and getting this connection error.

Unable to access database using app user when I use this command 'psql -h mbak000-3932.postgres.pythonanywhere-services.com -p 13932 -U your_db_user -d your_db_name'. So, it seems the problem is with the app user password.

It works now! I changed the app user password to all lower case and it worked after that. It would help future users to include this tip in the help document as other users have gone through this same problem before. The help page is: https://help.pythonanywhere.com/pages/PostgresGettingStarted

Glad you finally got that working!

Please note I am not an expert but I would like to add more specific context for this error and how to solve it for anybody else because after reading this thread it still took me awhile to figure it out.

1) database names have to be all lowercase 2) user names have to be all lowercase 3) passwords have to be all lowercase

There may be more to it than this but this is what let me finally connect after an hour of being super confused.

Take look at https://www.postgresql.org/docs/current/sql-syntax-lexical.html#SQL-SYNTAX-IDENTIFIERS

Quoting an identifier also makes it case-sensitive, whereas unquoted names are always folded to lower case. For example, the identifiers FOO, foo, and "foo" are considered the same by PostgreSQL, but "Foo" and "FOO" are different from these three and each other.

That might be the source of confusion.