FATAL: password authentication failed for user "root" postgresql even with correct password

274 Views Asked by At

I'm following a tutorial and it had some docker involved. I started a postgres instance by using

docker run --name postgres12 -p 5432:5432 -e POSTGRES_USER=root -e POSTGRES_PASSWORD=secret -d postgres:12-alpine

This command run successfully but then I tried to connect with this database through TablePlus in the picture below.

Connect with db through TablePlus

I can make sure that I the password I typed is secret and the exact docker container was running but I always got the error.

Fatal:  password authentication failed for user "root"

I tried re-type the password to make sure that it's secret - the correct one. I also stop and remove the running container and run the docker run command above several times but it's still not working.

I also access the pg_hba.conf (in the picture below) and change all the METHOD to trust, then restart the container but still got the same error.

pg_hba.conf

Anyone have any ideas why this happen? Thanks in advance.

0

There are 0 best solutions below