When trying to configure postgresql to be able accessed remotely from another IP address, we usually got several errors like this :
1 2 3 4 | postgresql remote access no pg_hba.conf entry for host psql: FATAL: no pg_hba.conf entry for host "xxxxx", user "xx", database "xxxx", SSL on FATAL: no pg_hba.conf entry for host "xxxx", user "xx", database "xxx", SSL off |
OR
1 | " FATAL: no pg_hba.conf entry for host" |
To make PostgreSQL in Ubuntu 11.10 can be accessed from remote, follow this path :
Edit this files :
1 | sudo vim /etc/postgresql/9.1/main/postgresql.conf |
Line 59:
1 | listen_addresses = ‘*’ # what IP address(es) to listen on; |
1 | sudo vim /etc/postgresql/9.1/main/pg_hba.conf |
In this example, I will access remote postgresql from IP 162.36.222.98.
1 2 3 4 5 6 7 8 9 10 11 12 | # DO NOT DISABLE! # If you change this first entry you will need to make sure that the # database superuser can access the database using some other method. # Noninteractive access to all databases is required during automatic # maintenance (custom daily cronjobs, replication, and similar tasks). # # Database administrative login by Unix domain socket #local all postgres peer local all postgres trust …. host all all 162.36.222.0/24 md5 …. |
Restart postgresql services by :
1 | sudo service postgresql restart |