PostgreSQL | Getting started

Inhaltsverzeichnis [Anzeigen]

Install

PostgreSQL Server

Mac OS

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
brew install postgres
brew install postgres
brew install postgres

Windows (Installer)

Windows (Zip-ARchiv)

Download postgresql from https://www.enterprisedb.com/download-postgresql-binaries

Configure

Initialize database:

initdb.exe -D ../data –-username=postgres –-auth=trust

Start the database:

pg_ctl.exe start -D ../data

Log into the database:

psql –-username=postgres

Create a password for your user:

ALTER USER postgres WITH PASSWORD ‘VeryVerySecret’;

Install adminpack extension:

CREATE EXTENSION adminpack;

Manage Users

Preparation

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
psql postgres
psql postgres
psql postgres

List all Users

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
postgres=# \du+
postgres=# \du+
postgres=# \du+

Create Superuser

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
create role superuser superuser login password 'pAssw8rd';
create role superuser superuser login password 'pAssw8rd';
 create role superuser superuser login password 'pAssw8rd';

Change Password

Postgres Utilities

Documentation

Working with