0

I'm trying to learn and exercise with postgres.

I'm running on Ubuntu 16.04.

I installed Postgres docker and run it with the following command:

sudo docker run --rm   --name pg-docker -e POSTGRES_PASSWORD=docker -d -p 5433:5433 -v $HOME/amitliron/UserA/docker/volumes/postgres:/var/lib/postgresql/data  postgres

(I'm using 5433 port, becuse when trying to use 5432 port I'm getting the following error: Error starting userland proxy: listen tcp 0.0.0.0:5432: bind: address already in use, I think it's not need to be problem, but writing here everying I did)

I'm trying to check the postgres docker with the following command:

psql -h localhost -U postgres -d postgres

and entered the password: "docker" but I'm getting the following error:

Password for user postgres: 
psql: FATAL:  password authentication failed for user "postgres"
FATAL:  password authentication failed for user "postgres"

What am I missing ?

1
  • 3
    Hmm, listen tcp 0.0.0.0:5432: bind: address already in use might indicate another Postgres is already running? And psql tries to connect to it. Try to specify the port to psql with the -p flag: psql -h localhost -p 5433 -U postgres -d postgres Commented Feb 19, 2020 at 12:36

1 Answer 1

1

I needed to specify the port:

psql -h localhost -p 5433 -U postgres -d postgres 
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.