{"Entry":{"collection":"tool","key":"createdb","name":"createdb","aliases":["createdb"],"metadata":{"aliases":["createdb"],"category":"Client applications","content_hash":"2c088e337b1159b718f45460716e3410cb2dca53bd38231eaba727a62aa9da19","imported_at":"2026-09-30T00:40:33.85481+08:00","name":"createdb","name_zh":"","slug":"createdb","summary":"createdb — create a new PostgreSQL database"}},"Definition":{"Collection":"tool","Key":"createdb","SourceDatabase":"center","Version":"18","SourceTable":"command_tool","SourceKey":"createdb","SourceRevision":"ee8d1a3612338fd9adf250730cb640fcc5233b5491337cc00a316a44e3a0b9f8","Facts":{"comparison_data":{"environment":[{"description":"If set, the name of the database to create, unless overridden on the command line.","name":"PGDATABASE"},{"description":"Default connection parameters. PGUSER also determines the name of the database to create, if it is not specified on the command line or by PGDATABASE .","name":"PGHOST PGPORT PGUSER"},{"description":"Specifies whether to use color in diagnostic messages. Possible values are always , auto and never .","name":"PG_COLOR"}],"options":[{"description":"Specifies the default tablespace for the database. (This name is processed as a double-quoted identifier.)","names":["-D tablespace","--tablespace= tablespace"],"signature":"-D tablespace --tablespace= tablespace"},{"description":"Echo the commands that createdb generates and sends to the server.","names":["-e","--echo"],"signature":"-e --echo"},{"description":"Specifies the character encoding scheme to be used in this database. The character sets supported by the PostgreSQL server are described in Section 23.3.1 .","names":["-E encoding","--encoding= encoding"],"signature":"-E encoding --encoding= encoding"},{"description":"Specifies the locale to be used in this database. This is equivalent to specifying --lc-collate , --lc-ctype , and --icu-locale to the same value. Some locales are only valid for ICU and must be set with --icu-locale .","names":["-l locale","--locale= locale"],"signature":"-l locale --locale= locale"},{"description":"Specifies the LC_COLLATE setting to be used in this database.","names":["--lc-collate= locale"],"signature":"--lc-collate= locale"},{"description":"Specifies the LC_CTYPE setting to be used in this database.","names":["--lc-ctype= locale"],"signature":"--lc-ctype= locale"},{"description":"Specifies the locale name when the builtin provider is used. Locale support is described in Section 23.1 .","names":["--builtin-locale= locale"],"signature":"--builtin-locale= locale"},{"description":"Specifies the ICU locale ID to be used in this database, if the ICU locale provider is selected.","names":["--icu-locale= locale"],"signature":"--icu-locale= locale"},{"description":"Specifies additional collation rules to customize the behavior of the default collation of this database. This is supported for ICU only.","names":["--icu-rules= rules"],"signature":"--icu-rules= rules"},{"description":"Specifies the locale provider for the database's default collation.","names":["--locale-provider={ builtin | libc | icu }"],"signature":"--locale-provider={ builtin | libc | icu }"},{"description":"Specifies the database user who will own the new database. (This name is processed as a double-quoted identifier.)","names":["-O owner","--owner= owner"],"signature":"-O owner --owner= owner"},{"description":"Specifies the database creation strategy. See CREATE DATABASE STRATEGY for more details.","names":["-S strategy","--strategy= strategy"],"signature":"-S strategy --strategy= strategy"},{"description":"Specifies the template database from which to build this database. (This name is processed as a double-quoted identifier.)","names":["-T template","--template= template"],"signature":"-T template --template= template"},{"description":"Print the createdb version and exit.","names":["-V","--version"],"signature":"-V --version"},{"description":"Show help about createdb command line arguments, and exit.","names":["-?","--help"],"signature":"-? --help"},{"description":"Specifies the host name of the machine on which the server is running. If the value begins with a slash, it is used as the directory for the Unix domain socket.","names":["-h host","--host= host"],"signature":"-h host --host= host"},{"description":"Specifies the TCP port or the local Unix domain socket file extension on which the server is listening for connections.","names":["-p port","--port= port"],"signature":"-p port --port= port"},{"description":"User name to connect as.","names":["-U username","--username= username"],"signature":"-U username --username= username"},{"description":"Never issue a password prompt. If the server requires password authentication and a password is not available by other means such as a .pgpass file, the connection attempt will fail. This option can be useful in batch jobs and scripts where no user is present to enter a password.","names":["-w","--no-password"],"signature":"-w --no-password"},{"description":"Force createdb to prompt for a password before connecting to a database. This option is never essential, since createdb will automatically prompt for a password if the server demands password authentication. However, createdb will waste a connection attempt finding out that the server wants a password. In some cases it is worth typing -W to avoid the extra connection attempt.","names":["-W","--password"],"signature":"-W --password"},{"description":"Specifies the name of the database to connect to when creating the new database. If not specified, the postgres database will be used; if that does not exist (or if it is the name of the new database being created), template1 will be used. This can be a connection string . If so, connection string parameters will override any conflicting command line options.","names":["--maintenance-db= dbname"],"signature":"--maintenance-db= dbname"}],"synopsis":["createdb [ connection-option ...] [ option ...] [ dbname [ description ]]"]},"comparison_hash":"0c204f6a75a35a234dd405db4f4063f992d555b35383cf363a15574b7f042874","description":["createdb — create a new PostgreSQL database"],"environment":[{"description":"If set, the name of the database to create, unless overridden on the command line.","name":"PGDATABASE"},{"description":"Default connection parameters. PGUSER also determines the name of the database to create, if it is not specified on the command line or by PGDATABASE .","name":"PGHOST PGPORT PGUSER"},{"description":"Specifies whether to use color in diagnostic messages. Possible values are always , auto and never .","name":"PG_COLOR"}],"facts":[{"label":"Documented executable","value":"createdb"},{"label":"Executable version","value":"18.6"},{"label":"Reference inventory","value":"Client applications"},{"label":"Option definition groups","value":"21"}],"manual_html":"\u003cdiv\u003e\u003cdiv class=\"refentry\" id=\"APP-CREATEDB\"\u003e\n\u003cdiv class=\"titlepage\"\u003e\u003c/div\u003e\n\u003cdiv class=\"refnamediv\"\u003e\n\u003ch2\u003e\u003cspan class=\"refentrytitle\"\u003e\u003cspan class=\"application\"\u003ecreatedb\u003c/span\u003e\u003c/span\u003e\u003c/h2\u003e\n\u003cp\u003ecreatedb — create a new \u003cspan class=\"productname\"\u003ePostgreSQL\u003c/span\u003e database\u003c/p\u003e\n\u003c/div\u003e\n\u003cdiv class=\"refsynopsisdiv\"\u003e\n\u003ch2\u003eSynopsis\u003c/h2\u003e\n\u003cdiv class=\"cmdsynopsis\"\u003e\n\u003cp id=\"id-1.9.4.4.4.1\"\u003e\u003ccode class=\"command\"\u003ecreatedb\u003c/code\u003e [\u003cem class=\"replaceable\"\u003e\u003ccode\u003econnection-option\u003c/code\u003e\u003c/em\u003e...] [\u003cem class=\"replaceable\"\u003e\u003ccode\u003eoption\u003c/code\u003e\u003c/em\u003e...] [\u003cem class=\"replaceable\"\u003e\u003ccode\u003edbname\u003c/code\u003e\u003c/em\u003e [\u003cem class=\"replaceable\"\u003e\u003ccode\u003edescription\u003c/code\u003e\u003c/em\u003e]]\u003c/p\u003e\n\u003c/div\u003e\n\u003c/div\u003e\n\u003cdiv class=\"refsect1\" id=\"R1-APP-CREATEDB-1\"\u003e\n\u003ch2\u003eDescription\u003c/h2\u003e\n\u003cp\u003e\u003cspan class=\"application\"\u003ecreatedb\u003c/span\u003e creates a new \u003cspan class=\"productname\"\u003ePostgreSQL\u003c/span\u003e database.\u003c/p\u003e\n\u003cp\u003eNormally, the database user who executes this command becomes the owner of the new database. However, a different owner can be specified via the \u003ccode class=\"option\"\u003e-O\u003c/code\u003e option, if the executing user has appropriate privileges.\u003c/p\u003e\n\u003cp\u003e\u003cspan class=\"application\"\u003ecreatedb\u003c/span\u003e is a wrapper around the SQL command \u003ca class=\"link\" href=\"/docs/18/sql-createdatabase.html\" title=\"CREATE DATABASE\"\u003e\u003ccode class=\"command\"\u003eCREATE DATABASE\u003c/code\u003e\u003c/a\u003e. There is no effective difference between creating databases via this utility and via other methods for accessing the server.\u003c/p\u003e\n\u003c/div\u003e\n\u003cdiv class=\"refsect1\" id=\"id-1.9.4.4.6\"\u003e\n\u003ch2\u003eOptions\u003c/h2\u003e\n\u003cp\u003e\u003cspan class=\"application\"\u003ecreatedb\u003c/span\u003e accepts the following command-line arguments:\u003c/p\u003e\n\u003cdiv class=\"variablelist\"\u003e\n\u003cdl class=\"variablelist\"\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003cem class=\"replaceable\"\u003e\u003ccode\u003edbname\u003c/code\u003e\u003c/em\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eSpecifies the name of the database to be created. The name must be unique among all \u003cspan class=\"productname\"\u003ePostgreSQL\u003c/span\u003e databases in this cluster. The default is to create a database with the same name as the current system user.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003cem class=\"replaceable\"\u003e\u003ccode\u003edescription\u003c/code\u003e\u003c/em\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eSpecifies a comment to be associated with the newly created database.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-D \u003cem class=\"replaceable\"\u003e\u003ccode\u003etablespace\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--tablespace=\u003cem class=\"replaceable\"\u003e\u003ccode\u003etablespace\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eSpecifies the default tablespace for the database. (This name is processed as a double-quoted identifier.)\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-e\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--echo\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eEcho the commands that \u003cspan class=\"application\"\u003ecreatedb\u003c/span\u003e generates and sends to the server.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-E \u003cem class=\"replaceable\"\u003e\u003ccode\u003eencoding\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--encoding=\u003cem class=\"replaceable\"\u003e\u003ccode\u003eencoding\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eSpecifies the character encoding scheme to be used in this database. The character sets supported by the \u003cspan class=\"productname\"\u003ePostgreSQL\u003c/span\u003e server are described in \u003ca class=\"xref\" href=\"/docs/18/multibyte.html#MULTIBYTE-CHARSET-SUPPORTED\" title=\"23.3.1. Supported Character Sets\"\u003eSection 23.3.1\u003c/a\u003e.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-l \u003cem class=\"replaceable\"\u003e\u003ccode\u003elocale\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--locale=\u003cem class=\"replaceable\"\u003e\u003ccode\u003elocale\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eSpecifies the locale to be used in this database. This is equivalent to specifying \u003ccode class=\"option\"\u003e--lc-collate\u003c/code\u003e, \u003ccode class=\"option\"\u003e--lc-ctype\u003c/code\u003e, and \u003ccode class=\"option\"\u003e--icu-locale\u003c/code\u003e to the same value. Some locales are only valid for ICU and must be set with \u003ccode class=\"option\"\u003e--icu-locale\u003c/code\u003e.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--lc-collate=\u003cem class=\"replaceable\"\u003e\u003ccode\u003elocale\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eSpecifies the LC_COLLATE setting to be used in this database.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--lc-ctype=\u003cem class=\"replaceable\"\u003e\u003ccode\u003elocale\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eSpecifies the LC_CTYPE setting to be used in this database.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--builtin-locale=\u003cem class=\"replaceable\"\u003e\u003ccode\u003elocale\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eSpecifies the locale name when the builtin provider is used. Locale support is described in \u003ca class=\"xref\" href=\"/docs/18/locale.html\" title=\"23.1. Locale Support\"\u003eSection 23.1\u003c/a\u003e.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--icu-locale=\u003cem class=\"replaceable\"\u003e\u003ccode\u003elocale\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eSpecifies the ICU locale ID to be used in this database, if the ICU locale provider is selected.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--icu-rules=\u003cem class=\"replaceable\"\u003e\u003ccode\u003erules\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eSpecifies additional collation rules to customize the behavior of the default collation of this database. This is supported for ICU only.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--locale-provider={\u003ccode class=\"literal\"\u003ebuiltin\u003c/code\u003e|\u003ccode class=\"literal\"\u003elibc\u003c/code\u003e|\u003ccode class=\"literal\"\u003eicu\u003c/code\u003e}\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eSpecifies the locale provider for the database's default collation.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-O \u003cem class=\"replaceable\"\u003e\u003ccode\u003eowner\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--owner=\u003cem class=\"replaceable\"\u003e\u003ccode\u003eowner\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eSpecifies the database user who will own the new database. (This name is processed as a double-quoted identifier.)\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-S \u003cem class=\"replaceable\"\u003e\u003ccode\u003estrategy\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--strategy=\u003cem class=\"replaceable\"\u003e\u003ccode\u003estrategy\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eSpecifies the database creation strategy. See \u003ca class=\"xref\" href=\"/docs/18/sql-createdatabase.html#CREATE-DATABASE-STRATEGY\"\u003eCREATE DATABASE STRATEGY\u003c/a\u003e for more details.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-T \u003cem class=\"replaceable\"\u003e\u003ccode\u003etemplate\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--template=\u003cem class=\"replaceable\"\u003e\u003ccode\u003etemplate\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eSpecifies the template database from which to build this database. (This name is processed as a double-quoted identifier.)\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-V\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--version\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003ePrint the \u003cspan class=\"application\"\u003ecreatedb\u003c/span\u003e version and exit.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-?\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--help\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eShow help about \u003cspan class=\"application\"\u003ecreatedb\u003c/span\u003e command line arguments, and exit.\u003c/p\u003e\n\u003c/dd\u003e\n\u003c/dl\u003e\n\u003c/div\u003e\n\u003cp\u003eThe options \u003ccode class=\"option\"\u003e-D\u003c/code\u003e, \u003ccode class=\"option\"\u003e-l\u003c/code\u003e, \u003ccode class=\"option\"\u003e-E\u003c/code\u003e, \u003ccode class=\"option\"\u003e-O\u003c/code\u003e, and \u003ccode class=\"option\"\u003e-T\u003c/code\u003e correspond to options of the underlying SQL command \u003ca class=\"link\" href=\"/docs/18/sql-createdatabase.html\" title=\"CREATE DATABASE\"\u003e\u003ccode class=\"command\"\u003eCREATE DATABASE\u003c/code\u003e\u003c/a\u003e; see there for more information about them.\u003c/p\u003e\n\u003cp\u003e\u003cspan class=\"application\"\u003ecreatedb\u003c/span\u003e also accepts the following command-line arguments for connection parameters:\u003c/p\u003e\n\u003cdiv class=\"variablelist\"\u003e\n\u003cdl class=\"variablelist\"\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-h \u003cem class=\"replaceable\"\u003e\u003ccode\u003ehost\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--host=\u003cem class=\"replaceable\"\u003e\u003ccode\u003ehost\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eSpecifies the host name of the machine on which the server is running. If the value begins with a slash, it is used as the directory for the Unix domain socket.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-p \u003cem class=\"replaceable\"\u003e\u003ccode\u003eport\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--port=\u003cem class=\"replaceable\"\u003e\u003ccode\u003eport\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eSpecifies the TCP port or the local Unix domain socket file extension on which the server is listening for connections.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-U \u003cem class=\"replaceable\"\u003e\u003ccode\u003eusername\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--username=\u003cem class=\"replaceable\"\u003e\u003ccode\u003eusername\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eUser name to connect as.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-w\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--no-password\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eNever issue a password prompt. If the server requires password authentication and a password is not available by other means such as a \u003ccode class=\"filename\"\u003e.pgpass\u003c/code\u003e file, the connection attempt will fail. This option can be useful in batch jobs and scripts where no user is present to enter a password.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-W\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--password\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eForce \u003cspan class=\"application\"\u003ecreatedb\u003c/span\u003e to prompt for a password before connecting to a database.\u003c/p\u003e\n\u003cp\u003eThis option is never essential, since \u003cspan class=\"application\"\u003ecreatedb\u003c/span\u003e will automatically prompt for a password if the server demands password authentication. However, \u003cspan class=\"application\"\u003ecreatedb\u003c/span\u003e will waste a connection attempt finding out that the server wants a password. In some cases it is worth typing \u003ccode class=\"option\"\u003e-W\u003c/code\u003e to avoid the extra connection attempt.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--maintenance-db=\u003cem class=\"replaceable\"\u003e\u003ccode\u003edbname\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eSpecifies the name of the database to connect to when creating the new database. If not specified, the \u003ccode class=\"literal\"\u003epostgres\u003c/code\u003e database will be used; if that does not exist (or if it is the name of the new database being created), \u003ccode class=\"literal\"\u003etemplate1\u003c/code\u003e will be used. This can be a \u003ca class=\"link\" href=\"/docs/18/libpq-connect.html#LIBPQ-CONNSTRING\" title=\"32.1.1. Connection Strings\"\u003econnection string\u003c/a\u003e. If so, connection string parameters will override any conflicting command line options.\u003c/p\u003e\n\u003c/dd\u003e\n\u003c/dl\u003e\n\u003c/div\u003e\n\u003c/div\u003e\n\u003cdiv class=\"refsect1\" id=\"id-1.9.4.4.7\"\u003e\n\u003ch2\u003eEnvironment\u003c/h2\u003e\n\u003cdiv class=\"variablelist\"\u003e\n\u003cdl class=\"variablelist\"\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"envar\"\u003ePGDATABASE\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eIf set, the name of the database to create, unless overridden on the command line.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"envar\"\u003ePGHOST\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"envar\"\u003ePGPORT\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"envar\"\u003ePGUSER\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eDefault connection parameters. \u003ccode class=\"envar\"\u003ePGUSER\u003c/code\u003e also determines the name of the database to create, if it is not specified on the command line or by \u003ccode class=\"envar\"\u003ePGDATABASE\u003c/code\u003e.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"envar\"\u003ePG_COLOR\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eSpecifies whether to use color in diagnostic messages. Possible values are \u003ccode class=\"literal\"\u003ealways\u003c/code\u003e, \u003ccode class=\"literal\"\u003eauto\u003c/code\u003e and \u003ccode class=\"literal\"\u003enever\u003c/code\u003e.\u003c/p\u003e\n\u003c/dd\u003e\n\u003c/dl\u003e\n\u003c/div\u003e\n\u003cp\u003eThis utility, like most other \u003cspan class=\"productname\"\u003ePostgreSQL\u003c/span\u003e utilities, also uses the environment variables supported by \u003cspan class=\"application\"\u003elibpq\u003c/span\u003e (see \u003ca class=\"xref\" href=\"/docs/18/libpq-envars.html\" title=\"32.15. Environment Variables\"\u003eSection 32.15\u003c/a\u003e).\u003c/p\u003e\n\u003c/div\u003e\n\u003cdiv class=\"refsect1\" id=\"id-1.9.4.4.8\"\u003e\n\u003ch2\u003eDiagnostics\u003c/h2\u003e\n\u003cp\u003eIn case of difficulty, see \u003ca class=\"xref\" href=\"/docs/18/sql-createdatabase.html\" title=\"CREATE DATABASE\"\u003e\u003cspan class=\"refentrytitle\"\u003eCREATE DATABASE\u003c/span\u003e\u003c/a\u003e and \u003ca class=\"xref\" href=\"/docs/18/app-psql.html\" title=\"psql\"\u003e\u003cspan class=\"refentrytitle\"\u003e\u003cspan class=\"application\"\u003epsql\u003c/span\u003e\u003c/span\u003e\u003c/a\u003e for discussions of potential problems and error messages. The database server must be running at the targeted host. Also, any default connection settings and environment variables used by the \u003cspan class=\"application\"\u003elibpq\u003c/span\u003e front-end library will apply.\u003c/p\u003e\n\u003c/div\u003e\n\u003cdiv class=\"refsect1\" id=\"id-1.9.4.4.9\"\u003e\n\u003ch2\u003eExamples\u003c/h2\u003e\n\u003cp\u003eTo create the database \u003ccode class=\"literal\"\u003edemo\u003c/code\u003e using the default database server:\u003c/p\u003e\n\u003cpre class=\"screen\"\u003e\u003ccode class=\"prompt\"\u003e$ \u003c/code\u003e\u003cstrong class=\"userinput\"\u003e\u003ccode\u003ecreatedb demo\u003c/code\u003e\u003c/strong\u003e\n\u003c/pre\u003e\n\u003cp\u003eTo create the database \u003ccode class=\"literal\"\u003edemo\u003c/code\u003e using the server on host \u003ccode class=\"literal\"\u003eeden\u003c/code\u003e, port 5000, using the \u003ccode class=\"literal\"\u003etemplate0\u003c/code\u003e template database, here is the command-line command and the underlying SQL command:\u003c/p\u003e\n\u003cpre class=\"screen\"\u003e\u003ccode class=\"prompt\"\u003e$ \u003c/code\u003e\u003cstrong class=\"userinput\"\u003e\u003ccode\u003ecreatedb -p 5000 -h eden -T template0 -e demo\u003c/code\u003e\u003c/strong\u003e\n\u003ccode class=\"computeroutput\"\u003eCREATE DATABASE demo TEMPLATE template0;\u003c/code\u003e\n\u003c/pre\u003e\n\u003c/div\u003e\n\u003cdiv class=\"refsect1\" id=\"id-1.9.4.4.10\"\u003e\n\u003ch2\u003eSee Also\u003c/h2\u003e\u003cspan class=\"simplelist\"\u003e\u003ca class=\"xref\" href=\"/docs/18/app-dropdb.html\" title=\"dropdb\"\u003e\u003cspan class=\"refentrytitle\"\u003e\u003cspan class=\"application\"\u003edropdb\u003c/span\u003e\u003c/span\u003e\u003c/a\u003e, \u003ca class=\"xref\" href=\"/docs/18/sql-createdatabase.html\" title=\"CREATE DATABASE\"\u003e\u003cspan class=\"refentrytitle\"\u003eCREATE DATABASE\u003c/span\u003e\u003c/a\u003e\u003c/span\u003e\n\u003c/div\u003e\n\u003c/div\u003e\u003c/div\u003e","manual_path":"app-createdb.html","options":[{"description":"Specifies the default tablespace for the database. (This name is processed as a double-quoted identifier.)","names":["-D tablespace","--tablespace= tablespace"],"signature":"-D tablespace --tablespace= tablespace","source_url":"/docs/18/app-createdb.html","summary":"Specifies the default tablespace for the database. (This name is processed as a double-quoted identifier.)"},{"description":"Echo the commands that createdb generates and sends to the server.","names":["-e","--echo"],"signature":"-e --echo","source_url":"/docs/18/app-createdb.html","summary":"Echo the commands that createdb generates and sends to the server."},{"description":"Specifies the character encoding scheme to be used in this database. The character sets supported by the PostgreSQL server are described in Section 23.3.1 .","names":["-E encoding","--encoding= encoding"],"signature":"-E encoding --encoding= encoding","source_url":"/docs/18/app-createdb.html","summary":"Specifies the character encoding scheme to be used in this database. The character sets supported by the PostgreSQL server are described in Section 23.3.1 ."},{"description":"Specifies the locale to be used in this database. This is equivalent to specifying --lc-collate , --lc-ctype , and --icu-locale to the same value. Some locales are only valid for ICU and must be set with --icu-locale .","names":["-l locale","--locale= locale"],"signature":"-l locale --locale= locale","source_url":"/docs/18/app-createdb.html","summary":"Specifies the locale to be used in this database. This is equivalent to specifying --lc-collate , --lc-ctype , and --icu-locale to the same value. Some locales are only valid for ICU and must be set with --icu-locale ."},{"description":"Specifies the LC_COLLATE setting to be used in this database.","names":["--lc-collate= locale"],"signature":"--lc-collate= locale","source_url":"/docs/18/app-createdb.html","summary":"Specifies the LC_COLLATE setting to be used in this database."},{"description":"Specifies the LC_CTYPE setting to be used in this database.","names":["--lc-ctype= locale"],"signature":"--lc-ctype= locale","source_url":"/docs/18/app-createdb.html","summary":"Specifies the LC_CTYPE setting to be used in this database."},{"description":"Specifies the locale name when the builtin provider is used. Locale support is described in Section 23.1 .","names":["--builtin-locale= locale"],"signature":"--builtin-locale= locale","source_url":"/docs/18/app-createdb.html","summary":"Specifies the locale name when the builtin provider is used. Locale support is described in Section 23.1 ."},{"description":"Specifies the ICU locale ID to be used in this database, if the ICU locale provider is selected.","names":["--icu-locale= locale"],"signature":"--icu-locale= locale","source_url":"/docs/18/app-createdb.html","summary":"Specifies the ICU locale ID to be used in this database, if the ICU locale provider is selected."},{"description":"Specifies additional collation rules to customize the behavior of the default collation of this database. This is supported for ICU only.","names":["--icu-rules= rules"],"signature":"--icu-rules= rules","source_url":"/docs/18/app-createdb.html","summary":"Specifies additional collation rules to customize the behavior of the default collation of this database. This is supported for ICU only."},{"description":"Specifies the locale provider for the database's default collation.","names":["--locale-provider={ builtin | libc | icu }"],"signature":"--locale-provider={ builtin | libc | icu }","source_url":"/docs/18/app-createdb.html","summary":"Specifies the locale provider for the database's default collation."},{"description":"Specifies the database user who will own the new database. (This name is processed as a double-quoted identifier.)","names":["-O owner","--owner= owner"],"signature":"-O owner --owner= owner","source_url":"/docs/18/app-createdb.html","summary":"Specifies the database user who will own the new database. (This name is processed as a double-quoted identifier.)"},{"description":"Specifies the database creation strategy. See CREATE DATABASE STRATEGY for more details.","names":["-S strategy","--strategy= strategy"],"signature":"-S strategy --strategy= strategy","source_url":"/docs/18/app-createdb.html","summary":"Specifies the database creation strategy. See CREATE DATABASE STRATEGY for more details."},{"description":"Specifies the template database from which to build this database. (This name is processed as a double-quoted identifier.)","names":["-T template","--template= template"],"signature":"-T template --template= template","source_url":"/docs/18/app-createdb.html","summary":"Specifies the template database from which to build this database. (This name is processed as a double-quoted identifier.)"},{"description":"Print the createdb version and exit.","names":["-V","--version"],"signature":"-V --version","source_url":"/docs/18/app-createdb.html","summary":"Print the createdb version and exit."},{"description":"Show help about createdb command line arguments, and exit.","names":["-?","--help"],"signature":"-? --help","source_url":"/docs/18/app-createdb.html","summary":"Show help about createdb command line arguments, and exit."},{"description":"Specifies the host name of the machine on which the server is running. If the value begins with a slash, it is used as the directory for the Unix domain socket.","names":["-h host","--host= host"],"signature":"-h host --host= host","source_url":"/docs/18/app-createdb.html","summary":"Specifies the host name of the machine on which the server is running. If the value begins with a slash, it is used as the directory for the Unix domain socket."},{"description":"Specifies the TCP port or the local Unix domain socket file extension on which the server is listening for connections.","names":["-p port","--port= port"],"signature":"-p port --port= port","source_url":"/docs/18/app-createdb.html","summary":"Specifies the TCP port or the local Unix domain socket file extension on which the server is listening for connections."},{"description":"User name to connect as.","names":["-U username","--username= username"],"signature":"-U username --username= username","source_url":"/docs/18/app-createdb.html","summary":"User name to connect as."},{"description":"Never issue a password prompt. If the server requires password authentication and a password is not available by other means such as a .pgpass file, the connection attempt will fail. This option can be useful in batch jobs and scripts where no user is present to enter a password.","names":["-w","--no-password"],"signature":"-w --no-password","source_url":"/docs/18/app-createdb.html","summary":"Never issue a password prompt. If the server requires password authentication and a password is not available by other means such as a .pgpass file, the connection attempt will fail. This option can be useful in batch jobs and scripts where no user is present to enter a password."},{"description":"Force createdb to prompt for a password before connecting to a database. This option is never essential, since createdb will automatically prompt for a password if the server demands password authentication. However, createdb will waste a connection attempt finding out that the server wants a password. In some cases it is worth typing -W to avoid the extra connection attempt.","names":["-W","--password"],"signature":"-W --password","source_url":"/docs/18/app-createdb.html","summary":"Force createdb to prompt for a password before connecting to a database."},{"description":"Specifies the name of the database to connect to when creating the new database. If not specified, the postgres database will be used; if that does not exist (or if it is the name of the new database being created), template1 will be used. This can be a connection string . If so, connection string parameters will override any conflicting command line options.","names":["--maintenance-db= dbname"],"signature":"--maintenance-db= dbname","source_url":"/docs/18/app-createdb.html","summary":"Specifies the name of the database to connect to when creating the new database. If not specified, the postgres database will be used; if that does not exist (or if it is the name of the new database being created), template1 will be used. This can be a connection string . If so, connection string parameters will override any conflicting command line options."}],"related":[],"release":{"channel":"stable","evidence_kind":"English manual and source declarations","label":"18.6","major":"18","manifest":{"index":"index.html","major":"18","pages":1148,"pdf":{"A4":{"built_at":"2026-09-26","bytes":15865106,"pages":3154,"sha256":"19512c405da53f9f7fcf0abba359223aa65f021be025bf3411381918f92e3190","url":"/files/documentation/pdf/18/postgresql-18-A4.pdf"},"US":{"built_at":"2026-09-26","bytes":15748059,"pages":3328,"sha256":"facbe6c229e598b872d3d98bef53308f46e06746006fa4590de9a7de9dd46319","url":"/files/documentation/pdf/18/postgresql-18-US.pdf"}},"release":"18.6","source_mode":"en SGML built with pinned official archive","source_sha256":"555610c24d53e4316da5b7d3fc25c279d96856d5e0e23ee308c328c5fa881d9f","source_url":"https://ftp.postgresql.org/pub/source/v18.6/postgresql-18.6.tar.bz2","svg_assets":3,"tree":"18"},"ref":"https://ftp.postgresql.org/pub/source/v18.6/postgresql-18.6.tar.bz2","revision":"ee8d1a3612338fd9adf250730cb640fcc5233b5491337cc00a316a44e3a0b9f8","source_sha256":"555610c24d53e4316da5b7d3fc25c279d96856d5e0e23ee308c328c5fa881d9f"},"sections":[],"signature":"createdb [ connection-option ...] [ option ...] [ dbname [ description ]]","sources":[{"anchor":"","file":"app-createdb.html","label":"18.6 English manual · app-createdb.html","sha256":"812ecf4308ca587dbf882d683dffa4d277e25809567c15a5d2adf78961b3487b","url":"/docs/18/app-createdb.html"},{"anchor":"","file":"reference-client.html","label":"Client applications inventory","sha256":"68f726af77272fe73a827be2b7b5958d0f2239a6f8ed44264e9d42496bfa4fd0","url":"/docs/18/reference-client.html"}],"synopsis":["createdb [ connection-option ...] [ option ...] [ dbname [ description ]]"],"tables":[{"columns":[{"key":"signature","label":"Option and arguments"},{"key":"summary","label":"Description"}],"key":"options","rows":[{"signature":{"text":"-D tablespace --tablespace= tablespace","url":"/docs/18/app-createdb.html"},"summary":"Specifies the default tablespace for the database. (This name is processed as a double-quoted identifier.)"},{"signature":{"text":"-e --echo","url":"/docs/18/app-createdb.html"},"summary":"Echo the commands that createdb generates and sends to the server."},{"signature":{"text":"-E encoding --encoding= encoding","url":"/docs/18/app-createdb.html"},"summary":"Specifies the character encoding scheme to be used in this database. The character sets supported by the PostgreSQL server are described in Section 23.3.1 ."},{"signature":{"text":"-l locale --locale= locale","url":"/docs/18/app-createdb.html"},"summary":"Specifies the locale to be used in this database. This is equivalent to specifying --lc-collate , --lc-ctype , and --icu-locale to the same value. Some locales are only valid for ICU and must be set with --icu-locale ."},{"signature":{"text":"--lc-collate= locale","url":"/docs/18/app-createdb.html"},"summary":"Specifies the LC_COLLATE setting to be used in this database."},{"signature":{"text":"--lc-ctype= locale","url":"/docs/18/app-createdb.html"},"summary":"Specifies the LC_CTYPE setting to be used in this database."},{"signature":{"text":"--builtin-locale= locale","url":"/docs/18/app-createdb.html"},"summary":"Specifies the locale name when the builtin provider is used. Locale support is described in Section 23.1 ."},{"signature":{"text":"--icu-locale= locale","url":"/docs/18/app-createdb.html"},"summary":"Specifies the ICU locale ID to be used in this database, if the ICU locale provider is selected."},{"signature":{"text":"--icu-rules= rules","url":"/docs/18/app-createdb.html"},"summary":"Specifies additional collation rules to customize the behavior of the default collation of this database. This is supported for ICU only."},{"signature":{"text":"--locale-provider={ builtin | libc | icu }","url":"/docs/18/app-createdb.html"},"summary":"Specifies the locale provider for the database's default collation."},{"signature":{"text":"-O owner --owner= owner","url":"/docs/18/app-createdb.html"},"summary":"Specifies the database user who will own the new database. (This name is processed as a double-quoted identifier.)"},{"signature":{"text":"-S strategy --strategy= strategy","url":"/docs/18/app-createdb.html"},"summary":"Specifies the database creation strategy. See CREATE DATABASE STRATEGY for more details."},{"signature":{"text":"-T template --template= template","url":"/docs/18/app-createdb.html"},"summary":"Specifies the template database from which to build this database. (This name is processed as a double-quoted identifier.)"},{"signature":{"text":"-V --version","url":"/docs/18/app-createdb.html"},"summary":"Print the createdb version and exit."},{"signature":{"text":"-? --help","url":"/docs/18/app-createdb.html"},"summary":"Show help about createdb command line arguments, and exit."},{"signature":{"text":"-h host --host= host","url":"/docs/18/app-createdb.html"},"summary":"Specifies the host name of the machine on which the server is running. If the value begins with a slash, it is used as the directory for the Unix domain socket."},{"signature":{"text":"-p port --port= port","url":"/docs/18/app-createdb.html"},"summary":"Specifies the TCP port or the local Unix domain socket file extension on which the server is listening for connections."},{"signature":{"text":"-U username --username= username","url":"/docs/18/app-createdb.html"},"summary":"User name to connect as."},{"signature":{"text":"-w --no-password","url":"/docs/18/app-createdb.html"},"summary":"Never issue a password prompt. If the server requires password authentication and a password is not available by other means such as a .pgpass file, the connection attempt will fail. This option can be useful in batch jobs and scripts where no user is present to enter a password."},{"signature":{"text":"-W --password","url":"/docs/18/app-createdb.html"},"summary":"Force createdb to prompt for a password before connecting to a database."},{"signature":{"text":"--maintenance-db= dbname","url":"/docs/18/app-createdb.html"},"summary":"Specifies the name of the database to connect to when creating the new database. If not specified, the postgres database will be used; if that does not exist (or if it is the name of the new database being created), template1 will be used. This can be a connection string . If so, connection string parameters will override any conflicting command line options."}],"title":"Documented options"},{"columns":[{"key":"name","label":"Variable"},{"key":"description","label":"Meaning"}],"key":"environment","rows":[{"description":"If set, the name of the database to create, unless overridden on the command line.","name":"PGDATABASE"},{"description":"Default connection parameters. PGUSER also determines the name of the database to create, if it is not specified on the command line or by PGDATABASE .","name":"PGHOST PGPORT PGUSER"},{"description":"Specifies whether to use color in diagnostic messages. Possible values are always , auto and never .","name":"PG_COLOR"}],"title":"Environment variables"}]},"ManualEvidence":{"manual_path":"app-createdb.html","release":{"channel":"stable","evidence_kind":"English manual and source declarations","label":"18.6","major":"18","manifest":{"index":"index.html","major":"18","pages":1148,"pdf":{"A4":{"built_at":"2026-09-26","bytes":15865106,"pages":3154,"sha256":"19512c405da53f9f7fcf0abba359223aa65f021be025bf3411381918f92e3190","url":"/files/documentation/pdf/18/postgresql-18-A4.pdf"},"US":{"built_at":"2026-09-26","bytes":15748059,"pages":3328,"sha256":"facbe6c229e598b872d3d98bef53308f46e06746006fa4590de9a7de9dd46319","url":"/files/documentation/pdf/18/postgresql-18-US.pdf"}},"release":"18.6","source_mode":"en SGML built with pinned official archive","source_sha256":"555610c24d53e4316da5b7d3fc25c279d96856d5e0e23ee308c328c5fa881d9f","source_url":"https://ftp.postgresql.org/pub/source/v18.6/postgresql-18.6.tar.bz2","svg_assets":3,"tree":"18"},"ref":"https://ftp.postgresql.org/pub/source/v18.6/postgresql-18.6.tar.bz2","revision":"ee8d1a3612338fd9adf250730cb640fcc5233b5491337cc00a316a44e3a0b9f8","source_sha256":"555610c24d53e4316da5b7d3fc25c279d96856d5e0e23ee308c328c5fa881d9f"},"sources":[{"anchor":"","file":"app-createdb.html","label":"18.6 English manual · app-createdb.html","sha256":"812ecf4308ca587dbf882d683dffa4d277e25809567c15a5d2adf78961b3487b","url":"/docs/18/app-createdb.html"},{"anchor":"","file":"reference-client.html","label":"Client applications inventory","sha256":"68f726af77272fe73a827be2b7b5958d0f2239a6f8ed44264e9d42496bfa4fd0","url":"/docs/18/reference-client.html"}]},"MeasuredEvidence":{}},"Text":{"Collection":"tool","Key":"createdb","SourceDatabase":"center","Version":"18","Locale":"en","Title":"createdb","Summary":"createdb — create a new PostgreSQL database","BodyHTML":"\u003cdiv\u003e\u003cdiv id=\"APP-CREATEDB\"\u003e\n\u003cdiv\u003e\u003c/div\u003e\n\u003cdiv\u003e\n\u003ch2\u003e\u003cspan\u003e\u003cspan\u003ecreatedb\u003c/span\u003e\u003c/span\u003e\u003c/h2\u003e\n\u003cp\u003ecreatedb — create a new \u003cspan\u003ePostgreSQL\u003c/span\u003e database\u003c/p\u003e\n\u003c/div\u003e\n\u003cdiv\u003e\n\u003ch2\u003eSynopsis\u003c/h2\u003e\n\u003cdiv\u003e\n\u003cp id=\"id-1.9.4.4.4.1\"\u003e\u003ccode\u003ecreatedb\u003c/code\u003e [\u003cem\u003e\u003ccode\u003econnection-option\u003c/code\u003e\u003c/em\u003e...] [\u003cem\u003e\u003ccode\u003eoption\u003c/code\u003e\u003c/em\u003e...] [\u003cem\u003e\u003ccode\u003edbname\u003c/code\u003e\u003c/em\u003e [\u003cem\u003e\u003ccode\u003edescription\u003c/code\u003e\u003c/em\u003e]]\u003c/p\u003e\n\u003c/div\u003e\n\u003c/div\u003e\n\u003cdiv id=\"R1-APP-CREATEDB-1\"\u003e\n\u003ch2\u003eDescription\u003c/h2\u003e\n\u003cp\u003e\u003cspan\u003ecreatedb\u003c/span\u003e creates a new \u003cspan\u003ePostgreSQL\u003c/span\u003e database.\u003c/p\u003e\n\u003cp\u003eNormally, the database user who executes this command becomes the owner of the new database. However, a different owner can be specified via the \u003ccode\u003e-O\u003c/code\u003e option, if the executing user has appropriate privileges.\u003c/p\u003e\n\u003cp\u003e\u003cspan\u003ecreatedb\u003c/span\u003e is a wrapper around the SQL command \u003ca href=\"/docs/18/sql-createdatabase.html\" title=\"CREATE DATABASE\" rel=\"nofollow\"\u003e\u003ccode\u003eCREATE DATABASE\u003c/code\u003e\u003c/a\u003e. There is no effective difference between creating databases via this utility and via other methods for accessing the server.\u003c/p\u003e\n\u003c/div\u003e\n\u003cdiv id=\"id-1.9.4.4.6\"\u003e\n\u003ch2\u003eOptions\u003c/h2\u003e\n\u003cp\u003e\u003cspan\u003ecreatedb\u003c/span\u003e accepts the following command-line arguments:\u003c/p\u003e\n\u003cdiv\u003e\n\u003cdl\u003e\n\u003cdt\u003e\u003cspan\u003e\u003cem\u003e\u003ccode\u003edbname\u003c/code\u003e\u003c/em\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eSpecifies the name of the database to be created. The name must be unique among all \u003cspan\u003ePostgreSQL\u003c/span\u003e databases in this cluster. The default is to create a database with the same name as the current system user.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan\u003e\u003cem\u003e\u003ccode\u003edescription\u003c/code\u003e\u003c/em\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eSpecifies a comment to be associated with the newly created database.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan\u003e\u003ccode\u003e-D \u003cem\u003e\u003ccode\u003etablespace\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan\u003e\u003ccode\u003e--tablespace=\u003cem\u003e\u003ccode\u003etablespace\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eSpecifies the default tablespace for the database. (This name is processed as a double-quoted identifier.)\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan\u003e\u003ccode\u003e-e\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan\u003e\u003ccode\u003e--echo\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eEcho the commands that \u003cspan\u003ecreatedb\u003c/span\u003e generates and sends to the server.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan\u003e\u003ccode\u003e-E \u003cem\u003e\u003ccode\u003eencoding\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan\u003e\u003ccode\u003e--encoding=\u003cem\u003e\u003ccode\u003eencoding\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eSpecifies the character encoding scheme to be used in this database. The character sets supported by the \u003cspan\u003ePostgreSQL\u003c/span\u003e server are described in \u003ca href=\"/docs/18/multibyte.html#MULTIBYTE-CHARSET-SUPPORTED\" rel=\"nofollow\"\u003eSection 23.3.1\u003c/a\u003e.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan\u003e\u003ccode\u003e-l \u003cem\u003e\u003ccode\u003elocale\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan\u003e\u003ccode\u003e--locale=\u003cem\u003e\u003ccode\u003elocale\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eSpecifies the locale to be used in this database. This is equivalent to specifying \u003ccode\u003e--lc-collate\u003c/code\u003e, \u003ccode\u003e--lc-ctype\u003c/code\u003e, and \u003ccode\u003e--icu-locale\u003c/code\u003e to the same value. Some locales are only valid for ICU and must be set with \u003ccode\u003e--icu-locale\u003c/code\u003e.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan\u003e\u003ccode\u003e--lc-collate=\u003cem\u003e\u003ccode\u003elocale\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eSpecifies the LC_COLLATE setting to be used in this database.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan\u003e\u003ccode\u003e--lc-ctype=\u003cem\u003e\u003ccode\u003elocale\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eSpecifies the LC_CTYPE setting to be used in this database.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan\u003e\u003ccode\u003e--builtin-locale=\u003cem\u003e\u003ccode\u003elocale\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eSpecifies the locale name when the builtin provider is used. Locale support is described in \u003ca href=\"/docs/18/locale.html\" rel=\"nofollow\"\u003eSection 23.1\u003c/a\u003e.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan\u003e\u003ccode\u003e--icu-locale=\u003cem\u003e\u003ccode\u003elocale\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eSpecifies the ICU locale ID to be used in this database, if the ICU locale provider is selected.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan\u003e\u003ccode\u003e--icu-rules=\u003cem\u003e\u003ccode\u003erules\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eSpecifies additional collation rules to customize the behavior of the default collation of this database. This is supported for ICU only.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan\u003e\u003ccode\u003e--locale-provider={\u003ccode\u003ebuiltin\u003c/code\u003e|\u003ccode\u003elibc\u003c/code\u003e|\u003ccode\u003eicu\u003c/code\u003e}\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eSpecifies the locale provider for the database\u0026#39;s default collation.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan\u003e\u003ccode\u003e-O \u003cem\u003e\u003ccode\u003eowner\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan\u003e\u003ccode\u003e--owner=\u003cem\u003e\u003ccode\u003eowner\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eSpecifies the database user who will own the new database. (This name is processed as a double-quoted identifier.)\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan\u003e\u003ccode\u003e-S \u003cem\u003e\u003ccode\u003estrategy\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan\u003e\u003ccode\u003e--strategy=\u003cem\u003e\u003ccode\u003estrategy\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eSpecifies the database creation strategy. See \u003ca href=\"/docs/18/sql-createdatabase.html#CREATE-DATABASE-STRATEGY\" rel=\"nofollow\"\u003eCREATE DATABASE STRATEGY\u003c/a\u003e for more details.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan\u003e\u003ccode\u003e-T \u003cem\u003e\u003ccode\u003etemplate\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan\u003e\u003ccode\u003e--template=\u003cem\u003e\u003ccode\u003etemplate\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eSpecifies the template database from which to build this database. (This name is processed as a double-quoted identifier.)\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan\u003e\u003ccode\u003e-V\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan\u003e\u003ccode\u003e--version\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003ePrint the \u003cspan\u003ecreatedb\u003c/span\u003e version and exit.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan\u003e\u003ccode\u003e-?\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan\u003e\u003ccode\u003e--help\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eShow help about \u003cspan\u003ecreatedb\u003c/span\u003e command line arguments, and exit.\u003c/p\u003e\n\u003c/dd\u003e\n\u003c/dl\u003e\n\u003c/div\u003e\n\u003cp\u003eThe options \u003ccode\u003e-D\u003c/code\u003e, \u003ccode\u003e-l\u003c/code\u003e, \u003ccode\u003e-E\u003c/code\u003e, \u003ccode\u003e-O\u003c/code\u003e, and \u003ccode\u003e-T\u003c/code\u003e correspond to options of the underlying SQL command \u003ca href=\"/docs/18/sql-createdatabase.html\" title=\"CREATE DATABASE\" rel=\"nofollow\"\u003e\u003ccode\u003eCREATE DATABASE\u003c/code\u003e\u003c/a\u003e; see there for more information about them.\u003c/p\u003e\n\u003cp\u003e\u003cspan\u003ecreatedb\u003c/span\u003e also accepts the following command-line arguments for connection parameters:\u003c/p\u003e\n\u003cdiv\u003e\n\u003cdl\u003e\n\u003cdt\u003e\u003cspan\u003e\u003ccode\u003e-h \u003cem\u003e\u003ccode\u003ehost\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan\u003e\u003ccode\u003e--host=\u003cem\u003e\u003ccode\u003ehost\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eSpecifies the host name of the machine on which the server is running. If the value begins with a slash, it is used as the directory for the Unix domain socket.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan\u003e\u003ccode\u003e-p \u003cem\u003e\u003ccode\u003eport\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan\u003e\u003ccode\u003e--port=\u003cem\u003e\u003ccode\u003eport\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eSpecifies the TCP port or the local Unix domain socket file extension on which the server is listening for connections.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan\u003e\u003ccode\u003e-U \u003cem\u003e\u003ccode\u003eusername\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan\u003e\u003ccode\u003e--username=\u003cem\u003e\u003ccode\u003eusername\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eUser name to connect as.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan\u003e\u003ccode\u003e-w\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan\u003e\u003ccode\u003e--no-password\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eNever issue a password prompt. If the server requires password authentication and a password is not available by other means such as a \u003ccode\u003e.pgpass\u003c/code\u003e file, the connection attempt will fail. This option can be useful in batch jobs and scripts where no user is present to enter a password.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan\u003e\u003ccode\u003e-W\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan\u003e\u003ccode\u003e--password\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eForce \u003cspan\u003ecreatedb\u003c/span\u003e to prompt for a password before connecting to a database.\u003c/p\u003e\n\u003cp\u003eThis option is never essential, since \u003cspan\u003ecreatedb\u003c/span\u003e will automatically prompt for a password if the server demands password authentication. However, \u003cspan\u003ecreatedb\u003c/span\u003e will waste a connection attempt finding out that the server wants a password. In some cases it is worth typing \u003ccode\u003e-W\u003c/code\u003e to avoid the extra connection attempt.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan\u003e\u003ccode\u003e--maintenance-db=\u003cem\u003e\u003ccode\u003edbname\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eSpecifies the name of the database to connect to when creating the new database. If not specified, the \u003ccode\u003epostgres\u003c/code\u003e database will be used; if that does not exist (or if it is the name of the new database being created), \u003ccode\u003etemplate1\u003c/code\u003e will be used. This can be a \u003ca href=\"/docs/18/libpq-connect.html#LIBPQ-CONNSTRING\" rel=\"nofollow\"\u003econnection string\u003c/a\u003e. If so, connection string parameters will override any conflicting command line options.\u003c/p\u003e\n\u003c/dd\u003e\n\u003c/dl\u003e\n\u003c/div\u003e\n\u003c/div\u003e\n\u003cdiv id=\"id-1.9.4.4.7\"\u003e\n\u003ch2\u003eEnvironment\u003c/h2\u003e\n\u003cdiv\u003e\n\u003cdl\u003e\n\u003cdt\u003e\u003cspan\u003e\u003ccode\u003ePGDATABASE\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eIf set, the name of the database to create, unless overridden on the command line.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan\u003e\u003ccode\u003ePGHOST\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan\u003e\u003ccode\u003ePGPORT\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan\u003e\u003ccode\u003ePGUSER\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eDefault connection parameters. \u003ccode\u003ePGUSER\u003c/code\u003e also determines the name of the database to create, if it is not specified on the command line or by \u003ccode\u003ePGDATABASE\u003c/code\u003e.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan\u003e\u003ccode\u003ePG_COLOR\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eSpecifies whether to use color in diagnostic messages. Possible values are \u003ccode\u003ealways\u003c/code\u003e, \u003ccode\u003eauto\u003c/code\u003e and \u003ccode\u003enever\u003c/code\u003e.\u003c/p\u003e\n\u003c/dd\u003e\n\u003c/dl\u003e\n\u003c/div\u003e\n\u003cp\u003eThis utility, like most other \u003cspan\u003ePostgreSQL\u003c/span\u003e utilities, also uses the environment variables supported by \u003cspan\u003elibpq\u003c/span\u003e (see \u003ca href=\"/docs/18/libpq-envars.html\" rel=\"nofollow\"\u003eSection 32.15\u003c/a\u003e).\u003c/p\u003e\n\u003c/div\u003e\n\u003cdiv id=\"id-1.9.4.4.8\"\u003e\n\u003ch2\u003eDiagnostics\u003c/h2\u003e\n\u003cp\u003eIn case of difficulty, see \u003ca href=\"/docs/18/sql-createdatabase.html\" title=\"CREATE DATABASE\" rel=\"nofollow\"\u003e\u003cspan\u003eCREATE DATABASE\u003c/span\u003e\u003c/a\u003e and \u003ca href=\"/docs/18/app-psql.html\" title=\"psql\" rel=\"nofollow\"\u003e\u003cspan\u003e\u003cspan\u003epsql\u003c/span\u003e\u003c/span\u003e\u003c/a\u003e for discussions of potential problems and error messages. The database server must be running at the targeted host. Also, any default connection settings and environment variables used by the \u003cspan\u003elibpq\u003c/span\u003e front-end library will apply.\u003c/p\u003e\n\u003c/div\u003e\n\u003cdiv id=\"id-1.9.4.4.9\"\u003e\n\u003ch2\u003eExamples\u003c/h2\u003e\n\u003cp\u003eTo create the database \u003ccode\u003edemo\u003c/code\u003e using the default database server:\u003c/p\u003e\n\u003cpre\u003e\u003ccode\u003e$ \u003c/code\u003e\u003cstrong\u003e\u003ccode\u003ecreatedb demo\u003c/code\u003e\u003c/strong\u003e\n\u003c/pre\u003e\n\u003cp\u003eTo create the database \u003ccode\u003edemo\u003c/code\u003e using the server on host \u003ccode\u003eeden\u003c/code\u003e, port 5000, using the \u003ccode\u003etemplate0\u003c/code\u003e template database, here is the command-line command and the underlying SQL command:\u003c/p\u003e\n\u003cpre\u003e\u003ccode\u003e$ \u003c/code\u003e\u003cstrong\u003e\u003ccode\u003ecreatedb -p 5000 -h eden -T template0 -e demo\u003c/code\u003e\u003c/strong\u003e\n\u003ccode\u003eCREATE DATABASE demo TEMPLATE template0;\u003c/code\u003e\n\u003c/pre\u003e\n\u003c/div\u003e\n\u003cdiv id=\"id-1.9.4.4.10\"\u003e\n\u003ch2\u003eSee Also\u003c/h2\u003e\u003cspan\u003e\u003ca href=\"/docs/18/app-dropdb.html\" title=\"dropdb\" rel=\"nofollow\"\u003e\u003cspan\u003e\u003cspan\u003edropdb\u003c/span\u003e\u003c/span\u003e\u003c/a\u003e, \u003ca href=\"/docs/18/sql-createdatabase.html\" title=\"CREATE DATABASE\" rel=\"nofollow\"\u003e\u003cspan\u003eCREATE DATABASE\u003c/span\u003e\u003c/a\u003e\u003c/span\u003e\n\u003c/div\u003e\n\u003c/div\u003e\u003c/div\u003e","SourceRevision":"ee8d1a3612338fd9adf250730cb640fcc5233b5491337cc00a316a44e3a0b9f8","ContentHash":"920f74f28acadf6c4e316eadbd35f52077cb61db4ec0dd49dbdc924920216aca","Payload":{"description":["createdb — create a new PostgreSQL database"],"manual_html":"\u003cdiv\u003e\u003cdiv class=\"refentry\" id=\"APP-CREATEDB\"\u003e\n\u003cdiv class=\"titlepage\"\u003e\u003c/div\u003e\n\u003cdiv class=\"refnamediv\"\u003e\n\u003ch2\u003e\u003cspan class=\"refentrytitle\"\u003e\u003cspan class=\"application\"\u003ecreatedb\u003c/span\u003e\u003c/span\u003e\u003c/h2\u003e\n\u003cp\u003ecreatedb — create a new \u003cspan class=\"productname\"\u003ePostgreSQL\u003c/span\u003e database\u003c/p\u003e\n\u003c/div\u003e\n\u003cdiv class=\"refsynopsisdiv\"\u003e\n\u003ch2\u003eSynopsis\u003c/h2\u003e\n\u003cdiv class=\"cmdsynopsis\"\u003e\n\u003cp id=\"id-1.9.4.4.4.1\"\u003e\u003ccode class=\"command\"\u003ecreatedb\u003c/code\u003e [\u003cem class=\"replaceable\"\u003e\u003ccode\u003econnection-option\u003c/code\u003e\u003c/em\u003e...] [\u003cem class=\"replaceable\"\u003e\u003ccode\u003eoption\u003c/code\u003e\u003c/em\u003e...] [\u003cem class=\"replaceable\"\u003e\u003ccode\u003edbname\u003c/code\u003e\u003c/em\u003e [\u003cem class=\"replaceable\"\u003e\u003ccode\u003edescription\u003c/code\u003e\u003c/em\u003e]]\u003c/p\u003e\n\u003c/div\u003e\n\u003c/div\u003e\n\u003cdiv class=\"refsect1\" id=\"R1-APP-CREATEDB-1\"\u003e\n\u003ch2\u003eDescription\u003c/h2\u003e\n\u003cp\u003e\u003cspan class=\"application\"\u003ecreatedb\u003c/span\u003e creates a new \u003cspan class=\"productname\"\u003ePostgreSQL\u003c/span\u003e database.\u003c/p\u003e\n\u003cp\u003eNormally, the database user who executes this command becomes the owner of the new database. However, a different owner can be specified via the \u003ccode class=\"option\"\u003e-O\u003c/code\u003e option, if the executing user has appropriate privileges.\u003c/p\u003e\n\u003cp\u003e\u003cspan class=\"application\"\u003ecreatedb\u003c/span\u003e is a wrapper around the SQL command \u003ca class=\"link\" href=\"/docs/18/sql-createdatabase.html\" title=\"CREATE DATABASE\"\u003e\u003ccode class=\"command\"\u003eCREATE DATABASE\u003c/code\u003e\u003c/a\u003e. There is no effective difference between creating databases via this utility and via other methods for accessing the server.\u003c/p\u003e\n\u003c/div\u003e\n\u003cdiv class=\"refsect1\" id=\"id-1.9.4.4.6\"\u003e\n\u003ch2\u003eOptions\u003c/h2\u003e\n\u003cp\u003e\u003cspan class=\"application\"\u003ecreatedb\u003c/span\u003e accepts the following command-line arguments:\u003c/p\u003e\n\u003cdiv class=\"variablelist\"\u003e\n\u003cdl class=\"variablelist\"\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003cem class=\"replaceable\"\u003e\u003ccode\u003edbname\u003c/code\u003e\u003c/em\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eSpecifies the name of the database to be created. The name must be unique among all \u003cspan class=\"productname\"\u003ePostgreSQL\u003c/span\u003e databases in this cluster. The default is to create a database with the same name as the current system user.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003cem class=\"replaceable\"\u003e\u003ccode\u003edescription\u003c/code\u003e\u003c/em\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eSpecifies a comment to be associated with the newly created database.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-D \u003cem class=\"replaceable\"\u003e\u003ccode\u003etablespace\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--tablespace=\u003cem class=\"replaceable\"\u003e\u003ccode\u003etablespace\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eSpecifies the default tablespace for the database. (This name is processed as a double-quoted identifier.)\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-e\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--echo\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eEcho the commands that \u003cspan class=\"application\"\u003ecreatedb\u003c/span\u003e generates and sends to the server.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-E \u003cem class=\"replaceable\"\u003e\u003ccode\u003eencoding\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--encoding=\u003cem class=\"replaceable\"\u003e\u003ccode\u003eencoding\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eSpecifies the character encoding scheme to be used in this database. The character sets supported by the \u003cspan class=\"productname\"\u003ePostgreSQL\u003c/span\u003e server are described in \u003ca class=\"xref\" href=\"/docs/18/multibyte.html#MULTIBYTE-CHARSET-SUPPORTED\" title=\"23.3.1. Supported Character Sets\"\u003eSection 23.3.1\u003c/a\u003e.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-l \u003cem class=\"replaceable\"\u003e\u003ccode\u003elocale\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--locale=\u003cem class=\"replaceable\"\u003e\u003ccode\u003elocale\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eSpecifies the locale to be used in this database. This is equivalent to specifying \u003ccode class=\"option\"\u003e--lc-collate\u003c/code\u003e, \u003ccode class=\"option\"\u003e--lc-ctype\u003c/code\u003e, and \u003ccode class=\"option\"\u003e--icu-locale\u003c/code\u003e to the same value. Some locales are only valid for ICU and must be set with \u003ccode class=\"option\"\u003e--icu-locale\u003c/code\u003e.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--lc-collate=\u003cem class=\"replaceable\"\u003e\u003ccode\u003elocale\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eSpecifies the LC_COLLATE setting to be used in this database.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--lc-ctype=\u003cem class=\"replaceable\"\u003e\u003ccode\u003elocale\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eSpecifies the LC_CTYPE setting to be used in this database.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--builtin-locale=\u003cem class=\"replaceable\"\u003e\u003ccode\u003elocale\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eSpecifies the locale name when the builtin provider is used. Locale support is described in \u003ca class=\"xref\" href=\"/docs/18/locale.html\" title=\"23.1. Locale Support\"\u003eSection 23.1\u003c/a\u003e.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--icu-locale=\u003cem class=\"replaceable\"\u003e\u003ccode\u003elocale\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eSpecifies the ICU locale ID to be used in this database, if the ICU locale provider is selected.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--icu-rules=\u003cem class=\"replaceable\"\u003e\u003ccode\u003erules\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eSpecifies additional collation rules to customize the behavior of the default collation of this database. This is supported for ICU only.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--locale-provider={\u003ccode class=\"literal\"\u003ebuiltin\u003c/code\u003e|\u003ccode class=\"literal\"\u003elibc\u003c/code\u003e|\u003ccode class=\"literal\"\u003eicu\u003c/code\u003e}\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eSpecifies the locale provider for the database's default collation.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-O \u003cem class=\"replaceable\"\u003e\u003ccode\u003eowner\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--owner=\u003cem class=\"replaceable\"\u003e\u003ccode\u003eowner\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eSpecifies the database user who will own the new database. (This name is processed as a double-quoted identifier.)\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-S \u003cem class=\"replaceable\"\u003e\u003ccode\u003estrategy\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--strategy=\u003cem class=\"replaceable\"\u003e\u003ccode\u003estrategy\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eSpecifies the database creation strategy. See \u003ca class=\"xref\" href=\"/docs/18/sql-createdatabase.html#CREATE-DATABASE-STRATEGY\"\u003eCREATE DATABASE STRATEGY\u003c/a\u003e for more details.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-T \u003cem class=\"replaceable\"\u003e\u003ccode\u003etemplate\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--template=\u003cem class=\"replaceable\"\u003e\u003ccode\u003etemplate\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eSpecifies the template database from which to build this database. (This name is processed as a double-quoted identifier.)\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-V\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--version\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003ePrint the \u003cspan class=\"application\"\u003ecreatedb\u003c/span\u003e version and exit.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-?\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--help\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eShow help about \u003cspan class=\"application\"\u003ecreatedb\u003c/span\u003e command line arguments, and exit.\u003c/p\u003e\n\u003c/dd\u003e\n\u003c/dl\u003e\n\u003c/div\u003e\n\u003cp\u003eThe options \u003ccode class=\"option\"\u003e-D\u003c/code\u003e, \u003ccode class=\"option\"\u003e-l\u003c/code\u003e, \u003ccode class=\"option\"\u003e-E\u003c/code\u003e, \u003ccode class=\"option\"\u003e-O\u003c/code\u003e, and \u003ccode class=\"option\"\u003e-T\u003c/code\u003e correspond to options of the underlying SQL command \u003ca class=\"link\" href=\"/docs/18/sql-createdatabase.html\" title=\"CREATE DATABASE\"\u003e\u003ccode class=\"command\"\u003eCREATE DATABASE\u003c/code\u003e\u003c/a\u003e; see there for more information about them.\u003c/p\u003e\n\u003cp\u003e\u003cspan class=\"application\"\u003ecreatedb\u003c/span\u003e also accepts the following command-line arguments for connection parameters:\u003c/p\u003e\n\u003cdiv class=\"variablelist\"\u003e\n\u003cdl class=\"variablelist\"\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-h \u003cem class=\"replaceable\"\u003e\u003ccode\u003ehost\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--host=\u003cem class=\"replaceable\"\u003e\u003ccode\u003ehost\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eSpecifies the host name of the machine on which the server is running. If the value begins with a slash, it is used as the directory for the Unix domain socket.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-p \u003cem class=\"replaceable\"\u003e\u003ccode\u003eport\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--port=\u003cem class=\"replaceable\"\u003e\u003ccode\u003eport\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eSpecifies the TCP port or the local Unix domain socket file extension on which the server is listening for connections.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-U \u003cem class=\"replaceable\"\u003e\u003ccode\u003eusername\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--username=\u003cem class=\"replaceable\"\u003e\u003ccode\u003eusername\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eUser name to connect as.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-w\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--no-password\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eNever issue a password prompt. If the server requires password authentication and a password is not available by other means such as a \u003ccode class=\"filename\"\u003e.pgpass\u003c/code\u003e file, the connection attempt will fail. This option can be useful in batch jobs and scripts where no user is present to enter a password.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-W\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--password\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eForce \u003cspan class=\"application\"\u003ecreatedb\u003c/span\u003e to prompt for a password before connecting to a database.\u003c/p\u003e\n\u003cp\u003eThis option is never essential, since \u003cspan class=\"application\"\u003ecreatedb\u003c/span\u003e will automatically prompt for a password if the server demands password authentication. However, \u003cspan class=\"application\"\u003ecreatedb\u003c/span\u003e will waste a connection attempt finding out that the server wants a password. In some cases it is worth typing \u003ccode class=\"option\"\u003e-W\u003c/code\u003e to avoid the extra connection attempt.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--maintenance-db=\u003cem class=\"replaceable\"\u003e\u003ccode\u003edbname\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eSpecifies the name of the database to connect to when creating the new database. If not specified, the \u003ccode class=\"literal\"\u003epostgres\u003c/code\u003e database will be used; if that does not exist (or if it is the name of the new database being created), \u003ccode class=\"literal\"\u003etemplate1\u003c/code\u003e will be used. This can be a \u003ca class=\"link\" href=\"/docs/18/libpq-connect.html#LIBPQ-CONNSTRING\" title=\"32.1.1. Connection Strings\"\u003econnection string\u003c/a\u003e. If so, connection string parameters will override any conflicting command line options.\u003c/p\u003e\n\u003c/dd\u003e\n\u003c/dl\u003e\n\u003c/div\u003e\n\u003c/div\u003e\n\u003cdiv class=\"refsect1\" id=\"id-1.9.4.4.7\"\u003e\n\u003ch2\u003eEnvironment\u003c/h2\u003e\n\u003cdiv class=\"variablelist\"\u003e\n\u003cdl class=\"variablelist\"\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"envar\"\u003ePGDATABASE\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eIf set, the name of the database to create, unless overridden on the command line.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"envar\"\u003ePGHOST\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"envar\"\u003ePGPORT\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"envar\"\u003ePGUSER\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eDefault connection parameters. \u003ccode class=\"envar\"\u003ePGUSER\u003c/code\u003e also determines the name of the database to create, if it is not specified on the command line or by \u003ccode class=\"envar\"\u003ePGDATABASE\u003c/code\u003e.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"envar\"\u003ePG_COLOR\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eSpecifies whether to use color in diagnostic messages. Possible values are \u003ccode class=\"literal\"\u003ealways\u003c/code\u003e, \u003ccode class=\"literal\"\u003eauto\u003c/code\u003e and \u003ccode class=\"literal\"\u003enever\u003c/code\u003e.\u003c/p\u003e\n\u003c/dd\u003e\n\u003c/dl\u003e\n\u003c/div\u003e\n\u003cp\u003eThis utility, like most other \u003cspan class=\"productname\"\u003ePostgreSQL\u003c/span\u003e utilities, also uses the environment variables supported by \u003cspan class=\"application\"\u003elibpq\u003c/span\u003e (see \u003ca class=\"xref\" href=\"/docs/18/libpq-envars.html\" title=\"32.15. Environment Variables\"\u003eSection 32.15\u003c/a\u003e).\u003c/p\u003e\n\u003c/div\u003e\n\u003cdiv class=\"refsect1\" id=\"id-1.9.4.4.8\"\u003e\n\u003ch2\u003eDiagnostics\u003c/h2\u003e\n\u003cp\u003eIn case of difficulty, see \u003ca class=\"xref\" href=\"/docs/18/sql-createdatabase.html\" title=\"CREATE DATABASE\"\u003e\u003cspan class=\"refentrytitle\"\u003eCREATE DATABASE\u003c/span\u003e\u003c/a\u003e and \u003ca class=\"xref\" href=\"/docs/18/app-psql.html\" title=\"psql\"\u003e\u003cspan class=\"refentrytitle\"\u003e\u003cspan class=\"application\"\u003epsql\u003c/span\u003e\u003c/span\u003e\u003c/a\u003e for discussions of potential problems and error messages. The database server must be running at the targeted host. Also, any default connection settings and environment variables used by the \u003cspan class=\"application\"\u003elibpq\u003c/span\u003e front-end library will apply.\u003c/p\u003e\n\u003c/div\u003e\n\u003cdiv class=\"refsect1\" id=\"id-1.9.4.4.9\"\u003e\n\u003ch2\u003eExamples\u003c/h2\u003e\n\u003cp\u003eTo create the database \u003ccode class=\"literal\"\u003edemo\u003c/code\u003e using the default database server:\u003c/p\u003e\n\u003cpre class=\"screen\"\u003e\u003ccode class=\"prompt\"\u003e$ \u003c/code\u003e\u003cstrong class=\"userinput\"\u003e\u003ccode\u003ecreatedb demo\u003c/code\u003e\u003c/strong\u003e\n\u003c/pre\u003e\n\u003cp\u003eTo create the database \u003ccode class=\"literal\"\u003edemo\u003c/code\u003e using the server on host \u003ccode class=\"literal\"\u003eeden\u003c/code\u003e, port 5000, using the \u003ccode class=\"literal\"\u003etemplate0\u003c/code\u003e template database, here is the command-line command and the underlying SQL command:\u003c/p\u003e\n\u003cpre class=\"screen\"\u003e\u003ccode class=\"prompt\"\u003e$ \u003c/code\u003e\u003cstrong class=\"userinput\"\u003e\u003ccode\u003ecreatedb -p 5000 -h eden -T template0 -e demo\u003c/code\u003e\u003c/strong\u003e\n\u003ccode class=\"computeroutput\"\u003eCREATE DATABASE demo TEMPLATE template0;\u003c/code\u003e\n\u003c/pre\u003e\n\u003c/div\u003e\n\u003cdiv class=\"refsect1\" id=\"id-1.9.4.4.10\"\u003e\n\u003ch2\u003eSee Also\u003c/h2\u003e\u003cspan class=\"simplelist\"\u003e\u003ca class=\"xref\" href=\"/docs/18/app-dropdb.html\" title=\"dropdb\"\u003e\u003cspan class=\"refentrytitle\"\u003e\u003cspan class=\"application\"\u003edropdb\u003c/span\u003e\u003c/span\u003e\u003c/a\u003e, \u003ca class=\"xref\" href=\"/docs/18/sql-createdatabase.html\" title=\"CREATE DATABASE\"\u003e\u003cspan class=\"refentrytitle\"\u003eCREATE DATABASE\u003c/span\u003e\u003c/a\u003e\u003c/span\u003e\n\u003c/div\u003e\n\u003c/div\u003e\u003c/div\u003e","related":[],"sections":[],"tables":[{"columns":[{"key":"signature","label":"Option and arguments"},{"key":"summary","label":"Description"}],"key":"options","rows":[{"signature":{"text":"-D tablespace --tablespace= tablespace","url":"/docs/18/app-createdb.html"},"summary":"Specifies the default tablespace for the database. (This name is processed as a double-quoted identifier.)"},{"signature":{"text":"-e --echo","url":"/docs/18/app-createdb.html"},"summary":"Echo the commands that createdb generates and sends to the server."},{"signature":{"text":"-E encoding --encoding= encoding","url":"/docs/18/app-createdb.html"},"summary":"Specifies the character encoding scheme to be used in this database. The character sets supported by the PostgreSQL server are described in Section 23.3.1 ."},{"signature":{"text":"-l locale --locale= locale","url":"/docs/18/app-createdb.html"},"summary":"Specifies the locale to be used in this database. This is equivalent to specifying --lc-collate , --lc-ctype , and --icu-locale to the same value. Some locales are only valid for ICU and must be set with --icu-locale ."},{"signature":{"text":"--lc-collate= locale","url":"/docs/18/app-createdb.html"},"summary":"Specifies the LC_COLLATE setting to be used in this database."},{"signature":{"text":"--lc-ctype= locale","url":"/docs/18/app-createdb.html"},"summary":"Specifies the LC_CTYPE setting to be used in this database."},{"signature":{"text":"--builtin-locale= locale","url":"/docs/18/app-createdb.html"},"summary":"Specifies the locale name when the builtin provider is used. Locale support is described in Section 23.1 ."},{"signature":{"text":"--icu-locale= locale","url":"/docs/18/app-createdb.html"},"summary":"Specifies the ICU locale ID to be used in this database, if the ICU locale provider is selected."},{"signature":{"text":"--icu-rules= rules","url":"/docs/18/app-createdb.html"},"summary":"Specifies additional collation rules to customize the behavior of the default collation of this database. This is supported for ICU only."},{"signature":{"text":"--locale-provider={ builtin | libc | icu }","url":"/docs/18/app-createdb.html"},"summary":"Specifies the locale provider for the database's default collation."},{"signature":{"text":"-O owner --owner= owner","url":"/docs/18/app-createdb.html"},"summary":"Specifies the database user who will own the new database. (This name is processed as a double-quoted identifier.)"},{"signature":{"text":"-S strategy --strategy= strategy","url":"/docs/18/app-createdb.html"},"summary":"Specifies the database creation strategy. See CREATE DATABASE STRATEGY for more details."},{"signature":{"text":"-T template --template= template","url":"/docs/18/app-createdb.html"},"summary":"Specifies the template database from which to build this database. (This name is processed as a double-quoted identifier.)"},{"signature":{"text":"-V --version","url":"/docs/18/app-createdb.html"},"summary":"Print the createdb version and exit."},{"signature":{"text":"-? --help","url":"/docs/18/app-createdb.html"},"summary":"Show help about createdb command line arguments, and exit."},{"signature":{"text":"-h host --host= host","url":"/docs/18/app-createdb.html"},"summary":"Specifies the host name of the machine on which the server is running. If the value begins with a slash, it is used as the directory for the Unix domain socket."},{"signature":{"text":"-p port --port= port","url":"/docs/18/app-createdb.html"},"summary":"Specifies the TCP port or the local Unix domain socket file extension on which the server is listening for connections."},{"signature":{"text":"-U username --username= username","url":"/docs/18/app-createdb.html"},"summary":"User name to connect as."},{"signature":{"text":"-w --no-password","url":"/docs/18/app-createdb.html"},"summary":"Never issue a password prompt. If the server requires password authentication and a password is not available by other means such as a .pgpass file, the connection attempt will fail. This option can be useful in batch jobs and scripts where no user is present to enter a password."},{"signature":{"text":"-W --password","url":"/docs/18/app-createdb.html"},"summary":"Force createdb to prompt for a password before connecting to a database."},{"signature":{"text":"--maintenance-db= dbname","url":"/docs/18/app-createdb.html"},"summary":"Specifies the name of the database to connect to when creating the new database. If not specified, the postgres database will be used; if that does not exist (or if it is the name of the new database being created), template1 will be used. This can be a connection string . If so, connection string parameters will override any conflicting command line options."}],"title":"Documented options"},{"columns":[{"key":"name","label":"Variable"},{"key":"description","label":"Meaning"}],"key":"environment","rows":[{"description":"If set, the name of the database to create, unless overridden on the command line.","name":"PGDATABASE"},{"description":"Default connection parameters. PGUSER also determines the name of the database to create, if it is not specified on the command line or by PGDATABASE .","name":"PGHOST PGPORT PGUSER"},{"description":"Specifies whether to use color in diagnostic messages. Possible values are always , auto and never .","name":"PG_COLOR"}],"title":"Environment variables"}]}},"RequestedLocale":"zh-Hans","Fallback":true,"Versions":["10","11","12","13","14","15","16","17","18","19","20"],"Locales":["en"],"Signatures":null,"Spellings":null,"SQLState":null,"Evidence":null}
