psql cli client installation
Step 1: update you package repo.
Create the file /etc/apt/sources.list.d/pgdg.list and add a line for the repository:
deb http://apt.postgresql.org/pub/repos/apt/ bionic-pgdg main
Step 2: download the psql client
wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add -
Step 3: update your linux
sudo apt-get update
Step 4: install the psql client
apt-get install postgresql-12
How to Connect to psql
psql -h <endpoint> -U <userid> -d <databasename> -p <port>
How to Connect to psql without password
export PGPASSWORD=’Ar123456’
run SQL Query via psql cli
psql -h <endpoint> -U <userid> -d <databasename> -p <port> -c <command>
Credit : Ariel Yosef
——————————————————————————————————————————
I put a lot of thoughts into these blogs, so I could share the information in a clear and useful way. If you have any comments, thoughts, questions, or you need someone to consult with, feel free to contact me: