PostgreSQL connect to database using psql

To connect to 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

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

-W option is to force asking password.

See PostgreSQL

Need help with Linux Server or WordPress? We can help!

Leave a Reply

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