T
Twenty7d ago
Farrit

Server is unable to connect to db

Hey guys! I am trying to just get this running up on the default settings, minus password and secret key, and it keeps telling me in the consoles for both the DB and the server that postgres is not a valid user. I'm at a loss. (It doesn't help that I'm fairly new at this...) My server logs are: Running database setup and migrations... psql: error: connection to server at "db" (172.22.0.3), port 5432 failed: FATAL: password authentication failed for user "postgres" Running database setup and migrations... psql: error: connection to server at "db" (172.22.0.3), port 5432 failed: FATAL: password authentication failed for user "postgres" My DB logs are: 2025-05-12 18:13:20.006 UTC [310] DETAIL: Connection matched file "/var/lib/postgresql/data/pg_hba.conf" line 128: "host all all all scram-sha-256" 2025-05-12 18:14:20.431 UTC [408] FATAL: password authentication failed for user "postgres" 2025-05-12 18:14:20.431 UTC [408] DETAIL: Connection matched file "/var/lib/postgresql/data/pg_hba.conf" line 128: "host all all all scram-sha-256" 2025-05-12 18:15:20.839 UTC [498] FATAL: password authentication failed for user "postgres" 2025-05-12 18:15:20.839 UTC [498] DETAIL: Connection matched file "/var/lib/postgresql/data/pg_hba.conf" line 128: "host all all all scram-sha-256" 2025-05-12 18:15:27.351 UTC [28] LOG: checkpoint starting: time 2025-05-12 18:15:27.367 UTC [28] LOG: checkpoint complete: wrote 3 buffers (0.0%); 0 WAL file(s) added, 0 removed, 0 recycled; write=0.004 s, sync=0.002 s, total=0.017 s; sync files=2, longest=0.001 s, average=0.001 s; distance=0 kB, estimate=0 kB; lsn=0/1B6E4D0, redo lsn=0/1B6E498
No description
7 Replies
Prastoin
Prastoin7d ago
Hello @Farrit, just to be sure you've started the containers once with default value and then you updated both the password and username ? You're not the first one that has the issue I haven't been able to reproduce exactly
Farrit
FarritOP7d ago
I downloaded the .env, updated the username/pass in there, then downloaded the docker-compose.yml, and then did the compose up -d I was trying to follow the guilde step by step @ https://twenty.com/developers/section/self-hosting/docker-compose just can't seem to get step 4 to work 😅 If I try the one-line script option, I get this spit back at me
farrit@farritserver:/mnt/twenty$ sudo bash <(curl -sL https://git.new/20) bash: /dev/fd/63: No such file or directory
Prastoin
Prastoin5d ago
Hey @Farrit, maybe you created the database using the default password which is persisted in the initialy created volume In order to udpate the pg_password and update it you need to remove the volumes using
docker-compose down -v
docker-compose down -v
Recommended in development only as /!\ Be aware that this will wipe your database /!\ In production would have to connect and do a role swap
Farrit
FarritOP5d ago
I will give this a try today. Thank you! Quick q- when looking at the terminal logs for the DB, it says it's listening on IP 0.0.0.0:3000, shouldn't that be 127.0.0.1:3000 if it's set to localhost? Could that be why the server isn't able to communicate to the backend?
Prastoin
Prastoin5d ago
You mean the server unable to reach the db ? Where do you find such a log exactly ?
Farrit
FarritOP5d ago
Using portainer to read the output of the terminal in that container
Prastoin
Prastoin5d ago
I don't think that should be an issue, have you been able to remount to volumes in order to fix the invalid auth issue ?

Did you find this page helpful?