Running postgresql from command line without password prompt

Posted: November 30th, 2010
By:
Tommy Unger

Due to security reasons, postgres (in contrast to mysql) does not allow a user to specify the password on the command line. However, there is a quick and hacky workaround which allow a psql command to be run without the password prompt.

From the command line, simply type:
export PGPASSWORD=yourpassword

From there you can now run:
psql -U username database

Leave a Reply

#000000
#1d3147
#415973
#9dacb9
#4c3724
#897661
#d1c8c0
#ffffff