Authentication and permission issues
Once we are past the initial stage, the next set of errors is a result of incorrect or missing entries in pg_hba.conf:
, the host-based authentication file found under the data directory. The location/name of the file can be set using the hba_file
parameter in postgresql.conf
.
The most likely error we will see will be similar to the following:
psql: FATAL: no pg_hba.conf entry for host "192.168.56.1", user "postgres", database "postgres"
The message mentions a host, a user, and a database. These are precisely the entries we should provide in pg_hba.conf
. It has entries similar to the following screenshot:
The entry marked host can be a hostname, an IP address range or a special keyword.
Note
Note that most of the lines in the screenshot are commented as they begin with #
.
We must reload the configuration for the changes to take effect with the following command:
pg_ctl reload
Now, we will be able to connect.
It's possible to...