What is a HBA

This is part of the Semicolon&Sons Code Diary - consisting of lessons learned on the job. You're in the databases category.

Last Updated: 2024-11-21

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

What is HBA?

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:

Giving myself access via the HBA

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:

To get the config running, I restarted the service sudo service postgresql restart

Resources