Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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?

share|improve this question
add comment

3 Answers

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.

share|improve this answer
    
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 Jan 17 at 19:32
add comment

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
share|improve this answer
add comment

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.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.