postgres=#CREATEDATABASEtestdb;CREATEDATABASEpostgres=#\lListofdatabasesName|Owner|Encoding|Collate|Ctype|Accessprivileges---+---+---+---+---+---postgres|postgres|UTF8|en_US.UTF-8|en_US.UTF-8|template0|postgres|UTF8|en_US.UTF-8|en_US.UTF-8|=c/postgres+|||postgres=CTc/postgrestemp...
List of databases Name | Owner | Encoding | Collate | Ctype | ICU Locale | Locale Provider | Access privileges ---+---+---+---+---+---+---+--- postgres | postgres | UTF8 | C.UTF-8 | C.UTF-8 | | libc | template0 | postgres | UTF8 | C.UTF-8 | C.UTF-8 ...
test-# \lList of databasesName | Owner | Encoding | Collate | Ctype | Access privileges---+---+---+---+---+---pg1 | pg1 | UTF8 | en_US.UTF-8 | en_US.UTF-8 |postgres | pg1 | UTF8 | en_US.UTF-8 | en_US.UTF-8 |template0 | pg1 | UTF8 | en_US.UTF-8 | ...
# 1. 创建一个数据库,不带任何参数postgres=# create database testdb;CREATE DATABASE#查看数据库,可以看到数据库所有者是postgres,就是当前用户,默认编码格式是UTF8postgres=# \l testdb;List of databases Name|Owner|Encoding|Collate|Ctype|Access privileges ---+---+---+---+---+--- testdb|postg...
Create the file/etc/apt/sources.list.d/pgdg.listand add a line for the repository #Create the file repository configuration:sudo sh -c 'echo "deb http://apt.postgresql.org/pub/repos/apt $(lsb_release -cs)-pgdg main" > /etc/apt/sources.list.d/pgdg.list'#sudo sh -c'echo "deb ...
7. How do I get a list of databases in a Postgresql database ? # \l [Note: This is backslash followed by lower-case L] List of databases Name | Owner | Encoding ---+---+--- backup | postgres | UTF8 mydb | ramesh | UTF8 postgres...
A single PostgreSQL server can contain many databases. Let’s explore three different approaches to list databases in PostgreSQL!
# \l 列举目前实例中的所有数据库,类似mysql中的 show databases ; postgres=# \l List of databases Name | Owner | Encoding | Collate | Ctype | Access privileges ---+---+---+---+---+--- postgres | postgres | UTF8 | en_US.UTF-8 | en_US.UTF-8 | template0 | postgres | UTF...
postgres=# \l List of databases Name | Owner | Encoding | Collate | Ctype | Access privileges ---+---+---+---+---+--- postgres | tbase | UTF8 | en_US.utf8 | en_US.utf8 | template0 | tbase | UTF8 | en_US.utf8 | en_US.utf8 | =c/tbase + | | | | | tbase=CT...
postgres=# \l+ List of databases Name | Owner | Encoding | Collate | Ctype | ICU Locale | Locale Provider | Access privileges---+---+---+---+---+---+---+---advent_of_code