Skip to main content

no pg_hba.conf entry for host xyz

If you get this error while connecting to a postgres database, most likely you are missing an entry in pg_hba.conf file to allow users from your machine to access the database. You will normally find the pg_hba.conf file in /var/lib/pgsql/data directory. If you don't find it there, look for PGDATA environment variable by doing a login to postgres server as a postgres user and typing env at command prompt. Then edit the file to add following entry ;

host all all XYZ 255.255.255.255 trust

just below the following entry

host all all 127.0.0.1 255.255.255.255 trust

and restart the postgres process by typing pg_ctl restart . It should now allow all user from your machine to connect to the database.

Comments