I'm trying to connect to a database which is running on a non-default port using PSQL:
PSQL SYNOPSIS
psql [option...] [dbname [username]]
psql -h wrds-pgdata.wharton.upenn.edu –p 9737 -W myDatabase myAccountName
psql: warning: extra command-line argument "myDatabase" ignored
psql: warning: extra command-line argument "myAccountName" ignored
Password for user 9737:
Notice that the -p command is simply ignored. Somehow psql assumes that 9737 is the username! Let's try to be more explicit:
psql -h wrds-pgdata.wharton.upenn.edu –p 9737 -d myDatabase -U myAccountName -W
psql: warning: extra command-line argument "–p" ignored
psql: warning: extra command-line argument "9737" ignored
Password for user myAccountName:
No, that's not good either! The only way I got this to work was:
PGPORT=9737; export PGPORT
psql -h wrds-pgdata.wharton.upenn.edu -d myDatabase -U myAccountName -W
I'm using psql (PostgreSQL) 9.5.8. Any idea's why the normal command line doesn't work?