Elencare i database in un'istanza di PostgreSQL
Publié le 30 July 2019
Non ho voglia di installarehttps://www.pgadmin.org/[pgAdmin] ou phppgadmin mentre tutto è presente dalla riga di comando
Per fare ciò dobbiamo avviare il terminale e connetterci come l’utente postgres.
l’utente postgres è l’unico a avere per impostazione predefinita il diritto di lanciare l’applicazione psql che è il client da riga di comando (Note: Since no source text was provided, there is nothing to translate.)CLI) postgresql,
per poter parlare al database da riga di comando dal terminale
Per connettersi, avviare il terminale e digitare questo:
$ sudo -i -u postgres
Per connettersi e arrivare direttamente al prompt dei comandi postgresql, digitare questo :
$ sudo -i -u postgres psql
Per elencare le basi di dati di un’istanza di postgresql, ecco il comando :
postgres=# \l
risultato:
Lista delle basi di dati Nome | Proprietario | Codifica | Collazione | Tipo carattere | Diritti di accesso
fiber | tech | UTF8 | fr_FR.UTF-8 | fr_FR.UTF-8 | =Tc/tech
| | | | | tech=CTc/tech fiberdev | tech | UTF8 | fr_FR.UTF-8 | fr_FR.UTF-8 | =Tc/tech
| | | | | tech=CTc/tech fiberweb | tech | UTF8 | fr_FR.UTF-8 | fr_FR.UTF-8 | =Tc/tech
| | | | | tech=CTc/tech postgres | postgres | UTF8 | fr_FR.UTF-8 | fr_FR.UTF-8 | template0 | postgres | UTF8 | fr_FR.UTF-8 | fr_FR.UTF-8 | =c/postgres
| | | | | postgres=CTc/postgres template1 | postgres | UTF8 | fr_FR.UTF-8 | fr_FR.UTF-8 | =c/postgres
| | | | | postgres=CTc/postgres (6 righe)
premi q per uscire dalla visualizzazione dei risultati
per elencare gli schemi di un’istanza di postgresl
postgres=# SELECT schema_name FROM information_schema.schemata;
risultato
pubblico information_schema pg_catalog pg_toast_temp_1 pg_temp_1 pg_toast (6 righe)
ou
postgres=# SELECT nspname FROM pg_catalog.pg_namespace;
risultato
pg_toast pg_temp_1 pg_toast_temp_1 pg_catalog information_schema pubblico (6 lignes)
Articoli correlati
14 May 2026