title: Can connect to postgres through localhost without password but not through 127.0.0.1. Why?
body: <p>I have Kubuntu 14.10 desktop with PostgreSQL 9.4 database installed.
  I have changed the password of the <code>postgres</code> user in the database by executing the SQL:</p>
  
  <pre><code>ALTER USER postgres PASSWORD 'password';
  </code></pre>
  
  <p>And I can connect to DB server by <code>psql -h localhost -U postgres -W</code> and giving that password <em>but</em> I can also connect without a password requirement by simply <code>psql -h localhost -U postgres</code>.</p>
  
  <p>On the other hand, if I run <code>psql -h 127.0.0.1 -U postgres</code> it prompts me for the password set before.</p>
  
  <p>What is the difference between the <code>localhost</code> and <code>127.0.0.1</code> hosts and their login method? Where is it set? I see no <code>localhost</code>-related entries in the <code>pg_hba.conf</code> file.</p>