PostgreSQL : failed: FATAL: no pg_hba.conf entry for host

I get following error when I try to connect using DBI

DBI connect('database=chaosLRdb;host=192.168.0.1;port=5433','postgres',...) 
failed: FATAL:  no pg_hba.conf entry for host "192.168.0.1", user "postgres", database "myDatabase", SSL off
Tagged:

Answers

  • First look for pg_hba.conf , you can use locate command to do so

    locate pg_hba.conf
    

    Then edit the file on your favorite editor

    vi /var/lib/pgsql/9.6/data/pg_hba.conf
    

    Add the following line to the file

    host    all             all             192.168.0.1/32            md5
    

    In order to apply changes, you must reload the service. In my case, I have pg version 9.6 so commands will be

    service postgresql-9.6 reload
    service postgresql-9.6 status
    


Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!