Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Postgresql error- could not connect to server: Connection refused #1092

Closed
sanketraut opened this issue Aug 13, 2017 · 4 comments
Closed

Postgresql error- could not connect to server: Connection refused #1092

sanketraut opened this issue Aug 13, 2017 · 4 comments
Labels

Comments

@sanketraut
Copy link

Info:

  • Docker version ($ docker --version): 1.12.5
  • Laradock commit ($ git rev-parse HEAD): 245ddf3
  • System info (Mac, PC, Linux): PC
  • System info disto/version: Windows 10

Issue:

Whenever I run php artisan migrate inside my workspace, I get an error Could not connect to server. The detailed error is as follows:
[Doctrine\DBAL\Driver\PDOException]
SQLSTATE[08006] [7] could not connect to server: Connection refused
Is the server running on host "localhost" (127.0.0.1) and accepting
TCP/IP connections on port 5432?
could not connect to server: Cannot assign requested address
Is the server running on host "localhost" (::1) and accepting
TCP/IP connections on port 5432?


Expected behavior:

The database connection should be establised and the tables should get created. The success message should be displayed as Migrations ran successfully


Reproduce:

  • Install laradock on Windows 10 using virtualbox
  • Create a shared folder on vbox and mount it to the docker machine from the terminal
    • sudo mkdir mountedfolder
    • sudo mount -t vboxsf sharedfolder /mountedfolder
  • Then run docker-compose up -d nginx postgres
  • Login to the workspace docker-compose exec workspace
  • Run php artisan migrate

Relevant Code:

Config sample code is as follows:

DB_CONNECTION=pgsql
DB_HOST=localhost
DB_PORT=5432
DB_DATABASE=default
DB_USERNAME=default
DB_PASSWORD=secret
@sanketraut sanketraut changed the title [Illuminate\Database\QueryException] SQLSTATE[08006] [7] could not connect to server: Connection refused Postgresql error- could not connect to server: Connection refused Aug 13, 2017
@manjurulcis
Copy link

manjurulcis commented Aug 13, 2017

from your sample config code, DB_HOST should be DB_HOST=pgsql or 127.0.0.1

@zuohuadong
Copy link
Contributor

DB_HOST=postgres
Suggested use docker 17.3 or new

@stale
Copy link

stale bot commented Feb 2, 2020

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the Stale label Feb 2, 2020
@stale
Copy link

stale bot commented Feb 23, 2020

Hi again 👋 we would like to inform you that this issue has been automatically closed 🔒 because it had not recent activity during the stale period. We really really appreciate your contributions, and looking forward for more in the future 🎈.

@stale stale bot closed this as completed Feb 23, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants