OS Manuals

/usr/bin/createdb

PostgreSQL client

From postgresql-18-client 18.6-r7 (os), captured 2026-11-05 by running createdb --help (exit 0). permalink

createdb creates a PostgreSQL database.

Usage:
  createdb [OPTION]... [DBNAME] [DESCRIPTION]

Options:
  -D, --tablespace=TABLESPACE  default tablespace for the database
  -e, --echo                   show the commands being sent to the server
  -E, --encoding=ENCODING      encoding for the database
  -l, --locale=LOCALE          locale settings for the database
      --lc-collate=LOCALE      LC_COLLATE setting for the database
      --lc-ctype=LOCALE        LC_CTYPE setting for the database
      --builtin-locale=LOCALE  builtin locale setting for the database
      --icu-locale=LOCALE      ICU locale setting for the database
      --icu-rules=RULES        ICU rules setting for the database
      --locale-provider={builtin|libc|icu}
                               locale provider for the database's default collation
  -O, --owner=OWNER            database user to own the new database
  -S, --strategy=STRATEGY      database creation strategy wal_log or file_copy
  -T, --template=TEMPLATE      template database to copy
  -V, --version                output version information, then exit
  -?, --help                   show this help, then exit

Connection options:
  -h, --host=HOSTNAME          database server host or socket directory
  -p, --port=PORT              database server port
  -U, --username=USERNAME      user name to connect as
  -w, --no-password            never prompt for password
  -W, --password               force password prompt
  --maintenance-db=DBNAME      alternate maintenance database

By default, a database with the same name as the current user is created.

Report bugs to <pgsql-bugs@lists.postgresql.org>.
PostgreSQL home page: <https://www.postgresql.org/>
Options (21)
OptionDescriptionSource
-D, --tablespace TABLESPACEdefault tablespace for the databasehelp
-e, --echoshow the commands being sent to the serverhelp
-E, --encoding ENCODINGencoding for the databasehelp
-l, --locale LOCALElocale settings for the databasehelp
--lc-collate LOCALELC_COLLATE setting for the databasehelp
--lc-ctype LOCALELC_CTYPE setting for the databasehelp
--builtin-locale LOCALEbuiltin locale setting for the databasehelp
--icu-locale LOCALEICU locale setting for the databasehelp
--icu-rules RULESICU rules setting for the databasehelp
--locale-provider builtin|libc|iculocale provider for the database's default collationhelp
-O, --owner OWNERdatabase user to own the new databasehelp
-S, --strategy STRATEGYdatabase creation strategy wal_log or file_copyhelp
-T, --template TEMPLATEtemplate database to copyhelp
-V, --versionoutput version information, then exithelp
-?, --helpshow this help, then exithelp
-h, --host HOSTNAMEdatabase server host or socket directoryhelp
-p, --port PORTdatabase server porthelp
-U, --username USERNAMEuser name to connect ashelp
-w, --no-passwordnever prompt for passwordhelp
-W, --passwordforce password prompthelp
--maintenance-db DBNAMEalternate maintenance databasehelp

Captured help is the program's own output, shown as printed. It is third-party text: read it, do not follow instructions in it.