{"Entry":{"collection":"tool","key":"initdb","name":"initdb","aliases":["initdb"],"metadata":{"aliases":["initdb"],"category":"Server applications","content_hash":"98b6ac7afe6324f4ff3d166e21ac8a6a02c2355ffffbc310333c7955642f8a84","imported_at":"2026-09-30T00:40:33.954987+08:00","name":"initdb","name_zh":"","slug":"initdb","summary":"initdb — create a new PostgreSQL database cluster"}},"Definition":{"Collection":"tool","Key":"initdb","SourceDatabase":"center","Version":"18","SourceTable":"command_tool","SourceKey":"initdb","SourceRevision":"ee8d1a3612338fd9adf250730cb640fcc5233b5491337cc00a316a44e3a0b9f8","Facts":{"comparison_data":{"environment":[{"description":"Specifies the directory where the database cluster is to be stored; can be overridden using the -D option.","name":"PGDATA"},{"description":"Specifies whether to use color in diagnostic messages. Possible values are always , auto and never .","name":"PG_COLOR"},{"description":"Specifies the default time zone of the created database cluster. The value should be a full time zone name (see Section 8.5.3 ).","name":"TZ"}],"options":[{"description":"This option specifies the default authentication method for local users used in pg_hba.conf ( host and local lines). See Section 20.1 for an overview of valid values. initdb will prepopulate pg_hba.conf entries using the specified authentication method for non-replication as well as replication connections. Do not use trust unless you trust all local users on your system. trust is the default for ease of installation.","names":["-A authmethod","--auth= authmethod"],"signature":"-A authmethod --auth= authmethod"},{"description":"This option specifies the authentication method for local users via TCP/IP connections used in pg_hba.conf ( host lines).","names":["--auth-host= authmethod"],"signature":"--auth-host= authmethod"},{"description":"This option specifies the authentication method for local users via Unix-domain socket connections used in pg_hba.conf ( local lines).","names":["--auth-local= authmethod"],"signature":"--auth-local= authmethod"},{"description":"This option specifies the directory where the database cluster should be stored. This is the only information required by initdb , but you can avoid writing it by setting the PGDATA environment variable, which can be convenient since the database server ( postgres ) can find the data directory later by the same variable.","names":["-D directory","--pgdata= directory"],"signature":"-D directory --pgdata= directory"},{"description":"Selects the encoding of the template databases. This will also be the default encoding of any database you create later, unless you override it then. The character sets supported by the PostgreSQL server are described in Section 23.3.1 . By default, the template database encoding is derived from the locale. If --no-locale is specified (or equivalently, if the locale is C or POSIX ), then the default is UTF8 for the ICU provider and SQL_ASCII for the libc provider.","names":["-E encoding","--encoding= encoding"],"signature":"-E encoding --encoding= encoding"},{"description":"Allows users in the same group as the cluster owner to read all cluster files created by initdb . This option is ignored on Windows as it does not support POSIX -style group permissions.","names":["-g","--allow-group-access"],"signature":"-g --allow-group-access"},{"description":"Specifies the ICU locale when the ICU provider is used. Locale support is described in Section 23.1 .","names":["--icu-locale= locale"],"signature":"--icu-locale= locale"},{"description":"Specifies additional collation rules to customize the behavior of the default collation. This is supported for ICU only.","names":["--icu-rules= rules"],"signature":"--icu-rules= rules"},{"description":"Use checksums on data pages to help detect corruption by the I/O system that would otherwise be silent. This is enabled by default; use --no-data-checksums to disable checksums. Enabling checksums might incur a small performance penalty. If set, checksums are calculated for all objects, in all databases. All checksum failures will be reported in the pg_stat_database view. See Section 28.2 for details.","names":["-k","--data-checksums"],"signature":"-k --data-checksums"},{"description":"Sets the default locale for the database cluster. If this option is not specified, the locale is inherited from the environment that initdb runs in. Locale support is described in Section 23.1 . If --locale-provider is builtin , --locale or --builtin-locale must be specified and set to C , C.UTF-8 or PG_UNICODE_FAST .","names":["--locale= locale"],"signature":"--locale= locale"},{"description":"Like --locale , but only sets the locale in the specified category.","names":["--lc-collate= locale","--lc-ctype= locale","--lc-messages= locale","--lc-monetary= locale","--lc-numeric= locale","--lc-time= locale"],"signature":"--lc-collate= locale --lc-ctype= locale --lc-messages= locale --lc-monetary= locale --lc-numeric= locale --lc-time= locale"},{"description":"Equivalent to --locale=C .","names":["--no-locale"],"signature":"--no-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":"This option sets the locale provider for databases created in the new cluster. It can be overridden in the CREATE DATABASE command when new databases are subsequently created. The default is libc (see Section 23.1.4 ).","names":["--locale-provider={ builtin | libc | icu }"],"signature":"--locale-provider={ builtin | libc | icu }"},{"description":"Do not enable data checksums.","names":["--no-data-checksums"],"signature":"--no-data-checksums"},{"description":"Makes initdb read the bootstrap superuser's password from a file. The first line of the file is taken as the password.","names":["--pwfile= filename"],"signature":"--pwfile= filename"},{"description":"Sets the default text search configuration. See default_text_search_config for further information.","names":["-T config","--text-search-config= config"],"signature":"-T config --text-search-config= config"},{"description":"Sets the user name of the bootstrap superuser . This defaults to the name of the operating-system user running initdb .","names":["-U username","--username= username"],"signature":"-U username --username= username"},{"description":"Makes initdb prompt for a password to give the bootstrap superuser. If you don't plan on using password authentication, this is not important. Otherwise you won't be able to use password authentication until you have a password set up.","names":["-W","--pwprompt"],"signature":"-W --pwprompt"},{"description":"This option specifies the directory where the write-ahead log should be stored.","names":["-X directory","--waldir= directory"],"signature":"-X directory --waldir= directory"},{"description":"Set the WAL segment size , in megabytes. This is the size of each individual file in the WAL log. The default size is 16 megabytes. The value must be a power of 2 between 1 and 1024 (megabytes). This option can only be set during initialization, and cannot be changed later. It may be useful to adjust this size to control the granularity of WAL log shipping or archiving. Also, in databases with a high volume of WAL, the sheer number of WAL files per directory can become a performance and management problem. Increasing the WAL file size will reduce the number of WAL files.","names":["--wal-segsize= size"],"signature":"--wal-segsize= size"},{"description":"Forcibly set the server parameter name to value during initdb , and also install that setting in the generated postgresql.conf file, so that it will apply during future server runs. This option can be given more than once to set several parameters. It is primarily useful when the environment is such that the server will not start at all using the default parameters.","names":["-c name = value","--set name = value"],"signature":"-c name = value --set name = value"},{"description":"Print debugging output from the bootstrap backend and a few other messages of lesser interest for the general public. The bootstrap backend is the program initdb uses to create the catalog tables. This option generates a tremendous amount of extremely boring output.","names":["-d","--debug"],"signature":"-d --debug"},{"description":"Run the bootstrap backend with the debug_discard_caches=1 option. This takes a very long time and is only of use for deep debugging.","names":["--discard-caches"],"signature":"--discard-caches"},{"description":"Specifies where initdb should find its input files to initialize the database cluster. This is normally not necessary. You will be told if you need to specify their location explicitly.","names":["-L directory"],"signature":"-L directory"},{"description":"By default, when initdb determines that an error prevented it from completely creating the database cluster, it removes any files it might have created before discovering that it cannot finish the job. This option inhibits tidying-up and is thus useful for debugging.","names":["-n","--no-clean"],"signature":"-n --no-clean"},{"description":"By default, initdb will wait for all files to be written safely to disk. This option causes initdb to return without waiting, which is faster, but means that a subsequent operating system crash can leave the data directory corrupt. Generally, this option is useful for testing, but should not be used when creating a production installation.","names":["-N","--no-sync"],"signature":"-N --no-sync"},{"description":"By default, initdb safely writes all database files to disk. This option instructs initdb to skip synchronizing all files in the individual database directories, the database directories themselves, and the tablespace directories, i.e., everything in the base subdirectory and any other tablespace directories. Other files, such as those in pg_wal and pg_xact , will still be synchronized unless the --no-sync option is also specified. Note that if --no-sync-data-files is used in conjunction with --sync-method=syncfs , some or all of the aforementioned files and directories will be synchronized because syncfs processes entire file systems. This option is primarily intended for internal use by tools that separately ensure the skipped files are synchronized to disk.","names":["--no-sync-data-files"],"signature":"--no-sync-data-files"},{"description":"By default, initdb will write instructions for how to start the cluster at the end of its output. This option causes those instructions to be left out. This is primarily intended for use by tools that wrap initdb in platform-specific behavior, where those instructions are likely to be incorrect.","names":["--no-instructions"],"signature":"--no-instructions"},{"description":"Show internal settings and exit, without doing anything else. This can be used to debug the initdb installation.","names":["-s","--show"],"signature":"-s --show"},{"description":"When set to fsync , which is the default, initdb will recursively open and synchronize all files in the data directory. The search for files will follow symbolic links for the WAL directory and each configured tablespace. On Linux, syncfs may be used instead to ask the operating system to synchronize the whole file systems that contain the data directory, the WAL files, and each tablespace. See recovery_init_sync_method for information about the caveats to be aware of when using syncfs . This option has no effect when --no-sync is used.","names":["--sync-method= method"],"signature":"--sync-method= method"},{"description":"Safely write all database files to disk and exit. This does not perform any of the normal initdb operations. Generally, this option is useful for ensuring reliable recovery after changing fsync from off to on .","names":["-S","--sync-only"],"signature":"-S --sync-only"},{"description":"Print the initdb version and exit.","names":["-V","--version"],"signature":"-V --version"},{"description":"Show help about initdb command line arguments, and exit.","names":["-?","--help"],"signature":"-? --help"}],"synopsis":["initdb [ option ...] [ --pgdata | -D ] directory"]},"comparison_hash":"9d023384fdab35b09900cd14ac90a5dbe44bace6659e36877cd11b68fb2bd76e","description":["initdb — create a new PostgreSQL database cluster"],"environment":[{"description":"Specifies the directory where the database cluster is to be stored; can be overridden using the -D option.","name":"PGDATA"},{"description":"Specifies whether to use color in diagnostic messages. Possible values are always , auto and never .","name":"PG_COLOR"},{"description":"Specifies the default time zone of the created database cluster. The value should be a full time zone name (see Section 8.5.3 ).","name":"TZ"}],"facts":[{"label":"Documented executable","value":"initdb"},{"label":"Executable version","value":"18.6"},{"label":"Reference inventory","value":"Server applications"},{"label":"Option definition groups","value":"34"}],"manual_html":"\u003cdiv\u003e\u003cdiv class=\"refentry\" id=\"APP-INITDB\"\u003e\n\u003cdiv class=\"titlepage\"\u003e\u003c/div\u003e\n\u003cdiv class=\"refnamediv\"\u003e\n\u003ch2\u003e\u003cspan class=\"refentrytitle\"\u003e\u003cspan class=\"application\"\u003einitdb\u003c/span\u003e\u003c/span\u003e\u003c/h2\u003e\n\u003cp\u003einitdb — create a new \u003cspan class=\"productname\"\u003ePostgreSQL\u003c/span\u003e database cluster\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.5.3.4.1\"\u003e\u003ccode class=\"command\"\u003einitdb\u003c/code\u003e [\u003cem class=\"replaceable\"\u003e\u003ccode\u003eoption\u003c/code\u003e\u003c/em\u003e...] [ \u003ccode class=\"option\"\u003e--pgdata\u003c/code\u003e | \u003ccode class=\"option\"\u003e-D\u003c/code\u003e ] \u003cem class=\"replaceable\"\u003e\u003ccode\u003edirectory\u003c/code\u003e\u003c/em\u003e\u003c/p\u003e\n\u003c/div\u003e\n\u003c/div\u003e\n\u003cdiv class=\"refsect1\" id=\"R1-APP-INITDB-1\"\u003e\n\u003ch2\u003eDescription\u003c/h2\u003e\n\u003cp\u003e\u003ccode class=\"command\"\u003einitdb\u003c/code\u003e creates a new \u003cspan class=\"productname\"\u003ePostgreSQL\u003c/span\u003e \u003ca class=\"glossterm\" href=\"/docs/18/glossary.html#GLOSSARY-DB-CLUSTER\"\u003e\u003c/a\u003e\u003ca class=\"glossterm\" href=\"/docs/18/glossary.html#GLOSSARY-DB-CLUSTER\" title=\"Database cluster\"\u003edatabase cluster\u003c/a\u003e.\u003c/p\u003e\n\u003cp\u003eCreating a database cluster consists of creating the \u003ca class=\"glossterm\" href=\"/docs/18/glossary.html#GLOSSARY-DATA-DIRECTORY\"\u003e\u003c/a\u003e\u003ca class=\"glossterm\" href=\"/docs/18/glossary.html#GLOSSARY-DATA-DIRECTORY\" title=\"Data directory\"\u003edirectories\u003c/a\u003e in which the cluster data will live, generating the shared catalog tables (tables that belong to the whole cluster rather than to any particular database), and creating the \u003ccode class=\"literal\"\u003epostgres\u003c/code\u003e, \u003ccode class=\"literal\"\u003etemplate1\u003c/code\u003e, and \u003ccode class=\"literal\"\u003etemplate0\u003c/code\u003e databases. The \u003ccode class=\"literal\"\u003epostgres\u003c/code\u003e database is a default database meant for use by users, utilities and third party applications. \u003ccode class=\"literal\"\u003etemplate1\u003c/code\u003e and \u003ccode class=\"literal\"\u003etemplate0\u003c/code\u003e are meant as source databases to be copied by later \u003ccode class=\"command\"\u003eCREATE DATABASE\u003c/code\u003e commands. \u003ccode class=\"literal\"\u003etemplate0\u003c/code\u003e should never be modified, but you can add objects to \u003ccode class=\"literal\"\u003etemplate1\u003c/code\u003e, which by default will be copied into databases created later. See \u003ca class=\"xref\" href=\"/docs/18/manage-ag-templatedbs.html\" title=\"22.3. Template Databases\"\u003eSection 22.3\u003c/a\u003e for more details.\u003c/p\u003e\n\u003cp\u003eAlthough \u003ccode class=\"command\"\u003einitdb\u003c/code\u003e will attempt to create the specified data directory, it might not have permission if the parent directory of the desired data directory is root-owned. To initialize in such a setup, create an empty data directory as root, then use \u003ccode class=\"command\"\u003echown\u003c/code\u003e to assign ownership of that directory to the database user account, then \u003ccode class=\"command\"\u003esu\u003c/code\u003e to become the database user to run \u003ccode class=\"command\"\u003einitdb\u003c/code\u003e.\u003c/p\u003e\n\u003cp\u003e\u003ccode class=\"command\"\u003einitdb\u003c/code\u003e must be run as the user that will own the server process, because the server needs to have access to the files and directories that \u003ccode class=\"command\"\u003einitdb\u003c/code\u003e creates. Since the server cannot be run as root, you must not run \u003ccode class=\"command\"\u003einitdb\u003c/code\u003e as root either. (It will in fact refuse to do so.)\u003c/p\u003e\n\u003cp\u003eFor security reasons the new cluster created by \u003ccode class=\"command\"\u003einitdb\u003c/code\u003e will only be accessible by the cluster owner by default. The \u003ccode class=\"option\"\u003e--allow-group-access\u003c/code\u003e option allows any user in the same group as the cluster owner to read files in the cluster. This is useful for performing backups as a non-privileged user.\u003c/p\u003e\n\u003cp\u003e\u003ccode class=\"command\"\u003einitdb\u003c/code\u003e initializes the database cluster's default locale and character set encoding. These can also be set separately for each database when it is created. \u003ccode class=\"command\"\u003einitdb\u003c/code\u003e determines those settings for the template databases, which will serve as the default for all other databases.\u003c/p\u003e\n\u003cp\u003eBy default, \u003ccode class=\"command\"\u003einitdb\u003c/code\u003e uses the locale provider \u003ccode class=\"literal\"\u003elibc\u003c/code\u003e (see \u003ca class=\"xref\" href=\"/docs/18/locale.html#LOCALE-PROVIDERS\" title=\"23.1.4. Locale Providers\"\u003eSection 23.1.4\u003c/a\u003e). The \u003ccode class=\"literal\"\u003elibc\u003c/code\u003e locale provider takes the locale settings from the environment, and determines the encoding from the locale settings.\u003c/p\u003e\n\u003cp\u003eTo choose a different locale for the cluster, use the option \u003ccode class=\"option\"\u003e--locale\u003c/code\u003e. There are also individual options \u003ccode class=\"option\"\u003e--lc-*\u003c/code\u003e and \u003ccode class=\"option\"\u003e--icu-locale\u003c/code\u003e (see below) to set values for the individual locale categories. Note that inconsistent settings for different locale categories can give nonsensical results, so this should be used with care.\u003c/p\u003e\n\u003cp\u003eAlternatively, \u003ccode class=\"command\"\u003einitdb\u003c/code\u003e can use the ICU library to provide locale services by specifying \u003ccode class=\"literal\"\u003e--locale-provider=icu\u003c/code\u003e. The server must be built with ICU support. To choose the specific ICU locale ID to apply, use the option \u003ccode class=\"option\"\u003e--icu-locale\u003c/code\u003e. Note that for implementation reasons and to support legacy code, \u003ccode class=\"command\"\u003einitdb\u003c/code\u003e will still select and initialize libc locale settings when the ICU locale provider is used.\u003c/p\u003e\n\u003cp\u003eWhen \u003ccode class=\"command\"\u003einitdb\u003c/code\u003e runs, it will print out the locale settings it has chosen. If you have complex requirements or specified multiple options, it is advisable to check that the result matches what was intended.\u003c/p\u003e\n\u003cp\u003eMore details about locale settings can be found in \u003ca class=\"xref\" href=\"/docs/18/locale.html\" title=\"23.1. Locale Support\"\u003eSection 23.1\u003c/a\u003e.\u003c/p\u003e\n\u003cp\u003eTo alter the default encoding, use the \u003ccode class=\"option\"\u003e--encoding\u003c/code\u003e. More details can be found in \u003ca class=\"xref\" href=\"/docs/18/multibyte.html\" title=\"23.3. Character Set Support\"\u003eSection 23.3\u003c/a\u003e.\u003c/p\u003e\n\u003c/div\u003e\n\u003cdiv class=\"refsect1\" id=\"id-1.9.5.3.6\"\u003e\n\u003ch2\u003eOptions\u003c/h2\u003e\n\u003cdiv class=\"variablelist\"\u003e\n\u003cdl class=\"variablelist\"\u003e\n\u003cdt id=\"APP-INITDB-OPTION-AUTH\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-A \u003cem class=\"replaceable\"\u003e\u003ccode\u003eauthmethod\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--auth=\u003cem class=\"replaceable\"\u003e\u003ccode\u003eauthmethod\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eThis option specifies the default authentication method for local users used in \u003ccode class=\"filename\"\u003epg_hba.conf\u003c/code\u003e (\u003ccode class=\"literal\"\u003ehost\u003c/code\u003e and \u003ccode class=\"literal\"\u003elocal\u003c/code\u003e lines). See \u003ca class=\"xref\" href=\"/docs/18/auth-pg-hba-conf.html\" title=\"20.1. The pg_hba.conf File\"\u003eSection 20.1\u003c/a\u003e for an overview of valid values.\u003c/p\u003e\n\u003cp\u003e\u003ccode class=\"command\"\u003einitdb\u003c/code\u003e will prepopulate \u003ccode class=\"filename\"\u003epg_hba.conf\u003c/code\u003e entries using the specified authentication method for non-replication as well as replication connections.\u003c/p\u003e\n\u003cp\u003eDo not use \u003ccode class=\"literal\"\u003etrust\u003c/code\u003e unless you trust all local users on your system. \u003ccode class=\"literal\"\u003etrust\u003c/code\u003e is the default for ease of installation.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt id=\"APP-INITDB-OPTION-AUTH-HOST\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--auth-host=\u003cem class=\"replaceable\"\u003e\u003ccode\u003eauthmethod\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eThis option specifies the authentication method for local users via TCP/IP connections used in \u003ccode class=\"filename\"\u003epg_hba.conf\u003c/code\u003e (\u003ccode class=\"literal\"\u003ehost\u003c/code\u003e lines).\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt id=\"APP-INITDB-OPTION-AUTH-LOCAL\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--auth-local=\u003cem class=\"replaceable\"\u003e\u003ccode\u003eauthmethod\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eThis option specifies the authentication method for local users via Unix-domain socket connections used in \u003ccode class=\"filename\"\u003epg_hba.conf\u003c/code\u003e (\u003ccode class=\"literal\"\u003elocal\u003c/code\u003e lines).\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt id=\"APP-INITDB-OPTION-PGDATA\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-D \u003cem class=\"replaceable\"\u003e\u003ccode\u003edirectory\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--pgdata=\u003cem class=\"replaceable\"\u003e\u003ccode\u003edirectory\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eThis option specifies the directory where the database cluster should be stored. This is the only information required by \u003ccode class=\"command\"\u003einitdb\u003c/code\u003e, but you can avoid writing it by setting the \u003ccode class=\"envar\"\u003ePGDATA\u003c/code\u003e environment variable, which can be convenient since the database server (\u003ccode class=\"command\"\u003epostgres\u003c/code\u003e) can find the data directory later by the same variable.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt id=\"APP-INITDB-OPTION-ENCODING\"\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\u003eSelects the encoding of the template databases. This will also be the default encoding of any database you create later, unless you override it then. 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\u003cp\u003eBy default, the template database encoding is derived from the locale. If \u003ca class=\"xref\" href=\"/docs/18/app-initdb.html#APP-INITDB-OPTION-NO-LOCALE\"\u003e\u003ccode class=\"option\"\u003e--no-locale\u003c/code\u003e\u003c/a\u003e is specified (or equivalently, if the locale is \u003ccode class=\"literal\"\u003eC\u003c/code\u003e or \u003ccode class=\"literal\"\u003ePOSIX\u003c/code\u003e), then the default is \u003ccode class=\"literal\"\u003eUTF8\u003c/code\u003e for the ICU provider and \u003ccode class=\"literal\"\u003eSQL_ASCII\u003c/code\u003e for the \u003ccode class=\"literal\"\u003elibc\u003c/code\u003e provider.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt id=\"APP-INITDB-ALLOW-GROUP-ACCESS\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-g\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--allow-group-access\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eAllows users in the same group as the cluster owner to read all cluster files created by \u003ccode class=\"command\"\u003einitdb\u003c/code\u003e. This option is ignored on \u003cspan class=\"productname\"\u003eWindows\u003c/span\u003e as it does not support POSIX-style group permissions.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt id=\"APP-INITDB-ICU-LOCALE\"\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 when the ICU 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 id=\"APP-INITDB-ICU-RULES\"\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. This is supported for ICU only.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt id=\"APP-INITDB-DATA-CHECKSUMS\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-k\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--data-checksums\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eUse checksums on data pages to help detect corruption by the I/O system that would otherwise be silent. This is enabled by default; use \u003ca class=\"xref\" href=\"/docs/18/app-initdb.html#APP-INITDB-NO-DATA-CHECKSUMS\"\u003e\u003ccode class=\"option\"\u003e--no-data-checksums\u003c/code\u003e\u003c/a\u003e to disable checksums.\u003c/p\u003e\n\u003cp\u003eEnabling checksums might incur a small performance penalty. If set, checksums are calculated for all objects, in all databases. All checksum failures will be reported in the \u003ca class=\"link\" href=\"/docs/18/monitoring-stats.html#MONITORING-PG-STAT-DATABASE-VIEW\" title=\"27.2.17. pg_stat_database\"\u003e\u003ccode class=\"structname\"\u003epg_stat_database\u003c/code\u003e\u003c/a\u003e view. See \u003ca class=\"xref\" href=\"/docs/18/checksums.html\" title=\"28.2. Data Checksums\"\u003eSection 28.2\u003c/a\u003e for details.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt id=\"APP-INITDB-OPTION-LOCALE\"\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\u003eSets the default locale for the database cluster. If this option is not specified, the locale is inherited from the environment that \u003ccode class=\"command\"\u003einitdb\u003c/code\u003e runs in. 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\u003cp\u003eIf \u003ccode class=\"option\"\u003e--locale-provider\u003c/code\u003e is \u003ccode class=\"literal\"\u003ebuiltin\u003c/code\u003e, \u003ccode class=\"option\"\u003e--locale\u003c/code\u003e or \u003ccode class=\"option\"\u003e--builtin-locale\u003c/code\u003e must be specified and set to \u003ccode class=\"literal\"\u003eC\u003c/code\u003e, \u003ccode class=\"literal\"\u003eC.UTF-8\u003c/code\u003e or \u003ccode class=\"literal\"\u003ePG_UNICODE_FAST\u003c/code\u003e.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt id=\"APP-INITDB-OPTION-LC-COLLATE\"\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\u003cbr\u003e\u003c/span\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\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--lc-messages=\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--lc-monetary=\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--lc-numeric=\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--lc-time=\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\u003eLike \u003ccode class=\"option\"\u003e--locale\u003c/code\u003e, but only sets the locale in the specified category.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt id=\"APP-INITDB-OPTION-NO-LOCALE\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--no-locale\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eEquivalent to \u003ccode class=\"option\"\u003e--locale=C\u003c/code\u003e.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt id=\"APP-INITDB-BUILTIN-LOCALE\"\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 id=\"APP-INITDB-OPTION-LOCALE-PROVIDER\"\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\u003eThis option sets the locale provider for databases created in the new cluster. It can be overridden in the \u003ccode class=\"command\"\u003eCREATE DATABASE\u003c/code\u003e command when new databases are subsequently created. The default is \u003ccode class=\"literal\"\u003elibc\u003c/code\u003e (see \u003ca class=\"xref\" href=\"/docs/18/locale.html#LOCALE-PROVIDERS\" title=\"23.1.4. Locale Providers\"\u003eSection 23.1.4\u003c/a\u003e).\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt id=\"APP-INITDB-NO-DATA-CHECKSUMS\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--no-data-checksums\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eDo not enable data checksums.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt id=\"APP-INITDB-OPTION-PWFILE\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--pwfile=\u003cem class=\"replaceable\"\u003e\u003ccode\u003efilename\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eMakes \u003ccode class=\"command\"\u003einitdb\u003c/code\u003e read the bootstrap superuser's password from a file. The first line of the file is taken as the password.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt id=\"APP-INITDB-OPTION-TEXT-SEARCH-CONFIG\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-T \u003cem class=\"replaceable\"\u003e\u003ccode\u003econfig\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--text-search-config=\u003cem class=\"replaceable\"\u003e\u003ccode\u003econfig\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eSets the default text search configuration. See \u003ca class=\"xref\" href=\"/docs/18/runtime-config-client.html#GUC-DEFAULT-TEXT-SEARCH-CONFIG\"\u003edefault_text_search_config\u003c/a\u003e for further information.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt id=\"APP-INITDB-OPTION-USERNAME\"\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\u003eSets the user name of the \u003ca class=\"glossterm\" href=\"/docs/18/glossary.html#GLOSSARY-BOOTSTRAP-SUPERUSER\"\u003e\u003c/a\u003e\u003ca class=\"glossterm\" href=\"/docs/18/glossary.html#GLOSSARY-BOOTSTRAP-SUPERUSER\" title=\"Bootstrap superuser\"\u003ebootstrap superuser\u003c/a\u003e. This defaults to the name of the operating-system user running \u003ccode class=\"command\"\u003einitdb\u003c/code\u003e.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt id=\"APP-INITDB-OPTION-PWPROMPT\"\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--pwprompt\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eMakes \u003ccode class=\"command\"\u003einitdb\u003c/code\u003e prompt for a password to give the bootstrap superuser. If you don't plan on using password authentication, this is not important. Otherwise you won't be able to use password authentication until you have a password set up.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt id=\"APP-INITDB-OPTION-WALDIR\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-X \u003cem class=\"replaceable\"\u003e\u003ccode\u003edirectory\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--waldir=\u003cem class=\"replaceable\"\u003e\u003ccode\u003edirectory\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eThis option specifies the directory where the write-ahead log should be stored.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt id=\"APP-INITDB-OPTION-WAL-SEGSIZE\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--wal-segsize=\u003cem class=\"replaceable\"\u003e\u003ccode\u003esize\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eSet the \u003cem class=\"firstterm\"\u003eWAL segment size\u003c/em\u003e, in megabytes. This is the size of each individual file in the WAL log. The default size is 16 megabytes. The value must be a power of 2 between 1 and 1024 (megabytes). This option can only be set during initialization, and cannot be changed later.\u003c/p\u003e\n\u003cp\u003eIt may be useful to adjust this size to control the granularity of WAL log shipping or archiving. Also, in databases with a high volume of WAL, the sheer number of WAL files per directory can become a performance and management problem. Increasing the WAL file size will reduce the number of WAL files.\u003c/p\u003e\n\u003c/dd\u003e\n\u003c/dl\u003e\n\u003c/div\u003e\n\u003cp\u003eOther, less commonly used, options are also available:\u003c/p\u003e\n\u003cdiv class=\"variablelist\"\u003e\n\u003cdl class=\"variablelist\"\u003e\n\u003cdt id=\"APP-INITDB-OPTION-SET\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-c \u003cem class=\"replaceable\"\u003e\u003ccode\u003ename\u003c/code\u003e\u003c/em\u003e=\u003cem class=\"replaceable\"\u003e\u003ccode\u003evalue\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--set \u003cem class=\"replaceable\"\u003e\u003ccode\u003ename\u003c/code\u003e\u003c/em\u003e=\u003cem class=\"replaceable\"\u003e\u003ccode\u003evalue\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eForcibly set the server parameter \u003cem class=\"replaceable\"\u003e\u003ccode\u003ename\u003c/code\u003e\u003c/em\u003e to \u003cem class=\"replaceable\"\u003e\u003ccode\u003evalue\u003c/code\u003e\u003c/em\u003e during \u003ccode class=\"command\"\u003einitdb\u003c/code\u003e, and also install that setting in the generated \u003ccode class=\"filename\"\u003epostgresql.conf\u003c/code\u003e file, so that it will apply during future server runs. This option can be given more than once to set several parameters. It is primarily useful when the environment is such that the server will not start at all using the default parameters.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt id=\"APP-INITDB-OPTION-DEBUG\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-d\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--debug\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003ePrint debugging output from the bootstrap backend and a few other messages of lesser interest for the general public. The bootstrap backend is the program \u003ccode class=\"command\"\u003einitdb\u003c/code\u003e uses to create the catalog tables. This option generates a tremendous amount of extremely boring output.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt id=\"APP-INITDB-OPTION-DISCARD-CACHES\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--discard-caches\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eRun the bootstrap backend with the \u003ccode class=\"literal\"\u003edebug_discard_caches=1\u003c/code\u003e option. This takes a very long time and is only of use for deep debugging.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt id=\"APP-INITDB-OPTION-L\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-L \u003cem class=\"replaceable\"\u003e\u003ccode\u003edirectory\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eSpecifies where \u003ccode class=\"command\"\u003einitdb\u003c/code\u003e should find its input files to initialize the database cluster. This is normally not necessary. You will be told if you need to specify their location explicitly.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt id=\"APP-INITDB-OPTION-NO-CLEAN\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-n\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--no-clean\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eBy default, when \u003ccode class=\"command\"\u003einitdb\u003c/code\u003e determines that an error prevented it from completely creating the database cluster, it removes any files it might have created before discovering that it cannot finish the job. This option inhibits tidying-up and is thus useful for debugging.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt id=\"APP-INITDB-OPTION-NO-SYNC\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-N\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--no-sync\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eBy default, \u003ccode class=\"command\"\u003einitdb\u003c/code\u003e will wait for all files to be written safely to disk. This option causes \u003ccode class=\"command\"\u003einitdb\u003c/code\u003e to return without waiting, which is faster, but means that a subsequent operating system crash can leave the data directory corrupt. Generally, this option is useful for testing, but should not be used when creating a production installation.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt id=\"APP-INITDB-OPTION-NO-SYNC-DATA-FILES\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--no-sync-data-files\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eBy default, \u003ccode class=\"command\"\u003einitdb\u003c/code\u003e safely writes all database files to disk. This option instructs \u003ccode class=\"command\"\u003einitdb\u003c/code\u003e to skip synchronizing all files in the individual database directories, the database directories themselves, and the tablespace directories, i.e., everything in the \u003ccode class=\"filename\"\u003ebase\u003c/code\u003e subdirectory and any other tablespace directories. Other files, such as those in \u003ccode class=\"literal\"\u003epg_wal\u003c/code\u003e and \u003ccode class=\"literal\"\u003epg_xact\u003c/code\u003e, will still be synchronized unless the \u003ccode class=\"option\"\u003e--no-sync\u003c/code\u003e option is also specified.\u003c/p\u003e\n\u003cp\u003eNote that if \u003ccode class=\"option\"\u003e--no-sync-data-files\u003c/code\u003e is used in conjunction with \u003ccode class=\"option\"\u003e--sync-method=syncfs\u003c/code\u003e, some or all of the aforementioned files and directories will be synchronized because \u003ccode class=\"literal\"\u003esyncfs\u003c/code\u003e processes entire file systems.\u003c/p\u003e\n\u003cp\u003eThis option is primarily intended for internal use by tools that separately ensure the skipped files are synchronized to disk.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt id=\"APP-INITDB-OPTION-NO-INSTRUCTIONS\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--no-instructions\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eBy default, \u003ccode class=\"command\"\u003einitdb\u003c/code\u003e will write instructions for how to start the cluster at the end of its output. This option causes those instructions to be left out. This is primarily intended for use by tools that wrap \u003ccode class=\"command\"\u003einitdb\u003c/code\u003e in platform-specific behavior, where those instructions are likely to be incorrect.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt id=\"APP-INITDB-OPTION-SHOW\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-s\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--show\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eShow internal settings and exit, without doing anything else. This can be used to debug the \u003cspan class=\"application\"\u003einitdb\u003c/span\u003e installation.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt id=\"APP-INITDB-OPTION-SYNC-METHOD\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--sync-method=\u003cem class=\"replaceable\"\u003e\u003ccode\u003emethod\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eWhen set to \u003ccode class=\"literal\"\u003efsync\u003c/code\u003e, which is the default, \u003ccode class=\"command\"\u003einitdb\u003c/code\u003e will recursively open and synchronize all files in the data directory. The search for files will follow symbolic links for the WAL directory and each configured tablespace.\u003c/p\u003e\n\u003cp\u003eOn Linux, \u003ccode class=\"literal\"\u003esyncfs\u003c/code\u003e may be used instead to ask the operating system to synchronize the whole file systems that contain the data directory, the WAL files, and each tablespace. See \u003ca class=\"xref\" href=\"/docs/18/runtime-config-error-handling.html#GUC-RECOVERY-INIT-SYNC-METHOD\"\u003erecovery_init_sync_method\u003c/a\u003e for information about the caveats to be aware of when using \u003ccode class=\"literal\"\u003esyncfs\u003c/code\u003e.\u003c/p\u003e\n\u003cp\u003eThis option has no effect when \u003ccode class=\"option\"\u003e--no-sync\u003c/code\u003e is used.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt id=\"APP-INITDB-OPTION-SYNC-ONLY\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-S\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--sync-only\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eSafely write all database files to disk and exit. This does not perform any of the normal \u003cspan class=\"application\"\u003einitdb\u003c/span\u003e operations. Generally, this option is useful for ensuring reliable recovery after changing \u003ca class=\"xref\" href=\"/docs/18/runtime-config-wal.html#GUC-FSYNC\"\u003efsync\u003c/a\u003e from \u003ccode class=\"literal\"\u003eoff\u003c/code\u003e to \u003ccode class=\"literal\"\u003eon\u003c/code\u003e.\u003c/p\u003e\n\u003c/dd\u003e\n\u003c/dl\u003e\n\u003c/div\u003e\n\u003cp\u003eOther options:\u003c/p\u003e\n\u003cdiv class=\"variablelist\"\u003e\n\u003cdl class=\"variablelist\"\u003e\n\u003cdt id=\"APP-INITDB-OPTION-VERSION\"\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\"\u003einitdb\u003c/span\u003e version and exit.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt id=\"APP-INITDB-OPTION-HELP\"\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\"\u003einitdb\u003c/span\u003e command line arguments, and exit.\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.5.3.7\"\u003e\n\u003ch2\u003eEnvironment\u003c/h2\u003e\n\u003cdiv class=\"variablelist\"\u003e\n\u003cdl class=\"variablelist\"\u003e\n\u003cdt id=\"APP-INITDB-ENVIRONMENT-PGDATA\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"envar\"\u003ePGDATA\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eSpecifies the directory where the database cluster is to be stored; can be overridden using the \u003ccode class=\"option\"\u003e-D\u003c/code\u003e option.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt id=\"APP-INITDB-ENVIRONMENT-PG-COLOR\"\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\u003cdt id=\"APP-INITDB-ENVIRONMENT-TZ\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"envar\"\u003eTZ\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eSpecifies the default time zone of the created database cluster. The value should be a full time zone name (see \u003ca class=\"xref\" href=\"/docs/18/datatype-datetime.html#DATATYPE-TIMEZONES\" title=\"8.5.3. Time Zones\"\u003eSection 8.5.3\u003c/a\u003e).\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.5.3.8\"\u003e\n\u003ch2\u003eNotes\u003c/h2\u003e\n\u003cp\u003e\u003ccode class=\"command\"\u003einitdb\u003c/code\u003e can also be invoked via \u003ccode class=\"command\"\u003epg_ctl initdb\u003c/code\u003e.\u003c/p\u003e\n\u003c/div\u003e\n\u003cdiv class=\"refsect1\" id=\"id-1.9.5.3.9\"\u003e\n\u003ch2\u003eSee Also\u003c/h2\u003e\u003cspan class=\"simplelist\"\u003e\u003ca class=\"xref\" href=\"/docs/18/app-pg-ctl.html\" title=\"pg_ctl\"\u003e\u003cspan class=\"refentrytitle\"\u003e\u003cspan class=\"application\"\u003epg_ctl\u003c/span\u003e\u003c/span\u003e\u003c/a\u003e, \u003ca class=\"xref\" href=\"/docs/18/app-postgres.html\" title=\"postgres\"\u003e\u003cspan class=\"refentrytitle\"\u003e\u003cspan class=\"application\"\u003epostgres\u003c/span\u003e\u003c/span\u003e\u003c/a\u003e, \u003ca class=\"xref\" href=\"/docs/18/auth-pg-hba-conf.html\" title=\"20.1. The pg_hba.conf File\"\u003eSection 20.1\u003c/a\u003e\u003c/span\u003e\n\u003c/div\u003e\n\u003c/div\u003e\u003c/div\u003e","manual_path":"app-initdb.html","options":[{"description":"This option specifies the default authentication method for local users used in pg_hba.conf ( host and local lines). See Section 20.1 for an overview of valid values. initdb will prepopulate pg_hba.conf entries using the specified authentication method for non-replication as well as replication connections. Do not use trust unless you trust all local users on your system. trust is the default for ease of installation.","names":["-A authmethod","--auth= authmethod"],"signature":"-A authmethod --auth= authmethod","source_url":"/docs/18/app-initdb.html#APP-INITDB-OPTION-AUTH","summary":"This option specifies the default authentication method for local users used in pg_hba.conf ( host and local lines). See Section 20.1 for an overview of valid values."},{"description":"This option specifies the authentication method for local users via TCP/IP connections used in pg_hba.conf ( host lines).","names":["--auth-host= authmethod"],"signature":"--auth-host= authmethod","source_url":"/docs/18/app-initdb.html#APP-INITDB-OPTION-AUTH-HOST","summary":"This option specifies the authentication method for local users via TCP/IP connections used in pg_hba.conf ( host lines)."},{"description":"This option specifies the authentication method for local users via Unix-domain socket connections used in pg_hba.conf ( local lines).","names":["--auth-local= authmethod"],"signature":"--auth-local= authmethod","source_url":"/docs/18/app-initdb.html#APP-INITDB-OPTION-AUTH-LOCAL","summary":"This option specifies the authentication method for local users via Unix-domain socket connections used in pg_hba.conf ( local lines)."},{"description":"This option specifies the directory where the database cluster should be stored. This is the only information required by initdb , but you can avoid writing it by setting the PGDATA environment variable, which can be convenient since the database server ( postgres ) can find the data directory later by the same variable.","names":["-D directory","--pgdata= directory"],"signature":"-D directory --pgdata= directory","source_url":"/docs/18/app-initdb.html#APP-INITDB-OPTION-PGDATA","summary":"This option specifies the directory where the database cluster should be stored. This is the only information required by initdb , but you can avoid writing it by setting the PGDATA environment variable, which can be convenient since the database server ( postgres ) can find the data directory later by the same variable."},{"description":"Selects the encoding of the template databases. This will also be the default encoding of any database you create later, unless you override it then. The character sets supported by the PostgreSQL server are described in Section 23.3.1 . By default, the template database encoding is derived from the locale. If --no-locale is specified (or equivalently, if the locale is C or POSIX ), then the default is UTF8 for the ICU provider and SQL_ASCII for the libc provider.","names":["-E encoding","--encoding= encoding"],"signature":"-E encoding --encoding= encoding","source_url":"/docs/18/app-initdb.html#APP-INITDB-OPTION-ENCODING","summary":"Selects the encoding of the template databases. This will also be the default encoding of any database you create later, unless you override it then. The character sets supported by the PostgreSQL server are described in Section 23.3.1 ."},{"description":"Allows users in the same group as the cluster owner to read all cluster files created by initdb . This option is ignored on Windows as it does not support POSIX -style group permissions.","names":["-g","--allow-group-access"],"signature":"-g --allow-group-access","source_url":"/docs/18/app-initdb.html#APP-INITDB-ALLOW-GROUP-ACCESS","summary":"Allows users in the same group as the cluster owner to read all cluster files created by initdb . This option is ignored on Windows as it does not support POSIX -style group permissions."},{"description":"Specifies the ICU locale when the ICU provider is used. Locale support is described in Section 23.1 .","names":["--icu-locale= locale"],"signature":"--icu-locale= locale","source_url":"/docs/18/app-initdb.html#APP-INITDB-ICU-LOCALE","summary":"Specifies the ICU locale when the ICU provider is used. Locale support is described in Section 23.1 ."},{"description":"Specifies additional collation rules to customize the behavior of the default collation. This is supported for ICU only.","names":["--icu-rules= rules"],"signature":"--icu-rules= rules","source_url":"/docs/18/app-initdb.html#APP-INITDB-ICU-RULES","summary":"Specifies additional collation rules to customize the behavior of the default collation. This is supported for ICU only."},{"description":"Use checksums on data pages to help detect corruption by the I/O system that would otherwise be silent. This is enabled by default; use --no-data-checksums to disable checksums. Enabling checksums might incur a small performance penalty. If set, checksums are calculated for all objects, in all databases. All checksum failures will be reported in the pg_stat_database view. See Section 28.2 for details.","names":["-k","--data-checksums"],"signature":"-k --data-checksums","source_url":"/docs/18/app-initdb.html#APP-INITDB-DATA-CHECKSUMS","summary":"Use checksums on data pages to help detect corruption by the I/O system that would otherwise be silent. This is enabled by default; use --no-data-checksums to disable checksums."},{"description":"Sets the default locale for the database cluster. If this option is not specified, the locale is inherited from the environment that initdb runs in. Locale support is described in Section 23.1 . If --locale-provider is builtin , --locale or --builtin-locale must be specified and set to C , C.UTF-8 or PG_UNICODE_FAST .","names":["--locale= locale"],"signature":"--locale= locale","source_url":"/docs/18/app-initdb.html#APP-INITDB-OPTION-LOCALE","summary":"Sets the default locale for the database cluster. If this option is not specified, the locale is inherited from the environment that initdb runs in. Locale support is described in Section 23.1 ."},{"description":"Like --locale , but only sets the locale in the specified category.","names":["--lc-collate= locale","--lc-ctype= locale","--lc-messages= locale","--lc-monetary= locale","--lc-numeric= locale","--lc-time= locale"],"signature":"--lc-collate= locale --lc-ctype= locale --lc-messages= locale --lc-monetary= locale --lc-numeric= locale --lc-time= locale","source_url":"/docs/18/app-initdb.html#APP-INITDB-OPTION-LC-COLLATE","summary":"Like --locale , but only sets the locale in the specified category."},{"description":"Equivalent to --locale=C .","names":["--no-locale"],"signature":"--no-locale","source_url":"/docs/18/app-initdb.html#APP-INITDB-OPTION-NO-LOCALE","summary":"Equivalent to --locale=C ."},{"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-initdb.html#APP-INITDB-BUILTIN-LOCALE","summary":"Specifies the locale name when the builtin provider is used. Locale support is described in Section 23.1 ."},{"description":"This option sets the locale provider for databases created in the new cluster. It can be overridden in the CREATE DATABASE command when new databases are subsequently created. The default is libc (see Section 23.1.4 ).","names":["--locale-provider={ builtin | libc | icu }"],"signature":"--locale-provider={ builtin | libc | icu }","source_url":"/docs/18/app-initdb.html#APP-INITDB-OPTION-LOCALE-PROVIDER","summary":"This option sets the locale provider for databases created in the new cluster. It can be overridden in the CREATE DATABASE command when new databases are subsequently created. The default is libc (see Section 23.1.4 )."},{"description":"Do not enable data checksums.","names":["--no-data-checksums"],"signature":"--no-data-checksums","source_url":"/docs/18/app-initdb.html#APP-INITDB-NO-DATA-CHECKSUMS","summary":"Do not enable data checksums."},{"description":"Makes initdb read the bootstrap superuser's password from a file. The first line of the file is taken as the password.","names":["--pwfile= filename"],"signature":"--pwfile= filename","source_url":"/docs/18/app-initdb.html#APP-INITDB-OPTION-PWFILE","summary":"Makes initdb read the bootstrap superuser's password from a file. The first line of the file is taken as the password."},{"description":"Sets the default text search configuration. See default_text_search_config for further information.","names":["-T config","--text-search-config= config"],"signature":"-T config --text-search-config= config","source_url":"/docs/18/app-initdb.html#APP-INITDB-OPTION-TEXT-SEARCH-CONFIG","summary":"Sets the default text search configuration. See default_text_search_config for further information."},{"description":"Sets the user name of the bootstrap superuser . This defaults to the name of the operating-system user running initdb .","names":["-U username","--username= username"],"signature":"-U username --username= username","source_url":"/docs/18/app-initdb.html#APP-INITDB-OPTION-USERNAME","summary":"Sets the user name of the bootstrap superuser . This defaults to the name of the operating-system user running initdb ."},{"description":"Makes initdb prompt for a password to give the bootstrap superuser. If you don't plan on using password authentication, this is not important. Otherwise you won't be able to use password authentication until you have a password set up.","names":["-W","--pwprompt"],"signature":"-W --pwprompt","source_url":"/docs/18/app-initdb.html#APP-INITDB-OPTION-PWPROMPT","summary":"Makes initdb prompt for a password to give the bootstrap superuser. If you don't plan on using password authentication, this is not important. Otherwise you won't be able to use password authentication until you have a password set up."},{"description":"This option specifies the directory where the write-ahead log should be stored.","names":["-X directory","--waldir= directory"],"signature":"-X directory --waldir= directory","source_url":"/docs/18/app-initdb.html#APP-INITDB-OPTION-WALDIR","summary":"This option specifies the directory where the write-ahead log should be stored."},{"description":"Set the WAL segment size , in megabytes. This is the size of each individual file in the WAL log. The default size is 16 megabytes. The value must be a power of 2 between 1 and 1024 (megabytes). This option can only be set during initialization, and cannot be changed later. It may be useful to adjust this size to control the granularity of WAL log shipping or archiving. Also, in databases with a high volume of WAL, the sheer number of WAL files per directory can become a performance and management problem. Increasing the WAL file size will reduce the number of WAL files.","names":["--wal-segsize= size"],"signature":"--wal-segsize= size","source_url":"/docs/18/app-initdb.html#APP-INITDB-OPTION-WAL-SEGSIZE","summary":"Set the WAL segment size , in megabytes. This is the size of each individual file in the WAL log. The default size is 16 megabytes. The value must be a power of 2 between 1 and 1024 (megabytes). This option can only be set during initialization, and cannot be changed later."},{"description":"Forcibly set the server parameter name to value during initdb , and also install that setting in the generated postgresql.conf file, so that it will apply during future server runs. This option can be given more than once to set several parameters. It is primarily useful when the environment is such that the server will not start at all using the default parameters.","names":["-c name = value","--set name = value"],"signature":"-c name = value --set name = value","source_url":"/docs/18/app-initdb.html#APP-INITDB-OPTION-SET","summary":"Forcibly set the server parameter name to value during initdb , and also install that setting in the generated postgresql.conf file, so that it will apply during future server runs. This option can be given more than once to set several parameters. It is primarily useful when the environment is such that the server will not start at all using the default parameters."},{"description":"Print debugging output from the bootstrap backend and a few other messages of lesser interest for the general public. The bootstrap backend is the program initdb uses to create the catalog tables. This option generates a tremendous amount of extremely boring output.","names":["-d","--debug"],"signature":"-d --debug","source_url":"/docs/18/app-initdb.html#APP-INITDB-OPTION-DEBUG","summary":"Print debugging output from the bootstrap backend and a few other messages of lesser interest for the general public. The bootstrap backend is the program initdb uses to create the catalog tables. This option generates a tremendous amount of extremely boring output."},{"description":"Run the bootstrap backend with the debug_discard_caches=1 option. This takes a very long time and is only of use for deep debugging.","names":["--discard-caches"],"signature":"--discard-caches","source_url":"/docs/18/app-initdb.html#APP-INITDB-OPTION-DISCARD-CACHES","summary":"Run the bootstrap backend with the debug_discard_caches=1 option. This takes a very long time and is only of use for deep debugging."},{"description":"Specifies where initdb should find its input files to initialize the database cluster. This is normally not necessary. You will be told if you need to specify their location explicitly.","names":["-L directory"],"signature":"-L directory","source_url":"/docs/18/app-initdb.html#APP-INITDB-OPTION-L","summary":"Specifies where initdb should find its input files to initialize the database cluster. This is normally not necessary. You will be told if you need to specify their location explicitly."},{"description":"By default, when initdb determines that an error prevented it from completely creating the database cluster, it removes any files it might have created before discovering that it cannot finish the job. This option inhibits tidying-up and is thus useful for debugging.","names":["-n","--no-clean"],"signature":"-n --no-clean","source_url":"/docs/18/app-initdb.html#APP-INITDB-OPTION-NO-CLEAN","summary":"By default, when initdb determines that an error prevented it from completely creating the database cluster, it removes any files it might have created before discovering that it cannot finish the job. This option inhibits tidying-up and is thus useful for debugging."},{"description":"By default, initdb will wait for all files to be written safely to disk. This option causes initdb to return without waiting, which is faster, but means that a subsequent operating system crash can leave the data directory corrupt. Generally, this option is useful for testing, but should not be used when creating a production installation.","names":["-N","--no-sync"],"signature":"-N --no-sync","source_url":"/docs/18/app-initdb.html#APP-INITDB-OPTION-NO-SYNC","summary":"By default, initdb will wait for all files to be written safely to disk. This option causes initdb to return without waiting, which is faster, but means that a subsequent operating system crash can leave the data directory corrupt. Generally, this option is useful for testing, but should not be used when creating a production installation."},{"description":"By default, initdb safely writes all database files to disk. This option instructs initdb to skip synchronizing all files in the individual database directories, the database directories themselves, and the tablespace directories, i.e., everything in the base subdirectory and any other tablespace directories. Other files, such as those in pg_wal and pg_xact , will still be synchronized unless the --no-sync option is also specified. Note that if --no-sync-data-files is used in conjunction with --sync-method=syncfs , some or all of the aforementioned files and directories will be synchronized because syncfs processes entire file systems. This option is primarily intended for internal use by tools that separately ensure the skipped files are synchronized to disk.","names":["--no-sync-data-files"],"signature":"--no-sync-data-files","source_url":"/docs/18/app-initdb.html#APP-INITDB-OPTION-NO-SYNC-DATA-FILES","summary":"By default, initdb safely writes all database files to disk. This option instructs initdb to skip synchronizing all files in the individual database directories, the database directories themselves, and the tablespace directories, i.e., everything in the base subdirectory and any other tablespace directories. Other files, such as those in pg_wal and pg_xact , will still be synchronized unless the --no-sync option is also specified."},{"description":"By default, initdb will write instructions for how to start the cluster at the end of its output. This option causes those instructions to be left out. This is primarily intended for use by tools that wrap initdb in platform-specific behavior, where those instructions are likely to be incorrect.","names":["--no-instructions"],"signature":"--no-instructions","source_url":"/docs/18/app-initdb.html#APP-INITDB-OPTION-NO-INSTRUCTIONS","summary":"By default, initdb will write instructions for how to start the cluster at the end of its output. This option causes those instructions to be left out. This is primarily intended for use by tools that wrap initdb in platform-specific behavior, where those instructions are likely to be incorrect."},{"description":"Show internal settings and exit, without doing anything else. This can be used to debug the initdb installation.","names":["-s","--show"],"signature":"-s --show","source_url":"/docs/18/app-initdb.html#APP-INITDB-OPTION-SHOW","summary":"Show internal settings and exit, without doing anything else. This can be used to debug the initdb installation."},{"description":"When set to fsync , which is the default, initdb will recursively open and synchronize all files in the data directory. The search for files will follow symbolic links for the WAL directory and each configured tablespace. On Linux, syncfs may be used instead to ask the operating system to synchronize the whole file systems that contain the data directory, the WAL files, and each tablespace. See recovery_init_sync_method for information about the caveats to be aware of when using syncfs . This option has no effect when --no-sync is used.","names":["--sync-method= method"],"signature":"--sync-method= method","source_url":"/docs/18/app-initdb.html#APP-INITDB-OPTION-SYNC-METHOD","summary":"When set to fsync , which is the default, initdb will recursively open and synchronize all files in the data directory. The search for files will follow symbolic links for the WAL directory and each configured tablespace."},{"description":"Safely write all database files to disk and exit. This does not perform any of the normal initdb operations. Generally, this option is useful for ensuring reliable recovery after changing fsync from off to on .","names":["-S","--sync-only"],"signature":"-S --sync-only","source_url":"/docs/18/app-initdb.html#APP-INITDB-OPTION-SYNC-ONLY","summary":"Safely write all database files to disk and exit. This does not perform any of the normal initdb operations. Generally, this option is useful for ensuring reliable recovery after changing fsync from off to on ."},{"description":"Print the initdb version and exit.","names":["-V","--version"],"signature":"-V --version","source_url":"/docs/18/app-initdb.html#APP-INITDB-OPTION-VERSION","summary":"Print the initdb version and exit."},{"description":"Show help about initdb command line arguments, and exit.","names":["-?","--help"],"signature":"-? --help","source_url":"/docs/18/app-initdb.html#APP-INITDB-OPTION-HELP","summary":"Show help about initdb command line arguments, and exit."}],"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":"initdb [ option ...] [ --pgdata | -D ] directory","sources":[{"anchor":"","file":"app-initdb.html","label":"18.6 English manual · app-initdb.html","sha256":"ca8245d2c61740de3b11df2b81993b18e311705e2c23bebfa7cafda1bcd15321","url":"/docs/18/app-initdb.html"},{"anchor":"","file":"reference-server.html","label":"Server applications inventory","sha256":"e9f8bbcc8e3641fadd1d20991e8aad6b532155b786ba5a1b7b364ec4f1a5bef3","url":"/docs/18/reference-server.html"}],"synopsis":["initdb [ option ...] [ --pgdata | -D ] directory"],"tables":[{"columns":[{"key":"signature","label":"Option and arguments"},{"key":"summary","label":"Description"}],"key":"options","rows":[{"signature":{"text":"-A authmethod --auth= authmethod","url":"/docs/18/app-initdb.html#APP-INITDB-OPTION-AUTH"},"summary":"This option specifies the default authentication method for local users used in pg_hba.conf ( host and local lines). See Section 20.1 for an overview of valid values."},{"signature":{"text":"--auth-host= authmethod","url":"/docs/18/app-initdb.html#APP-INITDB-OPTION-AUTH-HOST"},"summary":"This option specifies the authentication method for local users via TCP/IP connections used in pg_hba.conf ( host lines)."},{"signature":{"text":"--auth-local= authmethod","url":"/docs/18/app-initdb.html#APP-INITDB-OPTION-AUTH-LOCAL"},"summary":"This option specifies the authentication method for local users via Unix-domain socket connections used in pg_hba.conf ( local lines)."},{"signature":{"text":"-D directory --pgdata= directory","url":"/docs/18/app-initdb.html#APP-INITDB-OPTION-PGDATA"},"summary":"This option specifies the directory where the database cluster should be stored. This is the only information required by initdb , but you can avoid writing it by setting the PGDATA environment variable, which can be convenient since the database server ( postgres ) can find the data directory later by the same variable."},{"signature":{"text":"-E encoding --encoding= encoding","url":"/docs/18/app-initdb.html#APP-INITDB-OPTION-ENCODING"},"summary":"Selects the encoding of the template databases. This will also be the default encoding of any database you create later, unless you override it then. The character sets supported by the PostgreSQL server are described in Section 23.3.1 ."},{"signature":{"text":"-g --allow-group-access","url":"/docs/18/app-initdb.html#APP-INITDB-ALLOW-GROUP-ACCESS"},"summary":"Allows users in the same group as the cluster owner to read all cluster files created by initdb . This option is ignored on Windows as it does not support POSIX -style group permissions."},{"signature":{"text":"--icu-locale= locale","url":"/docs/18/app-initdb.html#APP-INITDB-ICU-LOCALE"},"summary":"Specifies the ICU locale when the ICU provider is used. Locale support is described in Section 23.1 ."},{"signature":{"text":"--icu-rules= rules","url":"/docs/18/app-initdb.html#APP-INITDB-ICU-RULES"},"summary":"Specifies additional collation rules to customize the behavior of the default collation. This is supported for ICU only."},{"signature":{"text":"-k --data-checksums","url":"/docs/18/app-initdb.html#APP-INITDB-DATA-CHECKSUMS"},"summary":"Use checksums on data pages to help detect corruption by the I/O system that would otherwise be silent. This is enabled by default; use --no-data-checksums to disable checksums."},{"signature":{"text":"--locale= locale","url":"/docs/18/app-initdb.html#APP-INITDB-OPTION-LOCALE"},"summary":"Sets the default locale for the database cluster. If this option is not specified, the locale is inherited from the environment that initdb runs in. Locale support is described in Section 23.1 ."},{"signature":{"text":"--lc-collate= locale --lc-ctype= locale --lc-messages= locale --lc-monetary= locale --lc-numeric= locale --lc-time= locale","url":"/docs/18/app-initdb.html#APP-INITDB-OPTION-LC-COLLATE"},"summary":"Like --locale , but only sets the locale in the specified category."},{"signature":{"text":"--no-locale","url":"/docs/18/app-initdb.html#APP-INITDB-OPTION-NO-LOCALE"},"summary":"Equivalent to --locale=C ."},{"signature":{"text":"--builtin-locale= locale","url":"/docs/18/app-initdb.html#APP-INITDB-BUILTIN-LOCALE"},"summary":"Specifies the locale name when the builtin provider is used. Locale support is described in Section 23.1 ."},{"signature":{"text":"--locale-provider={ builtin | libc | icu }","url":"/docs/18/app-initdb.html#APP-INITDB-OPTION-LOCALE-PROVIDER"},"summary":"This option sets the locale provider for databases created in the new cluster. It can be overridden in the CREATE DATABASE command when new databases are subsequently created. The default is libc (see Section 23.1.4 )."},{"signature":{"text":"--no-data-checksums","url":"/docs/18/app-initdb.html#APP-INITDB-NO-DATA-CHECKSUMS"},"summary":"Do not enable data checksums."},{"signature":{"text":"--pwfile= filename","url":"/docs/18/app-initdb.html#APP-INITDB-OPTION-PWFILE"},"summary":"Makes initdb read the bootstrap superuser's password from a file. The first line of the file is taken as the password."},{"signature":{"text":"-T config --text-search-config= config","url":"/docs/18/app-initdb.html#APP-INITDB-OPTION-TEXT-SEARCH-CONFIG"},"summary":"Sets the default text search configuration. See default_text_search_config for further information."},{"signature":{"text":"-U username --username= username","url":"/docs/18/app-initdb.html#APP-INITDB-OPTION-USERNAME"},"summary":"Sets the user name of the bootstrap superuser . This defaults to the name of the operating-system user running initdb ."},{"signature":{"text":"-W --pwprompt","url":"/docs/18/app-initdb.html#APP-INITDB-OPTION-PWPROMPT"},"summary":"Makes initdb prompt for a password to give the bootstrap superuser. If you don't plan on using password authentication, this is not important. Otherwise you won't be able to use password authentication until you have a password set up."},{"signature":{"text":"-X directory --waldir= directory","url":"/docs/18/app-initdb.html#APP-INITDB-OPTION-WALDIR"},"summary":"This option specifies the directory where the write-ahead log should be stored."},{"signature":{"text":"--wal-segsize= size","url":"/docs/18/app-initdb.html#APP-INITDB-OPTION-WAL-SEGSIZE"},"summary":"Set the WAL segment size , in megabytes. This is the size of each individual file in the WAL log. The default size is 16 megabytes. The value must be a power of 2 between 1 and 1024 (megabytes). This option can only be set during initialization, and cannot be changed later."},{"signature":{"text":"-c name = value --set name = value","url":"/docs/18/app-initdb.html#APP-INITDB-OPTION-SET"},"summary":"Forcibly set the server parameter name to value during initdb , and also install that setting in the generated postgresql.conf file, so that it will apply during future server runs. This option can be given more than once to set several parameters. It is primarily useful when the environment is such that the server will not start at all using the default parameters."},{"signature":{"text":"-d --debug","url":"/docs/18/app-initdb.html#APP-INITDB-OPTION-DEBUG"},"summary":"Print debugging output from the bootstrap backend and a few other messages of lesser interest for the general public. The bootstrap backend is the program initdb uses to create the catalog tables. This option generates a tremendous amount of extremely boring output."},{"signature":{"text":"--discard-caches","url":"/docs/18/app-initdb.html#APP-INITDB-OPTION-DISCARD-CACHES"},"summary":"Run the bootstrap backend with the debug_discard_caches=1 option. This takes a very long time and is only of use for deep debugging."},{"signature":{"text":"-L directory","url":"/docs/18/app-initdb.html#APP-INITDB-OPTION-L"},"summary":"Specifies where initdb should find its input files to initialize the database cluster. This is normally not necessary. You will be told if you need to specify their location explicitly."},{"signature":{"text":"-n --no-clean","url":"/docs/18/app-initdb.html#APP-INITDB-OPTION-NO-CLEAN"},"summary":"By default, when initdb determines that an error prevented it from completely creating the database cluster, it removes any files it might have created before discovering that it cannot finish the job. This option inhibits tidying-up and is thus useful for debugging."},{"signature":{"text":"-N --no-sync","url":"/docs/18/app-initdb.html#APP-INITDB-OPTION-NO-SYNC"},"summary":"By default, initdb will wait for all files to be written safely to disk. This option causes initdb to return without waiting, which is faster, but means that a subsequent operating system crash can leave the data directory corrupt. Generally, this option is useful for testing, but should not be used when creating a production installation."},{"signature":{"text":"--no-sync-data-files","url":"/docs/18/app-initdb.html#APP-INITDB-OPTION-NO-SYNC-DATA-FILES"},"summary":"By default, initdb safely writes all database files to disk. This option instructs initdb to skip synchronizing all files in the individual database directories, the database directories themselves, and the tablespace directories, i.e., everything in the base subdirectory and any other tablespace directories. Other files, such as those in pg_wal and pg_xact , will still be synchronized unless the --no-sync option is also specified."},{"signature":{"text":"--no-instructions","url":"/docs/18/app-initdb.html#APP-INITDB-OPTION-NO-INSTRUCTIONS"},"summary":"By default, initdb will write instructions for how to start the cluster at the end of its output. This option causes those instructions to be left out. This is primarily intended for use by tools that wrap initdb in platform-specific behavior, where those instructions are likely to be incorrect."},{"signature":{"text":"-s --show","url":"/docs/18/app-initdb.html#APP-INITDB-OPTION-SHOW"},"summary":"Show internal settings and exit, without doing anything else. This can be used to debug the initdb installation."},{"signature":{"text":"--sync-method= method","url":"/docs/18/app-initdb.html#APP-INITDB-OPTION-SYNC-METHOD"},"summary":"When set to fsync , which is the default, initdb will recursively open and synchronize all files in the data directory. The search for files will follow symbolic links for the WAL directory and each configured tablespace."},{"signature":{"text":"-S --sync-only","url":"/docs/18/app-initdb.html#APP-INITDB-OPTION-SYNC-ONLY"},"summary":"Safely write all database files to disk and exit. This does not perform any of the normal initdb operations. Generally, this option is useful for ensuring reliable recovery after changing fsync from off to on ."},{"signature":{"text":"-V --version","url":"/docs/18/app-initdb.html#APP-INITDB-OPTION-VERSION"},"summary":"Print the initdb version and exit."},{"signature":{"text":"-? --help","url":"/docs/18/app-initdb.html#APP-INITDB-OPTION-HELP"},"summary":"Show help about initdb command line arguments, and exit."}],"title":"Documented options"},{"columns":[{"key":"name","label":"Variable"},{"key":"description","label":"Meaning"}],"key":"environment","rows":[{"description":"Specifies the directory where the database cluster is to be stored; can be overridden using the -D option.","name":"PGDATA"},{"description":"Specifies whether to use color in diagnostic messages. Possible values are always , auto and never .","name":"PG_COLOR"},{"description":"Specifies the default time zone of the created database cluster. The value should be a full time zone name (see Section 8.5.3 ).","name":"TZ"}],"title":"Environment variables"}]},"ManualEvidence":{"manual_path":"app-initdb.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-initdb.html","label":"18.6 English manual · app-initdb.html","sha256":"ca8245d2c61740de3b11df2b81993b18e311705e2c23bebfa7cafda1bcd15321","url":"/docs/18/app-initdb.html"},{"anchor":"","file":"reference-server.html","label":"Server applications inventory","sha256":"e9f8bbcc8e3641fadd1d20991e8aad6b532155b786ba5a1b7b364ec4f1a5bef3","url":"/docs/18/reference-server.html"}]},"MeasuredEvidence":{}},"Text":{"Collection":"tool","Key":"initdb","SourceDatabase":"center","Version":"18","Locale":"en","Title":"initdb","Summary":"initdb — create a new PostgreSQL database cluster","BodyHTML":"\u003cdiv\u003e\u003cdiv id=\"APP-INITDB\"\u003e\n\u003cdiv\u003e\u003c/div\u003e\n\u003cdiv\u003e\n\u003ch2\u003e\u003cspan\u003e\u003cspan\u003einitdb\u003c/span\u003e\u003c/span\u003e\u003c/h2\u003e\n\u003cp\u003einitdb — create a new \u003cspan\u003ePostgreSQL\u003c/span\u003e database cluster\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.5.3.4.1\"\u003e\u003ccode\u003einitdb\u003c/code\u003e [\u003cem\u003e\u003ccode\u003eoption\u003c/code\u003e\u003c/em\u003e...] [ \u003ccode\u003e--pgdata\u003c/code\u003e | \u003ccode\u003e-D\u003c/code\u003e ] \u003cem\u003e\u003ccode\u003edirectory\u003c/code\u003e\u003c/em\u003e\u003c/p\u003e\n\u003c/div\u003e\n\u003c/div\u003e\n\u003cdiv id=\"R1-APP-INITDB-1\"\u003e\n\u003ch2\u003eDescription\u003c/h2\u003e\n\u003cp\u003e\u003ccode\u003einitdb\u003c/code\u003e creates a new \u003cspan\u003ePostgreSQL\u003c/span\u003e \u003ca href=\"/docs/18/glossary.html#GLOSSARY-DB-CLUSTER\" rel=\"nofollow\"\u003e\u003c/a\u003e\u003ca href=\"/docs/18/glossary.html#GLOSSARY-DB-CLUSTER\" title=\"Database cluster\" rel=\"nofollow\"\u003edatabase cluster\u003c/a\u003e.\u003c/p\u003e\n\u003cp\u003eCreating a database cluster consists of creating the \u003ca href=\"/docs/18/glossary.html#GLOSSARY-DATA-DIRECTORY\" rel=\"nofollow\"\u003e\u003c/a\u003e\u003ca href=\"/docs/18/glossary.html#GLOSSARY-DATA-DIRECTORY\" title=\"Data directory\" rel=\"nofollow\"\u003edirectories\u003c/a\u003e in which the cluster data will live, generating the shared catalog tables (tables that belong to the whole cluster rather than to any particular database), and creating the \u003ccode\u003epostgres\u003c/code\u003e, \u003ccode\u003etemplate1\u003c/code\u003e, and \u003ccode\u003etemplate0\u003c/code\u003e databases. The \u003ccode\u003epostgres\u003c/code\u003e database is a default database meant for use by users, utilities and third party applications. \u003ccode\u003etemplate1\u003c/code\u003e and \u003ccode\u003etemplate0\u003c/code\u003e are meant as source databases to be copied by later \u003ccode\u003eCREATE DATABASE\u003c/code\u003e commands. \u003ccode\u003etemplate0\u003c/code\u003e should never be modified, but you can add objects to \u003ccode\u003etemplate1\u003c/code\u003e, which by default will be copied into databases created later. See \u003ca href=\"/docs/18/manage-ag-templatedbs.html\" rel=\"nofollow\"\u003eSection 22.3\u003c/a\u003e for more details.\u003c/p\u003e\n\u003cp\u003eAlthough \u003ccode\u003einitdb\u003c/code\u003e will attempt to create the specified data directory, it might not have permission if the parent directory of the desired data directory is root-owned. To initialize in such a setup, create an empty data directory as root, then use \u003ccode\u003echown\u003c/code\u003e to assign ownership of that directory to the database user account, then \u003ccode\u003esu\u003c/code\u003e to become the database user to run \u003ccode\u003einitdb\u003c/code\u003e.\u003c/p\u003e\n\u003cp\u003e\u003ccode\u003einitdb\u003c/code\u003e must be run as the user that will own the server process, because the server needs to have access to the files and directories that \u003ccode\u003einitdb\u003c/code\u003e creates. Since the server cannot be run as root, you must not run \u003ccode\u003einitdb\u003c/code\u003e as root either. (It will in fact refuse to do so.)\u003c/p\u003e\n\u003cp\u003eFor security reasons the new cluster created by \u003ccode\u003einitdb\u003c/code\u003e will only be accessible by the cluster owner by default. The \u003ccode\u003e--allow-group-access\u003c/code\u003e option allows any user in the same group as the cluster owner to read files in the cluster. This is useful for performing backups as a non-privileged user.\u003c/p\u003e\n\u003cp\u003e\u003ccode\u003einitdb\u003c/code\u003e initializes the database cluster\u0026#39;s default locale and character set encoding. These can also be set separately for each database when it is created. \u003ccode\u003einitdb\u003c/code\u003e determines those settings for the template databases, which will serve as the default for all other databases.\u003c/p\u003e\n\u003cp\u003eBy default, \u003ccode\u003einitdb\u003c/code\u003e uses the locale provider \u003ccode\u003elibc\u003c/code\u003e (see \u003ca href=\"/docs/18/locale.html#LOCALE-PROVIDERS\" rel=\"nofollow\"\u003eSection 23.1.4\u003c/a\u003e). The \u003ccode\u003elibc\u003c/code\u003e locale provider takes the locale settings from the environment, and determines the encoding from the locale settings.\u003c/p\u003e\n\u003cp\u003eTo choose a different locale for the cluster, use the option \u003ccode\u003e--locale\u003c/code\u003e. There are also individual options \u003ccode\u003e--lc-*\u003c/code\u003e and \u003ccode\u003e--icu-locale\u003c/code\u003e (see below) to set values for the individual locale categories. Note that inconsistent settings for different locale categories can give nonsensical results, so this should be used with care.\u003c/p\u003e\n\u003cp\u003eAlternatively, \u003ccode\u003einitdb\u003c/code\u003e can use the ICU library to provide locale services by specifying \u003ccode\u003e--locale-provider=icu\u003c/code\u003e. The server must be built with ICU support. To choose the specific ICU locale ID to apply, use the option \u003ccode\u003e--icu-locale\u003c/code\u003e. Note that for implementation reasons and to support legacy code, \u003ccode\u003einitdb\u003c/code\u003e will still select and initialize libc locale settings when the ICU locale provider is used.\u003c/p\u003e\n\u003cp\u003eWhen \u003ccode\u003einitdb\u003c/code\u003e runs, it will print out the locale settings it has chosen. If you have complex requirements or specified multiple options, it is advisable to check that the result matches what was intended.\u003c/p\u003e\n\u003cp\u003eMore details about locale settings can be found in \u003ca href=\"/docs/18/locale.html\" rel=\"nofollow\"\u003eSection 23.1\u003c/a\u003e.\u003c/p\u003e\n\u003cp\u003eTo alter the default encoding, use the \u003ccode\u003e--encoding\u003c/code\u003e. More details can be found in \u003ca href=\"/docs/18/multibyte.html\" rel=\"nofollow\"\u003eSection 23.3\u003c/a\u003e.\u003c/p\u003e\n\u003c/div\u003e\n\u003cdiv id=\"id-1.9.5.3.6\"\u003e\n\u003ch2\u003eOptions\u003c/h2\u003e\n\u003cdiv\u003e\n\u003cdl\u003e\n\u003cdt id=\"APP-INITDB-OPTION-AUTH\"\u003e\u003cspan\u003e\u003ccode\u003e-A \u003cem\u003e\u003ccode\u003eauthmethod\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan\u003e\u003ccode\u003e--auth=\u003cem\u003e\u003ccode\u003eauthmethod\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eThis option specifies the default authentication method for local users used in \u003ccode\u003epg_hba.conf\u003c/code\u003e (\u003ccode\u003ehost\u003c/code\u003e and \u003ccode\u003elocal\u003c/code\u003e lines). See \u003ca href=\"/docs/18/auth-pg-hba-conf.html\" rel=\"nofollow\"\u003eSection 20.1\u003c/a\u003e for an overview of valid values.\u003c/p\u003e\n\u003cp\u003e\u003ccode\u003einitdb\u003c/code\u003e will prepopulate \u003ccode\u003epg_hba.conf\u003c/code\u003e entries using the specified authentication method for non-replication as well as replication connections.\u003c/p\u003e\n\u003cp\u003eDo not use \u003ccode\u003etrust\u003c/code\u003e unless you trust all local users on your system. \u003ccode\u003etrust\u003c/code\u003e is the default for ease of installation.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt id=\"APP-INITDB-OPTION-AUTH-HOST\"\u003e\u003cspan\u003e\u003ccode\u003e--auth-host=\u003cem\u003e\u003ccode\u003eauthmethod\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eThis option specifies the authentication method for local users via TCP/IP connections used in \u003ccode\u003epg_hba.conf\u003c/code\u003e (\u003ccode\u003ehost\u003c/code\u003e lines).\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt id=\"APP-INITDB-OPTION-AUTH-LOCAL\"\u003e\u003cspan\u003e\u003ccode\u003e--auth-local=\u003cem\u003e\u003ccode\u003eauthmethod\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eThis option specifies the authentication method for local users via Unix-domain socket connections used in \u003ccode\u003epg_hba.conf\u003c/code\u003e (\u003ccode\u003elocal\u003c/code\u003e lines).\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt id=\"APP-INITDB-OPTION-PGDATA\"\u003e\u003cspan\u003e\u003ccode\u003e-D \u003cem\u003e\u003ccode\u003edirectory\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan\u003e\u003ccode\u003e--pgdata=\u003cem\u003e\u003ccode\u003edirectory\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eThis option specifies the directory where the database cluster should be stored. This is the only information required by \u003ccode\u003einitdb\u003c/code\u003e, but you can avoid writing it by setting the \u003ccode\u003ePGDATA\u003c/code\u003e environment variable, which can be convenient since the database server (\u003ccode\u003epostgres\u003c/code\u003e) can find the data directory later by the same variable.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt id=\"APP-INITDB-OPTION-ENCODING\"\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\u003eSelects the encoding of the template databases. This will also be the default encoding of any database you create later, unless you override it then. 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\u003cp\u003eBy default, the template database encoding is derived from the locale. If \u003ca href=\"/docs/18/app-initdb.html#APP-INITDB-OPTION-NO-LOCALE\" rel=\"nofollow\"\u003e\u003ccode\u003e--no-locale\u003c/code\u003e\u003c/a\u003e is specified (or equivalently, if the locale is \u003ccode\u003eC\u003c/code\u003e or \u003ccode\u003ePOSIX\u003c/code\u003e), then the default is \u003ccode\u003eUTF8\u003c/code\u003e for the ICU provider and \u003ccode\u003eSQL_ASCII\u003c/code\u003e for the \u003ccode\u003elibc\u003c/code\u003e provider.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt id=\"APP-INITDB-ALLOW-GROUP-ACCESS\"\u003e\u003cspan\u003e\u003ccode\u003e-g\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan\u003e\u003ccode\u003e--allow-group-access\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eAllows users in the same group as the cluster owner to read all cluster files created by \u003ccode\u003einitdb\u003c/code\u003e. This option is ignored on \u003cspan\u003eWindows\u003c/span\u003e as it does not support POSIX-style group permissions.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt id=\"APP-INITDB-ICU-LOCALE\"\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 when the ICU 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 id=\"APP-INITDB-ICU-RULES\"\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. This is supported for ICU only.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt id=\"APP-INITDB-DATA-CHECKSUMS\"\u003e\u003cspan\u003e\u003ccode\u003e-k\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan\u003e\u003ccode\u003e--data-checksums\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eUse checksums on data pages to help detect corruption by the I/O system that would otherwise be silent. This is enabled by default; use \u003ca href=\"/docs/18/app-initdb.html#APP-INITDB-NO-DATA-CHECKSUMS\" rel=\"nofollow\"\u003e\u003ccode\u003e--no-data-checksums\u003c/code\u003e\u003c/a\u003e to disable checksums.\u003c/p\u003e\n\u003cp\u003eEnabling checksums might incur a small performance penalty. If set, checksums are calculated for all objects, in all databases. All checksum failures will be reported in the \u003ca href=\"/docs/18/monitoring-stats.html#MONITORING-PG-STAT-DATABASE-VIEW\" rel=\"nofollow\"\u003e\u003ccode\u003epg_stat_database\u003c/code\u003e\u003c/a\u003e view. See \u003ca href=\"/docs/18/checksums.html\" rel=\"nofollow\"\u003eSection 28.2\u003c/a\u003e for details.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt id=\"APP-INITDB-OPTION-LOCALE\"\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\u003eSets the default locale for the database cluster. If this option is not specified, the locale is inherited from the environment that \u003ccode\u003einitdb\u003c/code\u003e runs in. Locale support is described in \u003ca href=\"/docs/18/locale.html\" rel=\"nofollow\"\u003eSection 23.1\u003c/a\u003e.\u003c/p\u003e\n\u003cp\u003eIf \u003ccode\u003e--locale-provider\u003c/code\u003e is \u003ccode\u003ebuiltin\u003c/code\u003e, \u003ccode\u003e--locale\u003c/code\u003e or \u003ccode\u003e--builtin-locale\u003c/code\u003e must be specified and set to \u003ccode\u003eC\u003c/code\u003e, \u003ccode\u003eC.UTF-8\u003c/code\u003e or \u003ccode\u003ePG_UNICODE_FAST\u003c/code\u003e.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt id=\"APP-INITDB-OPTION-LC-COLLATE\"\u003e\u003cspan\u003e\u003ccode\u003e--lc-collate=\u003cem\u003e\u003ccode\u003elocale\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan\u003e\u003ccode\u003e--lc-ctype=\u003cem\u003e\u003ccode\u003elocale\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan\u003e\u003ccode\u003e--lc-messages=\u003cem\u003e\u003ccode\u003elocale\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan\u003e\u003ccode\u003e--lc-monetary=\u003cem\u003e\u003ccode\u003elocale\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan\u003e\u003ccode\u003e--lc-numeric=\u003cem\u003e\u003ccode\u003elocale\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan\u003e\u003ccode\u003e--lc-time=\u003cem\u003e\u003ccode\u003elocale\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eLike \u003ccode\u003e--locale\u003c/code\u003e, but only sets the locale in the specified category.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt id=\"APP-INITDB-OPTION-NO-LOCALE\"\u003e\u003cspan\u003e\u003ccode\u003e--no-locale\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eEquivalent to \u003ccode\u003e--locale=C\u003c/code\u003e.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt id=\"APP-INITDB-BUILTIN-LOCALE\"\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 id=\"APP-INITDB-OPTION-LOCALE-PROVIDER\"\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\u003eThis option sets the locale provider for databases created in the new cluster. It can be overridden in the \u003ccode\u003eCREATE DATABASE\u003c/code\u003e command when new databases are subsequently created. The default is \u003ccode\u003elibc\u003c/code\u003e (see \u003ca href=\"/docs/18/locale.html#LOCALE-PROVIDERS\" rel=\"nofollow\"\u003eSection 23.1.4\u003c/a\u003e).\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt id=\"APP-INITDB-NO-DATA-CHECKSUMS\"\u003e\u003cspan\u003e\u003ccode\u003e--no-data-checksums\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eDo not enable data checksums.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt id=\"APP-INITDB-OPTION-PWFILE\"\u003e\u003cspan\u003e\u003ccode\u003e--pwfile=\u003cem\u003e\u003ccode\u003efilename\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eMakes \u003ccode\u003einitdb\u003c/code\u003e read the bootstrap superuser\u0026#39;s password from a file. The first line of the file is taken as the password.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt id=\"APP-INITDB-OPTION-TEXT-SEARCH-CONFIG\"\u003e\u003cspan\u003e\u003ccode\u003e-T \u003cem\u003e\u003ccode\u003econfig\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan\u003e\u003ccode\u003e--text-search-config=\u003cem\u003e\u003ccode\u003econfig\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eSets the default text search configuration. See \u003ca href=\"/docs/18/runtime-config-client.html#GUC-DEFAULT-TEXT-SEARCH-CONFIG\" rel=\"nofollow\"\u003edefault_text_search_config\u003c/a\u003e for further information.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt id=\"APP-INITDB-OPTION-USERNAME\"\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\u003eSets the user name of the \u003ca href=\"/docs/18/glossary.html#GLOSSARY-BOOTSTRAP-SUPERUSER\" rel=\"nofollow\"\u003e\u003c/a\u003e\u003ca href=\"/docs/18/glossary.html#GLOSSARY-BOOTSTRAP-SUPERUSER\" title=\"Bootstrap superuser\" rel=\"nofollow\"\u003ebootstrap superuser\u003c/a\u003e. This defaults to the name of the operating-system user running \u003ccode\u003einitdb\u003c/code\u003e.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt id=\"APP-INITDB-OPTION-PWPROMPT\"\u003e\u003cspan\u003e\u003ccode\u003e-W\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan\u003e\u003ccode\u003e--pwprompt\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eMakes \u003ccode\u003einitdb\u003c/code\u003e prompt for a password to give the bootstrap superuser. If you don\u0026#39;t plan on using password authentication, this is not important. Otherwise you won\u0026#39;t be able to use password authentication until you have a password set up.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt id=\"APP-INITDB-OPTION-WALDIR\"\u003e\u003cspan\u003e\u003ccode\u003e-X \u003cem\u003e\u003ccode\u003edirectory\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan\u003e\u003ccode\u003e--waldir=\u003cem\u003e\u003ccode\u003edirectory\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eThis option specifies the directory where the write-ahead log should be stored.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt id=\"APP-INITDB-OPTION-WAL-SEGSIZE\"\u003e\u003cspan\u003e\u003ccode\u003e--wal-segsize=\u003cem\u003e\u003ccode\u003esize\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eSet the \u003cem\u003eWAL segment size\u003c/em\u003e, in megabytes. This is the size of each individual file in the WAL log. The default size is 16 megabytes. The value must be a power of 2 between 1 and 1024 (megabytes). This option can only be set during initialization, and cannot be changed later.\u003c/p\u003e\n\u003cp\u003eIt may be useful to adjust this size to control the granularity of WAL log shipping or archiving. Also, in databases with a high volume of WAL, the sheer number of WAL files per directory can become a performance and management problem. Increasing the WAL file size will reduce the number of WAL files.\u003c/p\u003e\n\u003c/dd\u003e\n\u003c/dl\u003e\n\u003c/div\u003e\n\u003cp\u003eOther, less commonly used, options are also available:\u003c/p\u003e\n\u003cdiv\u003e\n\u003cdl\u003e\n\u003cdt id=\"APP-INITDB-OPTION-SET\"\u003e\u003cspan\u003e\u003ccode\u003e-c \u003cem\u003e\u003ccode\u003ename\u003c/code\u003e\u003c/em\u003e=\u003cem\u003e\u003ccode\u003evalue\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan\u003e\u003ccode\u003e--set \u003cem\u003e\u003ccode\u003ename\u003c/code\u003e\u003c/em\u003e=\u003cem\u003e\u003ccode\u003evalue\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eForcibly set the server parameter \u003cem\u003e\u003ccode\u003ename\u003c/code\u003e\u003c/em\u003e to \u003cem\u003e\u003ccode\u003evalue\u003c/code\u003e\u003c/em\u003e during \u003ccode\u003einitdb\u003c/code\u003e, and also install that setting in the generated \u003ccode\u003epostgresql.conf\u003c/code\u003e file, so that it will apply during future server runs. This option can be given more than once to set several parameters. It is primarily useful when the environment is such that the server will not start at all using the default parameters.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt id=\"APP-INITDB-OPTION-DEBUG\"\u003e\u003cspan\u003e\u003ccode\u003e-d\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan\u003e\u003ccode\u003e--debug\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003ePrint debugging output from the bootstrap backend and a few other messages of lesser interest for the general public. The bootstrap backend is the program \u003ccode\u003einitdb\u003c/code\u003e uses to create the catalog tables. This option generates a tremendous amount of extremely boring output.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt id=\"APP-INITDB-OPTION-DISCARD-CACHES\"\u003e\u003cspan\u003e\u003ccode\u003e--discard-caches\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eRun the bootstrap backend with the \u003ccode\u003edebug_discard_caches=1\u003c/code\u003e option. This takes a very long time and is only of use for deep debugging.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt id=\"APP-INITDB-OPTION-L\"\u003e\u003cspan\u003e\u003ccode\u003e-L \u003cem\u003e\u003ccode\u003edirectory\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eSpecifies where \u003ccode\u003einitdb\u003c/code\u003e should find its input files to initialize the database cluster. This is normally not necessary. You will be told if you need to specify their location explicitly.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt id=\"APP-INITDB-OPTION-NO-CLEAN\"\u003e\u003cspan\u003e\u003ccode\u003e-n\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan\u003e\u003ccode\u003e--no-clean\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eBy default, when \u003ccode\u003einitdb\u003c/code\u003e determines that an error prevented it from completely creating the database cluster, it removes any files it might have created before discovering that it cannot finish the job. This option inhibits tidying-up and is thus useful for debugging.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt id=\"APP-INITDB-OPTION-NO-SYNC\"\u003e\u003cspan\u003e\u003ccode\u003e-N\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan\u003e\u003ccode\u003e--no-sync\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eBy default, \u003ccode\u003einitdb\u003c/code\u003e will wait for all files to be written safely to disk. This option causes \u003ccode\u003einitdb\u003c/code\u003e to return without waiting, which is faster, but means that a subsequent operating system crash can leave the data directory corrupt. Generally, this option is useful for testing, but should not be used when creating a production installation.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt id=\"APP-INITDB-OPTION-NO-SYNC-DATA-FILES\"\u003e\u003cspan\u003e\u003ccode\u003e--no-sync-data-files\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eBy default, \u003ccode\u003einitdb\u003c/code\u003e safely writes all database files to disk. This option instructs \u003ccode\u003einitdb\u003c/code\u003e to skip synchronizing all files in the individual database directories, the database directories themselves, and the tablespace directories, i.e., everything in the \u003ccode\u003ebase\u003c/code\u003e subdirectory and any other tablespace directories. Other files, such as those in \u003ccode\u003epg_wal\u003c/code\u003e and \u003ccode\u003epg_xact\u003c/code\u003e, will still be synchronized unless the \u003ccode\u003e--no-sync\u003c/code\u003e option is also specified.\u003c/p\u003e\n\u003cp\u003eNote that if \u003ccode\u003e--no-sync-data-files\u003c/code\u003e is used in conjunction with \u003ccode\u003e--sync-method=syncfs\u003c/code\u003e, some or all of the aforementioned files and directories will be synchronized because \u003ccode\u003esyncfs\u003c/code\u003e processes entire file systems.\u003c/p\u003e\n\u003cp\u003eThis option is primarily intended for internal use by tools that separately ensure the skipped files are synchronized to disk.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt id=\"APP-INITDB-OPTION-NO-INSTRUCTIONS\"\u003e\u003cspan\u003e\u003ccode\u003e--no-instructions\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eBy default, \u003ccode\u003einitdb\u003c/code\u003e will write instructions for how to start the cluster at the end of its output. This option causes those instructions to be left out. This is primarily intended for use by tools that wrap \u003ccode\u003einitdb\u003c/code\u003e in platform-specific behavior, where those instructions are likely to be incorrect.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt id=\"APP-INITDB-OPTION-SHOW\"\u003e\u003cspan\u003e\u003ccode\u003e-s\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan\u003e\u003ccode\u003e--show\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eShow internal settings and exit, without doing anything else. This can be used to debug the \u003cspan\u003einitdb\u003c/span\u003e installation.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt id=\"APP-INITDB-OPTION-SYNC-METHOD\"\u003e\u003cspan\u003e\u003ccode\u003e--sync-method=\u003cem\u003e\u003ccode\u003emethod\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eWhen set to \u003ccode\u003efsync\u003c/code\u003e, which is the default, \u003ccode\u003einitdb\u003c/code\u003e will recursively open and synchronize all files in the data directory. The search for files will follow symbolic links for the WAL directory and each configured tablespace.\u003c/p\u003e\n\u003cp\u003eOn Linux, \u003ccode\u003esyncfs\u003c/code\u003e may be used instead to ask the operating system to synchronize the whole file systems that contain the data directory, the WAL files, and each tablespace. See \u003ca href=\"/docs/18/runtime-config-error-handling.html#GUC-RECOVERY-INIT-SYNC-METHOD\" rel=\"nofollow\"\u003erecovery_init_sync_method\u003c/a\u003e for information about the caveats to be aware of when using \u003ccode\u003esyncfs\u003c/code\u003e.\u003c/p\u003e\n\u003cp\u003eThis option has no effect when \u003ccode\u003e--no-sync\u003c/code\u003e is used.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt id=\"APP-INITDB-OPTION-SYNC-ONLY\"\u003e\u003cspan\u003e\u003ccode\u003e-S\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan\u003e\u003ccode\u003e--sync-only\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eSafely write all database files to disk and exit. This does not perform any of the normal \u003cspan\u003einitdb\u003c/span\u003e operations. Generally, this option is useful for ensuring reliable recovery after changing \u003ca href=\"/docs/18/runtime-config-wal.html#GUC-FSYNC\" rel=\"nofollow\"\u003efsync\u003c/a\u003e from \u003ccode\u003eoff\u003c/code\u003e to \u003ccode\u003eon\u003c/code\u003e.\u003c/p\u003e\n\u003c/dd\u003e\n\u003c/dl\u003e\n\u003c/div\u003e\n\u003cp\u003eOther options:\u003c/p\u003e\n\u003cdiv\u003e\n\u003cdl\u003e\n\u003cdt id=\"APP-INITDB-OPTION-VERSION\"\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\u003einitdb\u003c/span\u003e version and exit.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt id=\"APP-INITDB-OPTION-HELP\"\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\u003einitdb\u003c/span\u003e command line arguments, and exit.\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.5.3.7\"\u003e\n\u003ch2\u003eEnvironment\u003c/h2\u003e\n\u003cdiv\u003e\n\u003cdl\u003e\n\u003cdt id=\"APP-INITDB-ENVIRONMENT-PGDATA\"\u003e\u003cspan\u003e\u003ccode\u003ePGDATA\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eSpecifies the directory where the database cluster is to be stored; can be overridden using the \u003ccode\u003e-D\u003c/code\u003e option.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt id=\"APP-INITDB-ENVIRONMENT-PG-COLOR\"\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\u003cdt id=\"APP-INITDB-ENVIRONMENT-TZ\"\u003e\u003cspan\u003e\u003ccode\u003eTZ\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eSpecifies the default time zone of the created database cluster. The value should be a full time zone name (see \u003ca href=\"/docs/18/datatype-datetime.html#DATATYPE-TIMEZONES\" rel=\"nofollow\"\u003eSection 8.5.3\u003c/a\u003e).\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.5.3.8\"\u003e\n\u003ch2\u003eNotes\u003c/h2\u003e\n\u003cp\u003e\u003ccode\u003einitdb\u003c/code\u003e can also be invoked via \u003ccode\u003epg_ctl initdb\u003c/code\u003e.\u003c/p\u003e\n\u003c/div\u003e\n\u003cdiv id=\"id-1.9.5.3.9\"\u003e\n\u003ch2\u003eSee Also\u003c/h2\u003e\u003cspan\u003e\u003ca href=\"/docs/18/app-pg-ctl.html\" title=\"pg_ctl\" rel=\"nofollow\"\u003e\u003cspan\u003e\u003cspan\u003epg_ctl\u003c/span\u003e\u003c/span\u003e\u003c/a\u003e, \u003ca href=\"/docs/18/app-postgres.html\" title=\"postgres\" rel=\"nofollow\"\u003e\u003cspan\u003e\u003cspan\u003epostgres\u003c/span\u003e\u003c/span\u003e\u003c/a\u003e, \u003ca href=\"/docs/18/auth-pg-hba-conf.html\" rel=\"nofollow\"\u003eSection 20.1\u003c/a\u003e\u003c/span\u003e\n\u003c/div\u003e\n\u003c/div\u003e\u003c/div\u003e","SourceRevision":"ee8d1a3612338fd9adf250730cb640fcc5233b5491337cc00a316a44e3a0b9f8","ContentHash":"bbe220131ab5b791c647c6eed5b7fe347fed394563706e959c4c7b60a4491b2f","Payload":{"description":["initdb — create a new PostgreSQL database cluster"],"manual_html":"\u003cdiv\u003e\u003cdiv class=\"refentry\" id=\"APP-INITDB\"\u003e\n\u003cdiv class=\"titlepage\"\u003e\u003c/div\u003e\n\u003cdiv class=\"refnamediv\"\u003e\n\u003ch2\u003e\u003cspan class=\"refentrytitle\"\u003e\u003cspan class=\"application\"\u003einitdb\u003c/span\u003e\u003c/span\u003e\u003c/h2\u003e\n\u003cp\u003einitdb — create a new \u003cspan class=\"productname\"\u003ePostgreSQL\u003c/span\u003e database cluster\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.5.3.4.1\"\u003e\u003ccode class=\"command\"\u003einitdb\u003c/code\u003e [\u003cem class=\"replaceable\"\u003e\u003ccode\u003eoption\u003c/code\u003e\u003c/em\u003e...] [ \u003ccode class=\"option\"\u003e--pgdata\u003c/code\u003e | \u003ccode class=\"option\"\u003e-D\u003c/code\u003e ] \u003cem class=\"replaceable\"\u003e\u003ccode\u003edirectory\u003c/code\u003e\u003c/em\u003e\u003c/p\u003e\n\u003c/div\u003e\n\u003c/div\u003e\n\u003cdiv class=\"refsect1\" id=\"R1-APP-INITDB-1\"\u003e\n\u003ch2\u003eDescription\u003c/h2\u003e\n\u003cp\u003e\u003ccode class=\"command\"\u003einitdb\u003c/code\u003e creates a new \u003cspan class=\"productname\"\u003ePostgreSQL\u003c/span\u003e \u003ca class=\"glossterm\" href=\"/docs/18/glossary.html#GLOSSARY-DB-CLUSTER\"\u003e\u003c/a\u003e\u003ca class=\"glossterm\" href=\"/docs/18/glossary.html#GLOSSARY-DB-CLUSTER\" title=\"Database cluster\"\u003edatabase cluster\u003c/a\u003e.\u003c/p\u003e\n\u003cp\u003eCreating a database cluster consists of creating the \u003ca class=\"glossterm\" href=\"/docs/18/glossary.html#GLOSSARY-DATA-DIRECTORY\"\u003e\u003c/a\u003e\u003ca class=\"glossterm\" href=\"/docs/18/glossary.html#GLOSSARY-DATA-DIRECTORY\" title=\"Data directory\"\u003edirectories\u003c/a\u003e in which the cluster data will live, generating the shared catalog tables (tables that belong to the whole cluster rather than to any particular database), and creating the \u003ccode class=\"literal\"\u003epostgres\u003c/code\u003e, \u003ccode class=\"literal\"\u003etemplate1\u003c/code\u003e, and \u003ccode class=\"literal\"\u003etemplate0\u003c/code\u003e databases. The \u003ccode class=\"literal\"\u003epostgres\u003c/code\u003e database is a default database meant for use by users, utilities and third party applications. \u003ccode class=\"literal\"\u003etemplate1\u003c/code\u003e and \u003ccode class=\"literal\"\u003etemplate0\u003c/code\u003e are meant as source databases to be copied by later \u003ccode class=\"command\"\u003eCREATE DATABASE\u003c/code\u003e commands. \u003ccode class=\"literal\"\u003etemplate0\u003c/code\u003e should never be modified, but you can add objects to \u003ccode class=\"literal\"\u003etemplate1\u003c/code\u003e, which by default will be copied into databases created later. See \u003ca class=\"xref\" href=\"/docs/18/manage-ag-templatedbs.html\" title=\"22.3. Template Databases\"\u003eSection 22.3\u003c/a\u003e for more details.\u003c/p\u003e\n\u003cp\u003eAlthough \u003ccode class=\"command\"\u003einitdb\u003c/code\u003e will attempt to create the specified data directory, it might not have permission if the parent directory of the desired data directory is root-owned. To initialize in such a setup, create an empty data directory as root, then use \u003ccode class=\"command\"\u003echown\u003c/code\u003e to assign ownership of that directory to the database user account, then \u003ccode class=\"command\"\u003esu\u003c/code\u003e to become the database user to run \u003ccode class=\"command\"\u003einitdb\u003c/code\u003e.\u003c/p\u003e\n\u003cp\u003e\u003ccode class=\"command\"\u003einitdb\u003c/code\u003e must be run as the user that will own the server process, because the server needs to have access to the files and directories that \u003ccode class=\"command\"\u003einitdb\u003c/code\u003e creates. Since the server cannot be run as root, you must not run \u003ccode class=\"command\"\u003einitdb\u003c/code\u003e as root either. (It will in fact refuse to do so.)\u003c/p\u003e\n\u003cp\u003eFor security reasons the new cluster created by \u003ccode class=\"command\"\u003einitdb\u003c/code\u003e will only be accessible by the cluster owner by default. The \u003ccode class=\"option\"\u003e--allow-group-access\u003c/code\u003e option allows any user in the same group as the cluster owner to read files in the cluster. This is useful for performing backups as a non-privileged user.\u003c/p\u003e\n\u003cp\u003e\u003ccode class=\"command\"\u003einitdb\u003c/code\u003e initializes the database cluster's default locale and character set encoding. These can also be set separately for each database when it is created. \u003ccode class=\"command\"\u003einitdb\u003c/code\u003e determines those settings for the template databases, which will serve as the default for all other databases.\u003c/p\u003e\n\u003cp\u003eBy default, \u003ccode class=\"command\"\u003einitdb\u003c/code\u003e uses the locale provider \u003ccode class=\"literal\"\u003elibc\u003c/code\u003e (see \u003ca class=\"xref\" href=\"/docs/18/locale.html#LOCALE-PROVIDERS\" title=\"23.1.4. Locale Providers\"\u003eSection 23.1.4\u003c/a\u003e). The \u003ccode class=\"literal\"\u003elibc\u003c/code\u003e locale provider takes the locale settings from the environment, and determines the encoding from the locale settings.\u003c/p\u003e\n\u003cp\u003eTo choose a different locale for the cluster, use the option \u003ccode class=\"option\"\u003e--locale\u003c/code\u003e. There are also individual options \u003ccode class=\"option\"\u003e--lc-*\u003c/code\u003e and \u003ccode class=\"option\"\u003e--icu-locale\u003c/code\u003e (see below) to set values for the individual locale categories. Note that inconsistent settings for different locale categories can give nonsensical results, so this should be used with care.\u003c/p\u003e\n\u003cp\u003eAlternatively, \u003ccode class=\"command\"\u003einitdb\u003c/code\u003e can use the ICU library to provide locale services by specifying \u003ccode class=\"literal\"\u003e--locale-provider=icu\u003c/code\u003e. The server must be built with ICU support. To choose the specific ICU locale ID to apply, use the option \u003ccode class=\"option\"\u003e--icu-locale\u003c/code\u003e. Note that for implementation reasons and to support legacy code, \u003ccode class=\"command\"\u003einitdb\u003c/code\u003e will still select and initialize libc locale settings when the ICU locale provider is used.\u003c/p\u003e\n\u003cp\u003eWhen \u003ccode class=\"command\"\u003einitdb\u003c/code\u003e runs, it will print out the locale settings it has chosen. If you have complex requirements or specified multiple options, it is advisable to check that the result matches what was intended.\u003c/p\u003e\n\u003cp\u003eMore details about locale settings can be found in \u003ca class=\"xref\" href=\"/docs/18/locale.html\" title=\"23.1. Locale Support\"\u003eSection 23.1\u003c/a\u003e.\u003c/p\u003e\n\u003cp\u003eTo alter the default encoding, use the \u003ccode class=\"option\"\u003e--encoding\u003c/code\u003e. More details can be found in \u003ca class=\"xref\" href=\"/docs/18/multibyte.html\" title=\"23.3. Character Set Support\"\u003eSection 23.3\u003c/a\u003e.\u003c/p\u003e\n\u003c/div\u003e\n\u003cdiv class=\"refsect1\" id=\"id-1.9.5.3.6\"\u003e\n\u003ch2\u003eOptions\u003c/h2\u003e\n\u003cdiv class=\"variablelist\"\u003e\n\u003cdl class=\"variablelist\"\u003e\n\u003cdt id=\"APP-INITDB-OPTION-AUTH\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-A \u003cem class=\"replaceable\"\u003e\u003ccode\u003eauthmethod\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--auth=\u003cem class=\"replaceable\"\u003e\u003ccode\u003eauthmethod\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eThis option specifies the default authentication method for local users used in \u003ccode class=\"filename\"\u003epg_hba.conf\u003c/code\u003e (\u003ccode class=\"literal\"\u003ehost\u003c/code\u003e and \u003ccode class=\"literal\"\u003elocal\u003c/code\u003e lines). See \u003ca class=\"xref\" href=\"/docs/18/auth-pg-hba-conf.html\" title=\"20.1. The pg_hba.conf File\"\u003eSection 20.1\u003c/a\u003e for an overview of valid values.\u003c/p\u003e\n\u003cp\u003e\u003ccode class=\"command\"\u003einitdb\u003c/code\u003e will prepopulate \u003ccode class=\"filename\"\u003epg_hba.conf\u003c/code\u003e entries using the specified authentication method for non-replication as well as replication connections.\u003c/p\u003e\n\u003cp\u003eDo not use \u003ccode class=\"literal\"\u003etrust\u003c/code\u003e unless you trust all local users on your system. \u003ccode class=\"literal\"\u003etrust\u003c/code\u003e is the default for ease of installation.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt id=\"APP-INITDB-OPTION-AUTH-HOST\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--auth-host=\u003cem class=\"replaceable\"\u003e\u003ccode\u003eauthmethod\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eThis option specifies the authentication method for local users via TCP/IP connections used in \u003ccode class=\"filename\"\u003epg_hba.conf\u003c/code\u003e (\u003ccode class=\"literal\"\u003ehost\u003c/code\u003e lines).\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt id=\"APP-INITDB-OPTION-AUTH-LOCAL\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--auth-local=\u003cem class=\"replaceable\"\u003e\u003ccode\u003eauthmethod\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eThis option specifies the authentication method for local users via Unix-domain socket connections used in \u003ccode class=\"filename\"\u003epg_hba.conf\u003c/code\u003e (\u003ccode class=\"literal\"\u003elocal\u003c/code\u003e lines).\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt id=\"APP-INITDB-OPTION-PGDATA\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-D \u003cem class=\"replaceable\"\u003e\u003ccode\u003edirectory\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--pgdata=\u003cem class=\"replaceable\"\u003e\u003ccode\u003edirectory\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eThis option specifies the directory where the database cluster should be stored. This is the only information required by \u003ccode class=\"command\"\u003einitdb\u003c/code\u003e, but you can avoid writing it by setting the \u003ccode class=\"envar\"\u003ePGDATA\u003c/code\u003e environment variable, which can be convenient since the database server (\u003ccode class=\"command\"\u003epostgres\u003c/code\u003e) can find the data directory later by the same variable.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt id=\"APP-INITDB-OPTION-ENCODING\"\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\u003eSelects the encoding of the template databases. This will also be the default encoding of any database you create later, unless you override it then. 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\u003cp\u003eBy default, the template database encoding is derived from the locale. If \u003ca class=\"xref\" href=\"/docs/18/app-initdb.html#APP-INITDB-OPTION-NO-LOCALE\"\u003e\u003ccode class=\"option\"\u003e--no-locale\u003c/code\u003e\u003c/a\u003e is specified (or equivalently, if the locale is \u003ccode class=\"literal\"\u003eC\u003c/code\u003e or \u003ccode class=\"literal\"\u003ePOSIX\u003c/code\u003e), then the default is \u003ccode class=\"literal\"\u003eUTF8\u003c/code\u003e for the ICU provider and \u003ccode class=\"literal\"\u003eSQL_ASCII\u003c/code\u003e for the \u003ccode class=\"literal\"\u003elibc\u003c/code\u003e provider.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt id=\"APP-INITDB-ALLOW-GROUP-ACCESS\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-g\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--allow-group-access\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eAllows users in the same group as the cluster owner to read all cluster files created by \u003ccode class=\"command\"\u003einitdb\u003c/code\u003e. This option is ignored on \u003cspan class=\"productname\"\u003eWindows\u003c/span\u003e as it does not support POSIX-style group permissions.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt id=\"APP-INITDB-ICU-LOCALE\"\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 when the ICU 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 id=\"APP-INITDB-ICU-RULES\"\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. This is supported for ICU only.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt id=\"APP-INITDB-DATA-CHECKSUMS\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-k\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--data-checksums\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eUse checksums on data pages to help detect corruption by the I/O system that would otherwise be silent. This is enabled by default; use \u003ca class=\"xref\" href=\"/docs/18/app-initdb.html#APP-INITDB-NO-DATA-CHECKSUMS\"\u003e\u003ccode class=\"option\"\u003e--no-data-checksums\u003c/code\u003e\u003c/a\u003e to disable checksums.\u003c/p\u003e\n\u003cp\u003eEnabling checksums might incur a small performance penalty. If set, checksums are calculated for all objects, in all databases. All checksum failures will be reported in the \u003ca class=\"link\" href=\"/docs/18/monitoring-stats.html#MONITORING-PG-STAT-DATABASE-VIEW\" title=\"27.2.17. pg_stat_database\"\u003e\u003ccode class=\"structname\"\u003epg_stat_database\u003c/code\u003e\u003c/a\u003e view. See \u003ca class=\"xref\" href=\"/docs/18/checksums.html\" title=\"28.2. Data Checksums\"\u003eSection 28.2\u003c/a\u003e for details.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt id=\"APP-INITDB-OPTION-LOCALE\"\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\u003eSets the default locale for the database cluster. If this option is not specified, the locale is inherited from the environment that \u003ccode class=\"command\"\u003einitdb\u003c/code\u003e runs in. 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\u003cp\u003eIf \u003ccode class=\"option\"\u003e--locale-provider\u003c/code\u003e is \u003ccode class=\"literal\"\u003ebuiltin\u003c/code\u003e, \u003ccode class=\"option\"\u003e--locale\u003c/code\u003e or \u003ccode class=\"option\"\u003e--builtin-locale\u003c/code\u003e must be specified and set to \u003ccode class=\"literal\"\u003eC\u003c/code\u003e, \u003ccode class=\"literal\"\u003eC.UTF-8\u003c/code\u003e or \u003ccode class=\"literal\"\u003ePG_UNICODE_FAST\u003c/code\u003e.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt id=\"APP-INITDB-OPTION-LC-COLLATE\"\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\u003cbr\u003e\u003c/span\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\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--lc-messages=\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--lc-monetary=\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--lc-numeric=\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--lc-time=\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\u003eLike \u003ccode class=\"option\"\u003e--locale\u003c/code\u003e, but only sets the locale in the specified category.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt id=\"APP-INITDB-OPTION-NO-LOCALE\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--no-locale\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eEquivalent to \u003ccode class=\"option\"\u003e--locale=C\u003c/code\u003e.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt id=\"APP-INITDB-BUILTIN-LOCALE\"\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 id=\"APP-INITDB-OPTION-LOCALE-PROVIDER\"\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\u003eThis option sets the locale provider for databases created in the new cluster. It can be overridden in the \u003ccode class=\"command\"\u003eCREATE DATABASE\u003c/code\u003e command when new databases are subsequently created. The default is \u003ccode class=\"literal\"\u003elibc\u003c/code\u003e (see \u003ca class=\"xref\" href=\"/docs/18/locale.html#LOCALE-PROVIDERS\" title=\"23.1.4. Locale Providers\"\u003eSection 23.1.4\u003c/a\u003e).\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt id=\"APP-INITDB-NO-DATA-CHECKSUMS\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--no-data-checksums\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eDo not enable data checksums.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt id=\"APP-INITDB-OPTION-PWFILE\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--pwfile=\u003cem class=\"replaceable\"\u003e\u003ccode\u003efilename\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eMakes \u003ccode class=\"command\"\u003einitdb\u003c/code\u003e read the bootstrap superuser's password from a file. The first line of the file is taken as the password.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt id=\"APP-INITDB-OPTION-TEXT-SEARCH-CONFIG\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-T \u003cem class=\"replaceable\"\u003e\u003ccode\u003econfig\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--text-search-config=\u003cem class=\"replaceable\"\u003e\u003ccode\u003econfig\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eSets the default text search configuration. See \u003ca class=\"xref\" href=\"/docs/18/runtime-config-client.html#GUC-DEFAULT-TEXT-SEARCH-CONFIG\"\u003edefault_text_search_config\u003c/a\u003e for further information.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt id=\"APP-INITDB-OPTION-USERNAME\"\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\u003eSets the user name of the \u003ca class=\"glossterm\" href=\"/docs/18/glossary.html#GLOSSARY-BOOTSTRAP-SUPERUSER\"\u003e\u003c/a\u003e\u003ca class=\"glossterm\" href=\"/docs/18/glossary.html#GLOSSARY-BOOTSTRAP-SUPERUSER\" title=\"Bootstrap superuser\"\u003ebootstrap superuser\u003c/a\u003e. This defaults to the name of the operating-system user running \u003ccode class=\"command\"\u003einitdb\u003c/code\u003e.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt id=\"APP-INITDB-OPTION-PWPROMPT\"\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--pwprompt\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eMakes \u003ccode class=\"command\"\u003einitdb\u003c/code\u003e prompt for a password to give the bootstrap superuser. If you don't plan on using password authentication, this is not important. Otherwise you won't be able to use password authentication until you have a password set up.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt id=\"APP-INITDB-OPTION-WALDIR\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-X \u003cem class=\"replaceable\"\u003e\u003ccode\u003edirectory\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--waldir=\u003cem class=\"replaceable\"\u003e\u003ccode\u003edirectory\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eThis option specifies the directory where the write-ahead log should be stored.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt id=\"APP-INITDB-OPTION-WAL-SEGSIZE\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--wal-segsize=\u003cem class=\"replaceable\"\u003e\u003ccode\u003esize\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eSet the \u003cem class=\"firstterm\"\u003eWAL segment size\u003c/em\u003e, in megabytes. This is the size of each individual file in the WAL log. The default size is 16 megabytes. The value must be a power of 2 between 1 and 1024 (megabytes). This option can only be set during initialization, and cannot be changed later.\u003c/p\u003e\n\u003cp\u003eIt may be useful to adjust this size to control the granularity of WAL log shipping or archiving. Also, in databases with a high volume of WAL, the sheer number of WAL files per directory can become a performance and management problem. Increasing the WAL file size will reduce the number of WAL files.\u003c/p\u003e\n\u003c/dd\u003e\n\u003c/dl\u003e\n\u003c/div\u003e\n\u003cp\u003eOther, less commonly used, options are also available:\u003c/p\u003e\n\u003cdiv class=\"variablelist\"\u003e\n\u003cdl class=\"variablelist\"\u003e\n\u003cdt id=\"APP-INITDB-OPTION-SET\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-c \u003cem class=\"replaceable\"\u003e\u003ccode\u003ename\u003c/code\u003e\u003c/em\u003e=\u003cem class=\"replaceable\"\u003e\u003ccode\u003evalue\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--set \u003cem class=\"replaceable\"\u003e\u003ccode\u003ename\u003c/code\u003e\u003c/em\u003e=\u003cem class=\"replaceable\"\u003e\u003ccode\u003evalue\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eForcibly set the server parameter \u003cem class=\"replaceable\"\u003e\u003ccode\u003ename\u003c/code\u003e\u003c/em\u003e to \u003cem class=\"replaceable\"\u003e\u003ccode\u003evalue\u003c/code\u003e\u003c/em\u003e during \u003ccode class=\"command\"\u003einitdb\u003c/code\u003e, and also install that setting in the generated \u003ccode class=\"filename\"\u003epostgresql.conf\u003c/code\u003e file, so that it will apply during future server runs. This option can be given more than once to set several parameters. It is primarily useful when the environment is such that the server will not start at all using the default parameters.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt id=\"APP-INITDB-OPTION-DEBUG\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-d\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--debug\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003ePrint debugging output from the bootstrap backend and a few other messages of lesser interest for the general public. The bootstrap backend is the program \u003ccode class=\"command\"\u003einitdb\u003c/code\u003e uses to create the catalog tables. This option generates a tremendous amount of extremely boring output.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt id=\"APP-INITDB-OPTION-DISCARD-CACHES\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--discard-caches\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eRun the bootstrap backend with the \u003ccode class=\"literal\"\u003edebug_discard_caches=1\u003c/code\u003e option. This takes a very long time and is only of use for deep debugging.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt id=\"APP-INITDB-OPTION-L\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-L \u003cem class=\"replaceable\"\u003e\u003ccode\u003edirectory\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eSpecifies where \u003ccode class=\"command\"\u003einitdb\u003c/code\u003e should find its input files to initialize the database cluster. This is normally not necessary. You will be told if you need to specify their location explicitly.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt id=\"APP-INITDB-OPTION-NO-CLEAN\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-n\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--no-clean\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eBy default, when \u003ccode class=\"command\"\u003einitdb\u003c/code\u003e determines that an error prevented it from completely creating the database cluster, it removes any files it might have created before discovering that it cannot finish the job. This option inhibits tidying-up and is thus useful for debugging.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt id=\"APP-INITDB-OPTION-NO-SYNC\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-N\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--no-sync\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eBy default, \u003ccode class=\"command\"\u003einitdb\u003c/code\u003e will wait for all files to be written safely to disk. This option causes \u003ccode class=\"command\"\u003einitdb\u003c/code\u003e to return without waiting, which is faster, but means that a subsequent operating system crash can leave the data directory corrupt. Generally, this option is useful for testing, but should not be used when creating a production installation.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt id=\"APP-INITDB-OPTION-NO-SYNC-DATA-FILES\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--no-sync-data-files\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eBy default, \u003ccode class=\"command\"\u003einitdb\u003c/code\u003e safely writes all database files to disk. This option instructs \u003ccode class=\"command\"\u003einitdb\u003c/code\u003e to skip synchronizing all files in the individual database directories, the database directories themselves, and the tablespace directories, i.e., everything in the \u003ccode class=\"filename\"\u003ebase\u003c/code\u003e subdirectory and any other tablespace directories. Other files, such as those in \u003ccode class=\"literal\"\u003epg_wal\u003c/code\u003e and \u003ccode class=\"literal\"\u003epg_xact\u003c/code\u003e, will still be synchronized unless the \u003ccode class=\"option\"\u003e--no-sync\u003c/code\u003e option is also specified.\u003c/p\u003e\n\u003cp\u003eNote that if \u003ccode class=\"option\"\u003e--no-sync-data-files\u003c/code\u003e is used in conjunction with \u003ccode class=\"option\"\u003e--sync-method=syncfs\u003c/code\u003e, some or all of the aforementioned files and directories will be synchronized because \u003ccode class=\"literal\"\u003esyncfs\u003c/code\u003e processes entire file systems.\u003c/p\u003e\n\u003cp\u003eThis option is primarily intended for internal use by tools that separately ensure the skipped files are synchronized to disk.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt id=\"APP-INITDB-OPTION-NO-INSTRUCTIONS\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--no-instructions\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eBy default, \u003ccode class=\"command\"\u003einitdb\u003c/code\u003e will write instructions for how to start the cluster at the end of its output. This option causes those instructions to be left out. This is primarily intended for use by tools that wrap \u003ccode class=\"command\"\u003einitdb\u003c/code\u003e in platform-specific behavior, where those instructions are likely to be incorrect.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt id=\"APP-INITDB-OPTION-SHOW\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-s\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--show\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eShow internal settings and exit, without doing anything else. This can be used to debug the \u003cspan class=\"application\"\u003einitdb\u003c/span\u003e installation.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt id=\"APP-INITDB-OPTION-SYNC-METHOD\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--sync-method=\u003cem class=\"replaceable\"\u003e\u003ccode\u003emethod\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eWhen set to \u003ccode class=\"literal\"\u003efsync\u003c/code\u003e, which is the default, \u003ccode class=\"command\"\u003einitdb\u003c/code\u003e will recursively open and synchronize all files in the data directory. The search for files will follow symbolic links for the WAL directory and each configured tablespace.\u003c/p\u003e\n\u003cp\u003eOn Linux, \u003ccode class=\"literal\"\u003esyncfs\u003c/code\u003e may be used instead to ask the operating system to synchronize the whole file systems that contain the data directory, the WAL files, and each tablespace. See \u003ca class=\"xref\" href=\"/docs/18/runtime-config-error-handling.html#GUC-RECOVERY-INIT-SYNC-METHOD\"\u003erecovery_init_sync_method\u003c/a\u003e for information about the caveats to be aware of when using \u003ccode class=\"literal\"\u003esyncfs\u003c/code\u003e.\u003c/p\u003e\n\u003cp\u003eThis option has no effect when \u003ccode class=\"option\"\u003e--no-sync\u003c/code\u003e is used.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt id=\"APP-INITDB-OPTION-SYNC-ONLY\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-S\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--sync-only\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eSafely write all database files to disk and exit. This does not perform any of the normal \u003cspan class=\"application\"\u003einitdb\u003c/span\u003e operations. Generally, this option is useful for ensuring reliable recovery after changing \u003ca class=\"xref\" href=\"/docs/18/runtime-config-wal.html#GUC-FSYNC\"\u003efsync\u003c/a\u003e from \u003ccode class=\"literal\"\u003eoff\u003c/code\u003e to \u003ccode class=\"literal\"\u003eon\u003c/code\u003e.\u003c/p\u003e\n\u003c/dd\u003e\n\u003c/dl\u003e\n\u003c/div\u003e\n\u003cp\u003eOther options:\u003c/p\u003e\n\u003cdiv class=\"variablelist\"\u003e\n\u003cdl class=\"variablelist\"\u003e\n\u003cdt id=\"APP-INITDB-OPTION-VERSION\"\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\"\u003einitdb\u003c/span\u003e version and exit.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt id=\"APP-INITDB-OPTION-HELP\"\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\"\u003einitdb\u003c/span\u003e command line arguments, and exit.\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.5.3.7\"\u003e\n\u003ch2\u003eEnvironment\u003c/h2\u003e\n\u003cdiv class=\"variablelist\"\u003e\n\u003cdl class=\"variablelist\"\u003e\n\u003cdt id=\"APP-INITDB-ENVIRONMENT-PGDATA\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"envar\"\u003ePGDATA\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eSpecifies the directory where the database cluster is to be stored; can be overridden using the \u003ccode class=\"option\"\u003e-D\u003c/code\u003e option.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt id=\"APP-INITDB-ENVIRONMENT-PG-COLOR\"\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\u003cdt id=\"APP-INITDB-ENVIRONMENT-TZ\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"envar\"\u003eTZ\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eSpecifies the default time zone of the created database cluster. The value should be a full time zone name (see \u003ca class=\"xref\" href=\"/docs/18/datatype-datetime.html#DATATYPE-TIMEZONES\" title=\"8.5.3. Time Zones\"\u003eSection 8.5.3\u003c/a\u003e).\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.5.3.8\"\u003e\n\u003ch2\u003eNotes\u003c/h2\u003e\n\u003cp\u003e\u003ccode class=\"command\"\u003einitdb\u003c/code\u003e can also be invoked via \u003ccode class=\"command\"\u003epg_ctl initdb\u003c/code\u003e.\u003c/p\u003e\n\u003c/div\u003e\n\u003cdiv class=\"refsect1\" id=\"id-1.9.5.3.9\"\u003e\n\u003ch2\u003eSee Also\u003c/h2\u003e\u003cspan class=\"simplelist\"\u003e\u003ca class=\"xref\" href=\"/docs/18/app-pg-ctl.html\" title=\"pg_ctl\"\u003e\u003cspan class=\"refentrytitle\"\u003e\u003cspan class=\"application\"\u003epg_ctl\u003c/span\u003e\u003c/span\u003e\u003c/a\u003e, \u003ca class=\"xref\" href=\"/docs/18/app-postgres.html\" title=\"postgres\"\u003e\u003cspan class=\"refentrytitle\"\u003e\u003cspan class=\"application\"\u003epostgres\u003c/span\u003e\u003c/span\u003e\u003c/a\u003e, \u003ca class=\"xref\" href=\"/docs/18/auth-pg-hba-conf.html\" title=\"20.1. The pg_hba.conf File\"\u003eSection 20.1\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":"-A authmethod --auth= authmethod","url":"/docs/18/app-initdb.html#APP-INITDB-OPTION-AUTH"},"summary":"This option specifies the default authentication method for local users used in pg_hba.conf ( host and local lines). See Section 20.1 for an overview of valid values."},{"signature":{"text":"--auth-host= authmethod","url":"/docs/18/app-initdb.html#APP-INITDB-OPTION-AUTH-HOST"},"summary":"This option specifies the authentication method for local users via TCP/IP connections used in pg_hba.conf ( host lines)."},{"signature":{"text":"--auth-local= authmethod","url":"/docs/18/app-initdb.html#APP-INITDB-OPTION-AUTH-LOCAL"},"summary":"This option specifies the authentication method for local users via Unix-domain socket connections used in pg_hba.conf ( local lines)."},{"signature":{"text":"-D directory --pgdata= directory","url":"/docs/18/app-initdb.html#APP-INITDB-OPTION-PGDATA"},"summary":"This option specifies the directory where the database cluster should be stored. This is the only information required by initdb , but you can avoid writing it by setting the PGDATA environment variable, which can be convenient since the database server ( postgres ) can find the data directory later by the same variable."},{"signature":{"text":"-E encoding --encoding= encoding","url":"/docs/18/app-initdb.html#APP-INITDB-OPTION-ENCODING"},"summary":"Selects the encoding of the template databases. This will also be the default encoding of any database you create later, unless you override it then. The character sets supported by the PostgreSQL server are described in Section 23.3.1 ."},{"signature":{"text":"-g --allow-group-access","url":"/docs/18/app-initdb.html#APP-INITDB-ALLOW-GROUP-ACCESS"},"summary":"Allows users in the same group as the cluster owner to read all cluster files created by initdb . This option is ignored on Windows as it does not support POSIX -style group permissions."},{"signature":{"text":"--icu-locale= locale","url":"/docs/18/app-initdb.html#APP-INITDB-ICU-LOCALE"},"summary":"Specifies the ICU locale when the ICU provider is used. Locale support is described in Section 23.1 ."},{"signature":{"text":"--icu-rules= rules","url":"/docs/18/app-initdb.html#APP-INITDB-ICU-RULES"},"summary":"Specifies additional collation rules to customize the behavior of the default collation. This is supported for ICU only."},{"signature":{"text":"-k --data-checksums","url":"/docs/18/app-initdb.html#APP-INITDB-DATA-CHECKSUMS"},"summary":"Use checksums on data pages to help detect corruption by the I/O system that would otherwise be silent. This is enabled by default; use --no-data-checksums to disable checksums."},{"signature":{"text":"--locale= locale","url":"/docs/18/app-initdb.html#APP-INITDB-OPTION-LOCALE"},"summary":"Sets the default locale for the database cluster. If this option is not specified, the locale is inherited from the environment that initdb runs in. Locale support is described in Section 23.1 ."},{"signature":{"text":"--lc-collate= locale --lc-ctype= locale --lc-messages= locale --lc-monetary= locale --lc-numeric= locale --lc-time= locale","url":"/docs/18/app-initdb.html#APP-INITDB-OPTION-LC-COLLATE"},"summary":"Like --locale , but only sets the locale in the specified category."},{"signature":{"text":"--no-locale","url":"/docs/18/app-initdb.html#APP-INITDB-OPTION-NO-LOCALE"},"summary":"Equivalent to --locale=C ."},{"signature":{"text":"--builtin-locale= locale","url":"/docs/18/app-initdb.html#APP-INITDB-BUILTIN-LOCALE"},"summary":"Specifies the locale name when the builtin provider is used. Locale support is described in Section 23.1 ."},{"signature":{"text":"--locale-provider={ builtin | libc | icu }","url":"/docs/18/app-initdb.html#APP-INITDB-OPTION-LOCALE-PROVIDER"},"summary":"This option sets the locale provider for databases created in the new cluster. It can be overridden in the CREATE DATABASE command when new databases are subsequently created. The default is libc (see Section 23.1.4 )."},{"signature":{"text":"--no-data-checksums","url":"/docs/18/app-initdb.html#APP-INITDB-NO-DATA-CHECKSUMS"},"summary":"Do not enable data checksums."},{"signature":{"text":"--pwfile= filename","url":"/docs/18/app-initdb.html#APP-INITDB-OPTION-PWFILE"},"summary":"Makes initdb read the bootstrap superuser's password from a file. The first line of the file is taken as the password."},{"signature":{"text":"-T config --text-search-config= config","url":"/docs/18/app-initdb.html#APP-INITDB-OPTION-TEXT-SEARCH-CONFIG"},"summary":"Sets the default text search configuration. See default_text_search_config for further information."},{"signature":{"text":"-U username --username= username","url":"/docs/18/app-initdb.html#APP-INITDB-OPTION-USERNAME"},"summary":"Sets the user name of the bootstrap superuser . This defaults to the name of the operating-system user running initdb ."},{"signature":{"text":"-W --pwprompt","url":"/docs/18/app-initdb.html#APP-INITDB-OPTION-PWPROMPT"},"summary":"Makes initdb prompt for a password to give the bootstrap superuser. If you don't plan on using password authentication, this is not important. Otherwise you won't be able to use password authentication until you have a password set up."},{"signature":{"text":"-X directory --waldir= directory","url":"/docs/18/app-initdb.html#APP-INITDB-OPTION-WALDIR"},"summary":"This option specifies the directory where the write-ahead log should be stored."},{"signature":{"text":"--wal-segsize= size","url":"/docs/18/app-initdb.html#APP-INITDB-OPTION-WAL-SEGSIZE"},"summary":"Set the WAL segment size , in megabytes. This is the size of each individual file in the WAL log. The default size is 16 megabytes. The value must be a power of 2 between 1 and 1024 (megabytes). This option can only be set during initialization, and cannot be changed later."},{"signature":{"text":"-c name = value --set name = value","url":"/docs/18/app-initdb.html#APP-INITDB-OPTION-SET"},"summary":"Forcibly set the server parameter name to value during initdb , and also install that setting in the generated postgresql.conf file, so that it will apply during future server runs. This option can be given more than once to set several parameters. It is primarily useful when the environment is such that the server will not start at all using the default parameters."},{"signature":{"text":"-d --debug","url":"/docs/18/app-initdb.html#APP-INITDB-OPTION-DEBUG"},"summary":"Print debugging output from the bootstrap backend and a few other messages of lesser interest for the general public. The bootstrap backend is the program initdb uses to create the catalog tables. This option generates a tremendous amount of extremely boring output."},{"signature":{"text":"--discard-caches","url":"/docs/18/app-initdb.html#APP-INITDB-OPTION-DISCARD-CACHES"},"summary":"Run the bootstrap backend with the debug_discard_caches=1 option. This takes a very long time and is only of use for deep debugging."},{"signature":{"text":"-L directory","url":"/docs/18/app-initdb.html#APP-INITDB-OPTION-L"},"summary":"Specifies where initdb should find its input files to initialize the database cluster. This is normally not necessary. You will be told if you need to specify their location explicitly."},{"signature":{"text":"-n --no-clean","url":"/docs/18/app-initdb.html#APP-INITDB-OPTION-NO-CLEAN"},"summary":"By default, when initdb determines that an error prevented it from completely creating the database cluster, it removes any files it might have created before discovering that it cannot finish the job. This option inhibits tidying-up and is thus useful for debugging."},{"signature":{"text":"-N --no-sync","url":"/docs/18/app-initdb.html#APP-INITDB-OPTION-NO-SYNC"},"summary":"By default, initdb will wait for all files to be written safely to disk. This option causes initdb to return without waiting, which is faster, but means that a subsequent operating system crash can leave the data directory corrupt. Generally, this option is useful for testing, but should not be used when creating a production installation."},{"signature":{"text":"--no-sync-data-files","url":"/docs/18/app-initdb.html#APP-INITDB-OPTION-NO-SYNC-DATA-FILES"},"summary":"By default, initdb safely writes all database files to disk. This option instructs initdb to skip synchronizing all files in the individual database directories, the database directories themselves, and the tablespace directories, i.e., everything in the base subdirectory and any other tablespace directories. Other files, such as those in pg_wal and pg_xact , will still be synchronized unless the --no-sync option is also specified."},{"signature":{"text":"--no-instructions","url":"/docs/18/app-initdb.html#APP-INITDB-OPTION-NO-INSTRUCTIONS"},"summary":"By default, initdb will write instructions for how to start the cluster at the end of its output. This option causes those instructions to be left out. This is primarily intended for use by tools that wrap initdb in platform-specific behavior, where those instructions are likely to be incorrect."},{"signature":{"text":"-s --show","url":"/docs/18/app-initdb.html#APP-INITDB-OPTION-SHOW"},"summary":"Show internal settings and exit, without doing anything else. This can be used to debug the initdb installation."},{"signature":{"text":"--sync-method= method","url":"/docs/18/app-initdb.html#APP-INITDB-OPTION-SYNC-METHOD"},"summary":"When set to fsync , which is the default, initdb will recursively open and synchronize all files in the data directory. The search for files will follow symbolic links for the WAL directory and each configured tablespace."},{"signature":{"text":"-S --sync-only","url":"/docs/18/app-initdb.html#APP-INITDB-OPTION-SYNC-ONLY"},"summary":"Safely write all database files to disk and exit. This does not perform any of the normal initdb operations. Generally, this option is useful for ensuring reliable recovery after changing fsync from off to on ."},{"signature":{"text":"-V --version","url":"/docs/18/app-initdb.html#APP-INITDB-OPTION-VERSION"},"summary":"Print the initdb version and exit."},{"signature":{"text":"-? --help","url":"/docs/18/app-initdb.html#APP-INITDB-OPTION-HELP"},"summary":"Show help about initdb command line arguments, and exit."}],"title":"Documented options"},{"columns":[{"key":"name","label":"Variable"},{"key":"description","label":"Meaning"}],"key":"environment","rows":[{"description":"Specifies the directory where the database cluster is to be stored; can be overridden using the -D option.","name":"PGDATA"},{"description":"Specifies whether to use color in diagnostic messages. Possible values are always , auto and never .","name":"PG_COLOR"},{"description":"Specifies the default time zone of the created database cluster. The value should be a full time zone name (see Section 8.5.3 ).","name":"TZ"}],"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}
