DEV Community

SQLSTATE[HY000] [2002] Connection refused

aleeshapjohn on December 26, 2018

Hi, I am using xampp server to run my php laravel application. I used the command 'php artisan migrate' for migration and I am getting this error: ...
Collapse
 
felipetiburcio profile image
Felipe Tiburcio • Edited

You may follow another abordation, run the docker-compose with postgres and pgadmin for interface:

version: '3.3'
services:
  db:
    image: postgres:11.2
    ports:
      - 12345:5432
    volumes:
      - ./volume:/var/lib/postgresql
    environment:
      POSTGRES_DB: test
      POSTGRES_USER: postgres
      POSTGRES_PASSWORD: 1234
    networks:
      - development-network
  app:
    image: dpage/pgadmin4
    links:
      - db:db
    ports:
      - 90:80
    environment:
      PGADMIN_DEFAULT_EMAIL: "local@email.com"
      PGADMIN_DEFAULT_PASSWORD: "1234"
    depends_on:
      - db
    networks:
      - development-network
networks:
  development-network:
    driver: bridge

And configure as follow

DB_CONNECTION=pgsql
DB_HOST=0.0.0.0
DB_PORT=12345
DB_DATABASE=test
DB_USERNAME=postgres
DB_PASSWORD=1234
Collapse
 
tirthpatel1 profile image
Tirth Patel

Hey, I'm having the same error. I tried everything from changing my .env to re-installing everything up. But nothing seems to work for me. Did anyone find any solution?

Collapse
 
nux99 profile image
Nuga

Are you sure you activated the xampp?

Collapse
 
aleeshapjohn profile image
aleeshapjohn

yes i did

Collapse
 
nux99 profile image
Nuga

Hmmmm.... maybe you should setup like the first time you did the project