Syntax
After Login into postgres (psql Terminal)
CREATE DATABASE database_name;
where database_name is the name of a database which you want to create.
Example
CREATE DATABASE sample;
List All Databses
postgres=# \l Name | Owner | Encoding | Collate | Ctype | ICU | Access privileges -----------+----------+----------+--------------------+--------------------+-----+----------------------- postgres | postgres | UTF8 | English_India.1252 | English_India.1252 | | sample | postgres | UTF8 | English_India.1252 | English_India.1252 | | template0 | postgres | UTF8 | English_India.1252 | English_India.1252 | | =c/postgres + | | | | | | postgres=CTc/postgres template1 | postgres | UTF8 | English_India.1252 | English_India.1252 | | =c/postgres + | | | | | | postgres=CTc/postgres (4 rows)
OR
select * from pg_database; datname | datdba | encoding | datcollate | datctype | daticu | datistemplate | datallowconn | datconnlimit | datlastsysoid | datfrozenxid | datminmxid | dattablespace | datacl -----------+--------+----------+--------------------+--------------------+--------+---------------+--------------+--------------+---------------+--------------+------------+---------------+------------------------------------- template1 | 10 | 6 | English_India.1252 | English_India.1252 | | t | t | -1 | 12564 | 710 | 1 | 1663 | {=c/postgres,postgres=CTc/postgres} template0 | 10 | 6 | English_India.1252 | English_India.1252 | | t | f | -1 | 12564 | 710 | 1 | 1663 | {=c/postgres,postgres=CTc/postgres} postgres | 10 | 6 | English_India.1252 | English_India.1252 | | f | t | -1 | 12564 | 710 | 1 | 1663 | sample | 10 | 6 | English_India.1252 | English_India.1252 | | f | t | -1 | 12564 | 710 | 1 | 1663 | (4 rows)