title: Unable to Connect to PostgreSQL from psycopg2 - OperationalError: FATAL: role "victoryhb" does not exist
body: <p>I am on Ubuntu and I used the following command to install PostgreSQL</p>
  
  <pre><code>sudo apt-get install postgresql-9.4 pgadmin3
  </code></pre>
  
  <p>It seems the installation was successful, the PostgreSQL service is listening on port 5432, and I can interact with the PG server using <em>psql</em> under the <em>postgres</em> user account.
  But now when I tried to connect PG from Python using psycopg2:</p>
  
  <pre><code>psycopg2.connect(database="mydb", user="postgres")
  </code></pre>
  
  <p>I encountered the following error:</p>
  
  <pre><code>OperationalError: FATAL:  role "postgres" does not exist
  </code></pre>
  
  <p>despite the fact that the role "postgres" already exists as confirmed by typing the "\du" command in <em>psql</em>.</p>
  
  <p>Any hint what might have caused this strange problem?</p>
  
  <p>P.S. </p>
  
  <ul>
  <li>Before connecting, I also had to apply "ln -s
     /tmp/.s.PGSQL.5432 /var/run/postgresql/.s.PGSQL.5432" following the
     advice from
     <a href="https://askubuntu.com/questions/50621/cannot-connect-to-postgresql-on-port-5432">https://askubuntu.com/questions/50621/cannot-connect-to-postgresql-on-port-5432</a></li>
  <li>It doesn't seem to be the problem of psycopg2 since I also
     tested with another library pg8000 and got the same "role postgres
     does not exist" error</li>
  </ul>