Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

GodziLaravel's avatar

Psql not working when I start the vagrant !

Hello I installed vagrant and it seems everything is going well except one issue : when I do vagrant up then vagrant ssh I cant access to psql :

vagrant@homestead:~$ psql -h localhost -U homestead -W
Password:
psql: error: connection to server at "localhost" (127.0.0.1), port 5432 failed: Connection refused
        Is the server running on that host and accepting TCP/IP connections?

I always have to restart the psql server to be able to connect to it :

vagrant@homestead:~$ sudo /etc/init.d/postgresql restart
Restarting postgresql (via systemctl): postgresql.service.
vagrant@homestead:~$ psql -h localhost -U homestead -W
Password:
psql (13.5 (Ubuntu 13.5-2.pgdg20.04+1))
SSL connection (protocol: TLSv1.3, cipher: TLS_AES_256_GCM_SHA384, bits: 256, compression: off)
Type "help" for help.
homestead=# 

Any idea?

0 likes
0 replies

Please or to participate in this conversation.