title: Postgresql "no pg_hba.conf entry" error
body: <p>I'm setting up my local postgresql database for a rails project (that I'm joining), and have done the following:</p>
  
  <ul>
  <li>Installed postgres</li>
  <li>Added/bundled 'pg' gem</li>
  <li>Created a db user named "foobar"</li>
  <li>Created a db named "foobar_development"</li>
  </ul>
  
  <p>The rails app comes with a rake db:migrate task. When I run this task, I get the following error output:</p>
  
  <pre><code>FATAL:  no pg_hba.conf entry for host "::1", user "foobar", database "foobar_development", SSL off
  </code></pre>
  
  <p>I found a pg_hba.conf file in the following location:</p>
  
  <p>/usr/local/var/postgres</p>
  
  <p>Here's the relevant part of the pg_hba.conf file:</p>
  
  <pre><code># TYPE  DATABASE        USER            ADDRESS                 METHOD
  
  # "local" is for Unix domain socket connections only
  local   all             all                                     trust
  # IPv4 local connections:
  host    all             all             127.0.0.1/32            trust
  # IPv6 local connections:
  host    all             all             ::1/128                 trust
  # Allow replication connections from localhost, by a user with the
  # replication privilege.
  
  #local   replication     jimmyli                                trust
  #host    replication     jimmyli        127.0.0.1/32            trust
  #host    replication     jimmyli        ::1/128                 trust
  </code></pre>
  
  <p>I am using the postgres that came with my Mac (version 9.2.4), although I'm worried I might have installed another version of it somewhere else (and ought to remove it - anyway I can check this?). I am also using Postgres.app to run psql. (<a href="http://postgresapp.com/" rel="nofollow">http://postgresapp.com/</a>).</p>
  
  <p>I think my pg_hba.conf file ought to work correctly (since I'm giving all users access to all dbs), so I wonder if there's another pg_hba.conf file out there, and that I'm looking at the wrong one/one that's not being used. How can I test this hypothesis?</p>