Docsity

GUIDA DATABASE POSTGRESQL, Schemi e mappe concettuali di Programmazione e Tecnologie Web

Toggle sidebar
bg1
GUIDA DATABASE POSTGRESQL
POSTGRESQL DOCKER
==============================================
docker pull postgres
docker run --name PostgreSQL -e POSTGRES_PASSWORD=postgres -d -p 5432:5432 postgres
CONNECT
==============================================
user (superuser): postgres
pwd (custom): postgres
port (default): 5432
database (superuser/maintenance): postgres
CLI TOOLS
==============================================
Command Description
--- ---
psql -U postgres per connettere (con client psql)
pg_dump backup db
pg_dumpall backup cluster ossia +db
pg_restore per importare
pg_basebackup per creare snapshot fisici utili per la replica o il disaster recovery
psql (poi) help help
psql --help help
\h help comandi sql
\? help comandi psql
\l lista databases
\d lista relazioni (relation / relationship)
\du lista ruoli
\d <TABLENAME> mostra campi(struttura) tabella
pf3

Anteprima parziale del testo

Scarica GUIDA DATABASE POSTGRESQL e più Schemi e mappe concettuali in PDF di Programmazione e Tecnologie Web solo su Docsity!

GUIDA DATABASE POSTGRESQL

POSTGRESQL DOCKER

docker pull postgres docker run --name PostgreSQL - e POSTGRES_PASSWORD=postgres - d - p 5432:5432 postgres CONNECT ============================================== user (superuser): postgres pwd (custom): postgres port (default): 5432 database (superuser/maintenance): postgres CLI TOOLS ============================================== Command Description


psql - U postgres per connettere (con client psql) pg_dump backup db pg_dumpall backup cluster ossia +db pg_restore per importare pg_basebackup per creare snapshot fisici utili per la replica o il disaster recovery psql (poi) help help psql --help help \h help comandi sql ? help comandi psql \l lista databases \d lista relazioni (relation / relationship) \du lista ruoli \d mostra campi(struttura) tabella

\q per uscire \c per connettere a un database specifico


\c dbname Connect to a database \dt List all tables in the current database \d tablename Describe the structure of a table \l List all databases \q Exit psql \conninfo Display information about the current connection \du List all roles \password Change the password for a role \x Toggle expanded table formatting ! command Execute a command in the shell \i filename Execute commands from a file \h Display help on SQL commands ? Display help on psql commands \set Set psql variables \unset Unset (delete) a psql variable \timing Toggle timing of commands \echo text Print text to the output \o filename Send query results to a file \s Display command history \watch Execute a query every specified interval WIN INSTALL (WIZARD) ============================================== components:

  • PostgreSQL Server
  • pgAdmin 4 (client)
  • Stack Builder (to install extensions)
  • Command Line Tools log: