Programming/PostgreSQL/Setup

From Dev Wiki
< Programming‎ | PostgreSQL
Revision as of 23:07, 2 November 2020 by Brodriguez (talk | contribs) (Create page)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Installation

Arch Linux

Basic installation can be performed with:

sudo pacman -Syu

Ubuntu

Basic installation can be performed with:

sudo apt install postgresql postgresql-contrib


PostgreSQL Shell

Note: The sudo -u postgres command can be used to invoke any postgresql shell command you want, without having to enter the PostgreSQL shell

.

To access the PostgreSQL for the first time, invoke the postgres user:

sudo -u postgres psql


Exit the shell with:

\q


Creating Roles

Roles in PostreSQL are the equivalent of other MySQL's Users.

To create a new user via an interactive GUI:

createuser --interactive

Alternatively, create a minimal user and enable permissions with flags via:

createuser <flags> <user_name>