title: Postgres: MD5 Password / Plain password
body: <p>I'm trying to understand how role passwords are supposed to operate in Postgres.</p>
  
  <p><a href="https://www.postgresql.org/docs/current/static/sql-createrole.html" rel="noreferrer">https://www.postgresql.org/docs/current/static/sql-createrole.html</a> says for ENCRYPTED / UNENCRYPTED</p>
  
  <blockquote>
    <p>If the presented password string is already in MD5-encrypted format, then it is stored encrypted as-is,</p>
  </blockquote>
  
  <p>So my unencrypted password is: MyPassword .</p>
  
  <p>The MD5 hash of "MyPassword" is 48503dfd58720bd5ff35c102065a52d7</p>
  
  <p>If I do</p>
  
  <pre><code>-- See https://www.postgresql.org/docs/9.6/static/sql-alterrole.html
  ALTER ROLE "MeOhMy"
  LOGIN
  PASSWORD '48503dfd58720bd5ff35c102065a52d7'
  ;
  </code></pre>
  
  <p>And then attempt to use "MyPassword" when doing</p>
  
  <pre><code>  sudo -u postgres psql meohmy -h 127.0.0.1 -d meohmy_development
  </code></pre>
  
  <p>I, of course, first get prompted for my sudo password and then I get prompted by Postgres "Password for meohmy"</p>
  
  <p>If I enter MyPassword I get</p>
  
  <pre><code>FATAL:  password authentication failed for user "ralph@dos32.com"
  </code></pre>
  
  <p>If I enter, instead, 48503dfd58720bd5ff35c102065a52d7 then I can sign in.</p>
  
  <p>What am I not understanding?</p>