title: capistrano, rails, PG::ConnectionBad: fe_sendauth: no password supplied
body: <p>I'm trying to run Capistrano for a rails app with Postgres on Ubuntu 14, I ran into a password error during <code>rake db:migrate</code>-</p>
  
  <pre><code>DEBUG [2823f146] Command: cd /home/ben/apps/mll/releases/20160414014303 &amp;&amp; ( export RBENV_ROOT="$HOME/.rbenv" RBENV_VERSION="2.0.0-p645" RAILS_ENV="production" ; $HOME/.rbenv/bin/rbenv exec bundle exec rake db:migrate )
  DEBUG [2823f146]  rake aborted!
  PG::ConnectionBad: fe_sendauth: no password supplied
  </code></pre>
  
  <p>I tried every solution to similar posts but no luck. For kicks I also tried running just that command in the remote app dir and got the following: </p>
  
  <pre><code>PG::ConnectionBad: FATAL:  password authentication failed for user "mll"
  FATAL:  password authentication failed for user "mll"
  </code></pre>
  
  <p>This is interesting because it's using my database name as my username. See <code>database.yml</code> below, so for the hell of it I added a <code>mll</code> role, and lo and behold it worked when just running <code>rake db:migrate</code>. I tried running Capistrano again though with this new role, and still no luck.</p>
  
  <p>Is it a reasonable guess that the username is not being accessed/stored properly? Any way for me to test that? I manually <code>ALTER ROLE ben WITH PASSWORD 'mypw';</code> for both my <code>ben</code> and <code>mll</code> roles, and nothing.</p>
  
  <p>My database.yml:</p>
  
  <pre><code>defaults: &amp;default
    adapter: sqlite3
    encoding: utf8
  
  development:
    &lt;&lt;: *default
    database: db/development.sqlite3
  
  test:
    &lt;&lt;: *default
    database: db/development.sqlite3_test
  
  production:
    &lt;&lt;: *default
    host: localhost
    adapter: postgresql
    encoding: utf8
    database: mll
    pool: 5
    username: &lt;%= ENV['DATABASE_USER'] %&gt;
    password: &lt;%= ENV['DATABASE_PASSWORD'] %&gt;
  </code></pre>
  
  <p>\du:</p>
  
  <pre><code>                             List of roles
   Role name |                   Attributes                   | Member of
  -----------+------------------------------------------------+-----------
   ben       | Superuser, Create role, Create DB              | {}
   mll       | Superuser, Create role, Create DB              | {}
   postgres  | Superuser, Create role, Create DB, Replication | {}
  </code></pre>
  
  <p>I read changing <code>md5</code> to <code>trust</code> helped some people, I tried that, but I'm unsure how to restart, all commands I've seen haven't worked for me.</p>
  
  <p>pg_hba.conf: </p>
  
  <pre><code>local   all             postgres                                peer
  
  # TYPE  DATABASE        USER            ADDRESS                 METHOD
  local   all             all                                     peer
  host    all             all             127.0.0.1/32            md5
  host    all             all             ::1/128                 md5
  </code></pre>