This article explains how to login to a PostgreSQL server using the psql tool on Redhat and/or CentOS.
You first need the psql tool:
yum install postgresql
Then use the format below to connect and login. Here we’ll use the username of ‘root’ and the hostname is ‘db.agix.com.au’.
psql -h db.agix.com.au -U root
Enter the password for the root user in the PostgreSQL database and you’re in.