This is part of the Semicolon&Sons Code Diary - consisting of lessons learned on the job. You're in the databases category.
Last Updated: 2025-11-04
I encountered the following error when trying to access postgres via acceptance tests running on my Vagrant machine (a virtual machine):
PDOException: SQLSTATE[08006] [7] FATAL: no pg_hba.conf entry for host "192.168.10.10", user "homestead", database "projectx_test", SSL on
FATAL: no pg_hba.conf entry for host "192.168.10.10", user "homestead", database "projectx_test", SSL off
First off, we need to know that a hba.conf file controls client authentication. In fact, HBA stands
for Host-Based-Authentication.
Each record within this file specifies:
I was able to fix my access issue by adding the following line to the end of the
pg_hba.conf file (stored at /etc/postgresql/12/main/pg_hba.conf in my
Vagrant machine)
host all all 0.0.0.0/0 md5
Meaning:
md5 to verify passwords (other options could be, for example, to trust)To get the config running, I restarted the service sudo service postgresql restart