shashank
shashank

Reputation: 399

PostgreSQL Database connection error

Hello i am a beginner to postgresql, I am unable to connect Postgresql database on linux system from windows through pgadmin client . I am getting the following error

FATAL: no pg_hba.conf entry for host "192.168.1.42", user "postgres", database "postgres", SSL off 

Kindly suggest me how to do.Thanks in advance

Upvotes: 1

Views: 15194

Answers (2)

bma
bma

Reputation: 9756

On the db server, edit your pg_hba.conf file and add a line similar to this:

host    all             all             192.168.1.42/32            md5

If you don't want to use a password (I won't get into the security aspects), you can switch the "md5" for "trust". If you only want to allow the postgres user access to the postgres maintenance database, then switch both "all" words with "postgres" (no quotes).

You'll need to reload the config files after making any changes. Eg.

pg_ctl reload

or

select pg_reload_conf(); -- as the superuser

If you don't know which pg_hba.conf file your database cluster is using, if you can connect to any of the databases, issue select current_setting('hba_file');

Upvotes: 6

sheplu
sheplu

Reputation: 2975

by default, postgresql deny all connexion if it's not from "localhost" here is a link for you : https://wiki.debian.org/PhpPgAdmin

Upvotes: 1

Related Questions