postgresql - masoud hosseini

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:

  1. Open a terminal or command prompt.
  2. 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:

Leave a Reply

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