Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Postgres: Password authentication failed for user "user". Role "user" does not exists

I'm using Django created with the template cookie-cutter. When I try to run the project with docker locally it gives me the following error.

FATAL: password authentication failed for user "user"
DETAIL: Role "user" does not exist.

But the role "user" exists. Using the command postgres=# \du gives me the role "user"

I have a .env file with the recommended configuration by cookie cutter. POSTGRES_PASSWORD=password POSTGRES_USER=user

I tried giving the user a password and granting all privileges of the database to the user but doesn't work.

like image 564
Alejandro Maguey Avatar asked Nov 28 '25 01:11

Alejandro Maguey


1 Answers

Usually connection problems are due to:

postgresql.conf not having the listen_addresses set correctly or the pg_hba.conf not having correct values.

It often helps to increase postgresql logging in postgresql.conf to watch what happens when connecting

log_min_duration_statement = 0 ## logs all statements

You could also try at cmd prompt: pg_isready -d dbname -U user

like image 64
Slumdog Avatar answered Nov 29 '25 18:11

Slumdog



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!