Skip to content

Instantly share code, notes, and snippets.

@hamidrhashmi
Last active May 7, 2024 06:53
Show Gist options
  • Save hamidrhashmi/74a36ca5658372e994d5bab9990acc9d to your computer and use it in GitHub Desktop.
Save hamidrhashmi/74a36ca5658372e994d5bab9990acc9d to your computer and use it in GitHub Desktop.
Postgres HowTo

How to connect with postgres CLI

su postgres
psql -U postgres -W Password

Postgress keywords in comparison to mysql

database=# \l                                           //show databases
database=# \c database                           // use database
database=# \dt                                        // show tables;
database=# \d table                                // describe table

PG_VERSION is the necessary data directory of that table pg_filenode.map is necessary

how to take backup in psql

export PGPASSWORD=`cat /etc/heplify-server.toml | grep DBPass | awk '{print $3}' | tr -d '"'`
pg_dump -U homer_user -h localhost -d homer_config -t users > /root/backup.sql

How to configure SSL

Go to this Link

Enjoy 😉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment