How to make sure PostgreSQL is installed on my Linux?
To check if PostgreSQL is installed on your Linux system, you can follow these steps:
- Open a terminal or command prompt.
- Type the following command and press Enter:
which psql
How to Login into Postgres in command line:
psql -U <username> -d <database_name>
if you got :
psql: error: connection to server on socket "/var/run/postgresql/.s.PGSQL.5432" failed: FATAL: Peer authentication failed for user "postgres"
do this :
sudo su - postgres
and then try to login .
Delete A database:
dropdb -U <user> <database_name>
Restore backup:
pg_restore
Create Database: