Postgresql page
This commit is contained in:
parent
c519755ae9
commit
b574e9f07b
1 changed files with 51 additions and 0 deletions
51
content/docs/postgresql.md
Normal file
51
content/docs/postgresql.md
Normal file
|
@ -0,0 +1,51 @@
|
|||
---
|
||||
title: "Postgresql"
|
||||
weight: 1
|
||||
# bookFlatSection: false
|
||||
# bookToc: true
|
||||
# bookHidden: false
|
||||
# bookCollapseSection: false
|
||||
# bookComments: false
|
||||
# bookSearchExclude: false
|
||||
---
|
||||
|
||||
# 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]]
|
||||
```
|
||||
|
||||
## Sources
|
||||
|
||||
1. <https://wiki.archlinux.org/title/PostgreSQL>
|
Loading…
Reference in a new issue