'password authentication failed while trying to connect into my docker database
I'm following this tutorial and the guy uses docker with postgres which I've never used honestly. I created a docker-compose.yml file with the following fields:
version: "3.1"
services:
  postgres:
    image: postgres:11-alpine
    restart: always
    environment:
      POSTGRES_USER: actix
      POSTGRES_DB: actix
      POSTGRES_PASSWORD: actix
    ports:
      - 5432:5432
and tried running docker-compose up -d and everything is fine until now. When I try to run psql -h 127.0.0.1 -p 5432 -U actix actix  to access it and put the password (which I've tried doing multiple times so I'm 100% sure it's not a typo) I get this error:
psql: error: connection to server at "127.0.0.1", port 5432 failed: FATAL:  password authentication failed for user "actix"
I've tried googling the error but there is not a unique fix apparently.
What I've tried so far:
- checking if I've messed up the local port by using docker ps
- changing version image
- checking if I have psql (I have psql (PostgreSQL) 14.1)
- tried connecting inside the docker using docker exec -it "name of the docker" bashandpsql -U actixand it does in fact work.
Hope I was clear enough, if I left something out I will provide any additional info you need.
Edit: I've tried creating another postgres container to try and connect and it does work.
I've also tried using the gitbash cli and it doesn't work so that must be a windows problem of some sort.
Edit 2 I solved it. Stopping the PostgreSQL service did the trick.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source | 
|---|
