HiveBrain v1.2.0
Get Started
← Back to all entries
patternsqlMinor

no pg_hba.conf entry for host "[local]", user "pgadmin", database "postgres", SSL off on OSX

Submitted by: @import:stackexchange-dba··
0
Viewed 0 times
pgadminconfentrylocalosxpostgresuserpg_hbadatabasehost

Problem

local  all  postgres    trust
host  all  all  0.0.0.0/0  trust
hostnossl    all          all            0.0.0.0/0  trust


I would think either the second or the third would match these criteria.

I've restarted my service on brew with brew service restart postgres@9.6

Am I missing some setting here?

Solution

First, the meanings of the fields are:

# local       DATABASE  USER  METHOD  [OPTIONS]
# host        DATABASE  USER  ADDRESS  METHOD  [OPTIONS]
# host[no]ssl DATABASE  USER  ADDRESS  METHOD  [OPTIONS]


The attempt is:

host = “[local]” (meaning through a Unix domain socket)

user = “pgadmin”

database = “postgres”

SSL = off

Now your lines:

local  all  postgres    trust


does not match because the user pgadmin is not postgres

host  all  all  0.0.0.0/0  trust


does not match because host only matches TCP/IP connections and [local] is not a TCP/IP connection.

hostnossl    all          all            0.0.0.0/0  trust


does not match for the same reason than the previous line.

If you want to "trust" everyone locally through the Unix domain socket, you may change the first line to:

local  all  all    trust

Code Snippets

# local       DATABASE  USER  METHOD  [OPTIONS]
# host        DATABASE  USER  ADDRESS  METHOD  [OPTIONS]
# host[no]ssl DATABASE  USER  ADDRESS  METHOD  [OPTIONS]
local  all  postgres    trust
host  all  all  0.0.0.0/0  trust
hostnossl    all          all            0.0.0.0/0  trust
local  all  all    trust

Context

StackExchange Database Administrators Q#193242, answer score: 4

Revisions (0)

No revisions yet.