title: Cannot connect to Postgres running on VM from host machine using MD5 method
body: <p>I have a VM set up with Vagrant that has Postgres running on it (on port 5432), forwarded to port 8280 on the host machine.</p>
  
  <p>I have set the password for the default user and I can connect locally just fine.</p>
  
  <p>I have been trying to set up access from the host machine over port 8280, and I have been unable to get it working with 'MD5' as the trust method.</p>
  
  <p>I have set up <code>postgresql.conf</code> to listen on all addresses:</p>
  
  <pre><code># postgresql.conf
  listen_addresses = '*'
  </code></pre>
  
  <p>and I have configured <code>pg_hab.conf</code> as follows:</p>
  
  <pre><code># pg_hab.conf
  #TYPE   DATABASE  USER  CIDR-ADDRESS  METHOD
  host    all       all   0.0.0.0/0     md5
  </code></pre>
  
  <p>With all of these settings, if I run the following command from my host machine:</p>
  
  <pre><code>psql --host=127.0.0.1 --port=8280 --username=postgres -d mydb -c '\l'
  </code></pre>
  
  <p>I am prompted for the password, and then I get:</p>
  
  <pre><code>psql: FATAL:  password authentication failed for user "postgres"
  </code></pre>
  
  <p>If I then change the METHOD from 'md5' to 'trust' I'm not asked for a password and I can connect as expected. My question is - why can't I connect using 'md5', which is what I want to be able to do? I know that the password I am entering is correct (I have changed it), but for some reason it isn't working.</p>