Postgres

Postgres e' un database alternativo a Mysql, ma con molti comandi diversi.

Backup

 pg_dumpall > dumpfile  

Ripristino

 psql -f dumpfile postgres

List databases

 \list
 \l

Usare un database

 \c  database

Elenco tabelle database corrente

 \d

Eseguire un file sql

 \i

Lista comandi

 \?

Spiegazione di un comando

 \h COMANDO

esempi

 \h COPY
 \h ALTER TABLE

Connettersi al database da riga di comando

 $ psql -U utente -d database -h localhost
 $ psql  postgresql://utente@localhost/database

Se non si specifica un database, si collega al database con lo stesso nome dell'utente.

Elenco utenti

 \du