Postgresql by network

1

I have running PostgreSQL sever on 192.168.0.102:5432. postgresql.conf has this line:

listen_addresses = '*'

and pg_hba.conf has this one:

host    all         all         127.0.0.1/32          trust

I have Rails app with same config/database.yml

development:
  adapter: postgresql
  host: 192.168.0.102
  port: 5432
  encoding: unicode
  database: test
  pool: 5
  username: test
  password:

But when I run rake db:migrate I get (I run this from 192.168.0.100)

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

Who can help with this?

sev

Posted 2010-05-08T17:59:41.533

Reputation: 63

Answers

3

It's obvious that you don't have permission to contact server from that IP.

Complete docs on pg_hba.conf are here. You'll just need to add md5 auth for your host

What you probably need is:

host all all 192.168.0.100/32 md5

And yes, I basically copied the answer from above, but since the original error was a "test" user trying to access the "postgres" database, telling him to set it up as "test test" is just going to result in the same error message. Setting it to "all all" will allow all roles to access all databases (provided they can authenticate), which is probably more useful for development.

xzilla

Posted 2010-05-08T17:59:41.533

Reputation: 141

Apparently the "test" user needs to be able to access the "postgres" database to take certain actions related to the "test" database. This cropped up for me during the db:test:purge task while running "rake spec". It confused me because I'm not explicitly trying to do anything as the "postgres" user. – Steve – 2014-01-17T19:32:47.897

1

It's obvious that you don't have permission to contact server from that IP.

Complete docs on pg_hba.conf are here. You'll just need to add md5 auth for your host(and only allow 'test' database and 'test' user).

What you probably need is:

host test test 192.168.0.100/32 md5

edk

Posted 2010-05-08T17:59:41.533

Reputation: 308

0

This is an old one, but did you restart the postgresql server? That's an important step after editing pg_hba.conf. Nobody else here is mentioning that.

deltaray

Posted 2010-05-08T17:59:41.533

Reputation: 1 665