LinuxCommandLibrary
GitHubF-DroidGoogle Play Store

initdb

creates a new PostgreSQL database cluster

TLDR

Initialize PostgreSQL database cluster
$ initdb -D [/var/lib/postgresql/data]
copy
Initialize with specific encoding
$ initdb -D [/var/lib/postgresql/data] -E UTF8
copy
Initialize with specific locale
$ initdb -D [/var/lib/postgresql/data] --locale=[en_US.UTF-8]
copy
Initialize with authentication
$ initdb -D [/var/lib/postgresql/data] -A [scram-sha-256] -W
copy
Initialize with specific user
$ initdb -D [/var/lib/postgresql/data] -U [postgres]
copy

SYNOPSIS

initdb [options] -D directory

DESCRIPTION

initdb creates a new PostgreSQL database cluster. A cluster is a collection of databases managed by a single PostgreSQL server instance, stored in a data directory.This command must be run before starting PostgreSQL for the first time. It creates the template databases, configuration files, and directory structure.

PARAMETERS

-D, --pgdata dir

Data directory location.
-E, --encoding encoding
Default database encoding.
--locale locale
Default locale.
-U, --username user
Database superuser name.
-W, --pwprompt
Prompt for superuser password.
-A, --auth method
Authentication method.
--auth-local method
Local connection auth method.
--auth-host method
Host connection auth method.
-k, --data-checksums
Enable data checksums.
--wal-segsize size
WAL segment size.

INSTALL

sudo dnf install postgresql17
copy
sudo apk add postgresql17
copy
sudo zypper install postgresql17
copy

CAVEATS

Must run as the PostgreSQL user. Directory must be empty or non-existent. Encoding and locale affect all databases. Data checksums cannot be changed later.

HISTORY

initdb is part of PostgreSQL, developed since 1996 by the PostgreSQL Global Development Group. It originated from the POSTGRES project at UC Berkeley.

SEE ALSO

pg_ctl(1), postgres(1), createdb(1)

Braincup
Open source brain training for math, memory and focus
Braincup mini-games
41 mini-games · Apache-2.0
No ads · No tracking
Play in browser
Download Braincup on the App StoreGet Braincup on Google PlayGet Braincup on F-Droid
276 stars
From the maker of Linux Command Library
Copied to clipboard
Braincup
Open source brain training for math, memory and focus. 41 mini-games, from mental arithmetic to Sudoku, N-Back and Solo Chess.
Apache-2.0 licensed · No ads · No tracking · No account
From the maker of Linux Command Library
Download Braincup on the App StoreGet Braincup on Google PlayGet Braincup on F-Droid