wiki:Postgres HowTo login without password

Version 1 (modified by Richard Bramley, 8 years ago) ( diff )

--

Postgres HowTo login without password

tags: postgres HowTo

Procedure

  1. Create a file in your home directory called .pgpass
  2. The contents of this file should take the format:
    hostname:port:database:username:password
    

For example, here the port and database have been left blank:

localhost:*:*:username:password

You may have to add a record for 127.0.0.1 as well as localhost.

  1. Make sure that the file has the correct permissions by running: chmod 600 .pgpass
  2. Connect using the following command:
    psql -U username -d dbname
    

Error: Macro BackLinks(None) failed
'Environment' object has no attribute 'get_db_cnx'

Note: See TracWiki for help on using the wiki.