Programming/PostgreSQL/Setup: Difference between revisions

From Dev Wiki
Jump to navigation Jump to search
(Create page)
(No difference)

Revision as of 23:07, 2 November 2020

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>