Creating a database in PostgreSQL is straightforward, but it must be performed by a user who has permissions to create databases in PostgreSQL—for example, initially the user named
postgres. You can then simply issue the following command from the shell prompt (not the PSQL client prompt, but a normal shell prompt):
matthew@seymour:~# su - postgres-bash-2.05b$ createdb database
database is the name of the database you want to create.
createdb program is actually a wrapper that makes it easier to create databases without having to log in and use
psql. However, you can also create databases from within
psql with the
CREATE DATABASE statement. Here is an example:
CREATE DATABASE database;
You need to create ...