CREATE DATABASE v17
Name
CREATE DATABASE — Create a database.
Synopsis
CREATE DATABASE <name>
Description
CREATE DATABASE creates a database.
To create a database, you must be a superuser or have the CREATEDB privilege. Normally, the creator becomes the owner of the new database. Non-superusers with the CREATEDB privilege can create only databases they own.
The new database is a clone of the standard system database template1.
Parameters
name
The name of the database to create.
Notes
You can't execute CREATE DATABASE inside a transaction block.
Errors along the line of “could not initialize database directory” are most likely related to insufficient permissions on the data directory, a full disk, or other file system problems.
Examples
To create a database:
CREATE DATABASE employees;
- On this page
- Name
- Synopsis
- Description
- Parameters
- Notes
- Examples