1.1 KiB
1.1 KiB
title | weight |
---|---|
Postgresql | 1 |
Postgresql
On this page, $
means the command must be run as a user with adequate rights such as the postgresql
user.
Filesystem preparation
In case a Btrfs filesystem is used, Copy-on-Write should be disabled first.
Initial setup
The database can be initialized using the following command. Locale defaults to current environment locale.
$ initdb --locale C.UTF-8 --encoding=UTF8 -D /var/lib/postgres/data --data-checksums
Postgresql can then be started using the postgresql
systemd service.
Usage
Creating users
The following command can be used:
$ createuser [--interactive]
Additionnal options can be used to give permissions to the user (usually not needed).
Users can be deleted using the following command:
$ dropuser [-i/--interactive] [user]
Creating databases
The following command can be used:
$ createdb [-O owner] [dbname [description]]