Search

22 August, 2021

PSQL commands handbook

PSQL is its own world. Interacting with it simple, yet the language has to be learned. Here is a list of basic commands which are a must.

Launching PSQL on any terminal:

psql

Create New User (users are roles with rights):

CREATE USER name;

Set a password for the user:

\password user

List all roles (users):

\du

Listing all databases:

\l


Selecting and working on a database:

\c DB_NAME


Creating a database:

CREATE DATABASE name;

Note: The semi-colon at the end is mandatory.

Quitting PSQL (or some command screen):

\q

 Deleting database

DROP DATABASE name;

No comments:

Post a Comment