PostgreSQL connect to database using psql

To connect to the PostgreSQL database server using psql command line, run

su - postgres
psql

If you have a PostgreSQL user and password, you can use

psql -h SERVER_IP_HERE -p 5432 -U USER_NAME_HERE -W

Example

Advertisement

psql -h students.arrhwfpckmeo.ap-southeast-2.rds.amazonaws.com -p 5432 -U aite_students -W

-W option is to force asking password.

Add a comment

Leave a Reply

Your email address will not be published. Required fields are marked *

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Advertisement