Error: P1001: Can't reach database server at `localhost`:`5432`
I have a probleme to connect to the postgres on docker.
I have the env ::
DATABASE_URL="postgresql://postgres:123@localhost:5432/nest?schema=public"
and the docker-compose ::
version: '3.8' services: dev-db: image: postgres:13 ports: - 5434:5432 environment: POSTGRES_USER: postgres POSTGRES_PASSWORD: 123 POSTGRES_DB: nest networks: - freecodecamp networks: freecodecamp:
I do on the terminal ::
npx prisma migrate dev
i have ::
Error: P1001: Can't reach database server at localhost:5432
Hi @righes As far as I can tell, you seem to be using the wrong port in your code. inside your docker configuration you have specified port 5434 as the external port for the DB container whereas in your code, you are using port 5432 to connect to the DB