title: How can I get pg_dump to authenticate properly
body: <p>I have tried using host variable <code>PGPASSWORD</code> and <code>.pgpass</code> and neither of these two will allow me to authenticate to the database. I have <code>chmod</code>'d <code>.pgpass</code> to appropriate permissions and also tried:</p>
  
  
  
  <pre class="lang-none prettyprint-override"><code>export PGPASSWORD=mypass and PGPASSWORD=mypass
  </code></pre>
  
  <p>The password DOES contain a <code>\</code> however I was encasing it in single quotes <code>PGPASS='mypass\'</code> and it still will not authenticate.</p>
  
  <p>I'm running:</p>
  
  <pre class="lang-none prettyprint-override"><code>pg_dump dbname -U username -Fc
  </code></pre>
  
  <p>and I still receive </p>
  
  <pre class="lang-none prettyprint-override"><code>pg_dump: [archiver (db)] connection to database "dbname" failed: FATAL:  Peer authentication failed for user "username"
  </code></pre>