Follow the procedure below to define a database using client commands.
An example of operations on the server is shown below.
Use psql command to connect to the postgres database.
Execute psql postgres.
> psql postgres
psql (<x>) (*1)
Type "help" for help.
*1: <x> indicates the PostgreSQL version on which this product is based.
Create the database.
To create the database, execute the CREATE DATABASE databaseName; statement.
postgres=# CREATE DATABASE db01; CREATE DATABASE
Confirm that the database is created.
Execute \l+, and confirm that the name of the database created in step 2 is displayed.
postgres=# \l+
Disconnect from the postgres database.
Execute \q to terminate the psql command.
postgres=# \q
You can create a database using the createdb command.
See
Refer to "Creating a Database" in "Tutorial" in the PostgreSQL Documentation for information on creating a database using the createdb command.