xxxxxxxxxx
$ psql -h <host> -p <port> -U <username> <database>
xxxxxxxxxx
psql -h <IP_Address> -p <port_no> -d <database_name> -U <DB_username> -W
-W option will prompt for password
psql -h 192.168.1.50 -p 5432 -d testdb -U testuser -W
xxxxxxxxxx
psql -h <remote_host> -p <remote_port> -U <username> -d <database_name>
xxxxxxxxxx
How to connect to remore postgres database from command line
psql -h <IP_Address> -p <port_no> -d <database_name> -U <DB_username> -W
-W option will prompt for password
psql -h 192.168.1.50 -p 5432 -d testdb -U testuser -W