Logging into postgres
From YourSupportStoreWiki
First to log in if you are on the server
psql -d databasename
if you have a file with queries in it called filename and then output the results to filename.txt
psql -d databasename -f filename -o filename.txt
if you are not on the server and need to list the databases the -W forces it to prompt you for a password. -l Lists all available databases
psql -h hostname -U username -W -l
now if you know the database
psql -h hostename -u username -W -d databasename

