createdb
Create a new PostgreSQL database
TLDR
SYNOPSIS
createdb [options] [dbname] [description]
DESCRIPTION
createdb creates a new PostgreSQL database. It is a convenience wrapper around the SQL CREATE DATABASE command, providing a command-line interface that is often more convenient than invoking psql directly.The database name defaults to the current system user name if not specified. An optional description (comment) can be provided as the second argument.
PARAMETERS
-D tablespace, --tablespace tablespace
Default tablespace for the database.-E encoding, --encoding encoding
Character encoding for the database.-l locale, --locale locale
Locale for the database.-O owner, --owner owner
Database owner user.-T template, --template template
Template database to copy from (default template1).-e, --echo
Echo the SQL commands that createdb sends to the server.--icu-locale locale
ICU locale for the database.--icu-rules rules
ICU collation rules for the database.--locale-provider provider
Locale provider (libc or icu).--strategy strategy
Database creation strategy (wallog or filecopy).-V, --version
Print the createdb version and exit.-h host, --host host
Server hostname or socket directory.-p port, --port port
Server port number.-U user, --username user
User name to connect as.-w, --no-password
Never prompt for password.-W, --password
Force password prompt.--maintenance-db db
Database to connect to when creating the new database. Defaults to postgres, or template1 if postgres does not exist.
CAVEATS
Requires CREATEDB privilege or superuser role. The default template is template1; use template0 for a clean database without local additions. Connection parameters can also be set via the standard PostgreSQL environment variables (PGHOST, PGPORT, PGUSER, PGDATABASE).
HISTORY
createdb has been part of the PostgreSQL distribution since its early versions, providing a simple command-line interface to the CREATE DATABASE SQL command.
