capsula-gemini/source/notes/postgres.gmi

56 lines
787 B
Plaintext

## Postgres
* Instalar
```Instalar
sudo apt install postgresql
```
* Configurar acceso
```Configurar acceso
sudo vim /etc/postgresql/12/main/pg_hba.conf
local all postgres trust
local all all scram-sha-256
sudo systemctl restart postgresql
```
* Crear roles y bases de datos
```
psql -U postgres
create role ROLE_NAME with login encrypted password 'CONTRASEÑA';
create database NAME with owner ROLE_NAME;
```
* Generar respaldo de una base de datos.
```
pg_dump -U postgres -d DATA_BASE -Fc -f NAME.bk
```
* Restaurar base de datos desde respaldo.
```
pg_restore -U postgres -d DATA_BASE NAME.bk
```
=> gemini://elmau.net/chuletas.gmi Regresar el índice
=> gemini://elmau.net Regresar el inicio