{"kind": "tool", "major": "18", "item": {"slug": "initdb", "name": "initdb", "name_zh": "", "category": "Server applications", "summary": "initdb \u2014 create a new PostgreSQL database cluster", "aliases": ["initdb"], "content_hash": "98b6ac7afe6324f4ff3d166e21ac8a6a02c2355ffffbc310333c7955642f8a84", "versions": {"10": {"facts": [{"label": "Documented executable", "value": "initdb"}, {"label": "Executable version", "value": "10.23"}, {"label": "Reference inventory", "value": "Server applications"}, {"label": "Option definition groups", "value": "21"}], "tables": [{"key": "options", "rows": [{"summary": "This option specifies the default authentication method for local users used in pg_hba.conf ( host and local lines). initdb will prepopulate pg_hba.conf entries using the specified authentication method for non-replication as well as replication connections.", "signature": {"url": "/docs/10/app-initdb.html", "text": "-A authmethod --auth= authmethod"}}, {"summary": "This option specifies the authentication method for local users via TCP/IP connections used in pg_hba.conf ( host lines).", "signature": {"url": "/docs/10/app-initdb.html", "text": "--auth-host= authmethod"}}, {"summary": "This option specifies the authentication method for local users via Unix-domain socket connections used in pg_hba.conf ( local lines).", "signature": {"url": "/docs/10/app-initdb.html", "text": "--auth-local= authmethod"}}, {"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 database directory later by the same variable.", "signature": {"url": "/docs/10/app-initdb.html", "text": "-D directory --pgdata= directory"}}, {"summary": "Selects the encoding of the template database. This will also be the default encoding of any database you create later, unless you override it there. The default is derived from the locale, or SQL_ASCII if that does not work. The character sets supported by the PostgreSQL server are described in Section 23.3.1 .", "signature": {"url": "/docs/10/app-initdb.html", "text": "-E encoding --encoding= encoding"}}, {"summary": "Use checksums on data pages to help detect corruption by the I/O system that would otherwise be silent. Enabling checksums may incur a noticeable performance penalty. This option can only be set during initialization, and cannot be changed later. If set, checksums are calculated for all objects, in all databases.", "signature": {"url": "/docs/10/app-initdb.html#APP-INITDB-DATA-CHECKSUMS", "text": "-k --data-checksums"}}, {"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": {"url": "/docs/10/app-initdb.html", "text": "--locale= locale"}}, {"summary": "Like --locale , but only sets the locale in the specified category.", "signature": {"url": "/docs/10/app-initdb.html", "text": "--lc-collate= locale --lc-ctype= locale --lc-messages= locale --lc-monetary= locale --lc-numeric= locale --lc-time= locale"}}, {"summary": "Equivalent to --locale=C .", "signature": {"url": "/docs/10/app-initdb.html", "text": "--no-locale"}}, {"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": {"url": "/docs/10/app-initdb.html", "text": "-N --no-sync"}}, {"summary": "Makes initdb read the database superuser's password from a file. The first line of the file is taken as the password.", "signature": {"url": "/docs/10/app-initdb.html", "text": "--pwfile= filename"}}, {"summary": "Safely write all database files to disk and exit. This does not perform any of the normal initdb operations.", "signature": {"url": "/docs/10/app-initdb.html", "text": "-S --sync-only"}}, {"summary": "Sets the default text search configuration. See default_text_search_config for further information.", "signature": {"url": "/docs/10/app-initdb.html", "text": "-T config --text-search-config= config"}}, {"summary": "Selects the user name of the database superuser. This defaults to the name of the effective user running initdb . It is really not important what the superuser's name is, but one might choose to keep the customary name postgres , even if the operating system user's name is different.", "signature": {"url": "/docs/10/app-initdb.html", "text": "-U username --username= username"}}, {"summary": "Makes initdb prompt for a password to give the database 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": {"url": "/docs/10/app-initdb.html", "text": "-W --pwprompt"}}, {"summary": "This option specifies the directory where the write-ahead log should be stored.", "signature": {"url": "/docs/10/app-initdb.html", "text": "-X directory --waldir= directory"}}, {"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": {"url": "/docs/10/app-initdb.html", "text": "-d --debug"}}, {"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": {"url": "/docs/10/app-initdb.html", "text": "-L directory"}}, {"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": {"url": "/docs/10/app-initdb.html", "text": "-n --no-clean"}}, {"summary": "Print the initdb version and exit.", "signature": {"url": "/docs/10/app-initdb.html", "text": "-V --version"}}, {"summary": "Show help about initdb command line arguments, and exit.", "signature": {"url": "/docs/10/app-initdb.html", "text": "-? --help"}}], "title": "Documented options", "columns": [{"key": "signature", "label": "Option and arguments"}, {"key": "summary", "label": "Description"}]}, {"key": "environment", "rows": [{"name": "PGDATA", "description": "Specifies the directory where the database cluster is to be stored; can be overridden using the -D option."}, {"name": "TZ", "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 )."}], "title": "Environment variables", "columns": [{"key": "name", "label": "Variable"}, {"key": "description", "label": "Meaning"}]}], "options": [{"names": ["-A authmethod", "--auth= authmethod"], "summary": "This option specifies the default authentication method for local users used in pg_hba.conf ( host and local lines). initdb will prepopulate pg_hba.conf entries using the specified authentication method for non-replication as well as replication connections.", "signature": "-A authmethod --auth= authmethod", "source_url": "/docs/10/app-initdb.html", "description": "This option specifies the default authentication method for local users used in pg_hba.conf ( host and local lines). 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": ["--auth-host= authmethod"], "summary": "This option specifies the authentication method for local users via TCP/IP connections used in pg_hba.conf ( host lines).", "signature": "--auth-host= authmethod", "source_url": "/docs/10/app-initdb.html", "description": "This option specifies the authentication method for local users via TCP/IP connections used in pg_hba.conf ( host lines)."}, {"names": ["--auth-local= authmethod"], "summary": "This option specifies the authentication method for local users via Unix-domain socket connections used in pg_hba.conf ( local lines).", "signature": "--auth-local= authmethod", "source_url": "/docs/10/app-initdb.html", "description": "This option specifies the authentication method for local users via Unix-domain socket connections used in pg_hba.conf ( local lines)."}, {"names": ["-D directory", "--pgdata= directory"], "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 database directory later by the same variable.", "signature": "-D directory --pgdata= directory", "source_url": "/docs/10/app-initdb.html", "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 database directory later by the same variable."}, {"names": ["-E encoding", "--encoding= encoding"], "summary": "Selects the encoding of the template database. This will also be the default encoding of any database you create later, unless you override it there. The default is derived from the locale, or SQL_ASCII if that does not work. The character sets supported by the PostgreSQL server are described in Section 23.3.1 .", "signature": "-E encoding --encoding= encoding", "source_url": "/docs/10/app-initdb.html", "description": "Selects the encoding of the template database. This will also be the default encoding of any database you create later, unless you override it there. The default is derived from the locale, or SQL_ASCII if that does not work. The character sets supported by the PostgreSQL server are described in Section 23.3.1 ."}, {"names": ["-k", "--data-checksums"], "summary": "Use checksums on data pages to help detect corruption by the I/O system that would otherwise be silent. Enabling checksums may incur a noticeable performance penalty. This option can only be set during initialization, and cannot be changed later. If set, checksums are calculated for all objects, in all databases.", "signature": "-k --data-checksums", "source_url": "/docs/10/app-initdb.html#APP-INITDB-DATA-CHECKSUMS", "description": "Use checksums on data pages to help detect corruption by the I/O system that would otherwise be silent. Enabling checksums may incur a noticeable performance penalty. This option can only be set during initialization, and cannot be changed later. If set, checksums are calculated for all objects, in all databases."}, {"names": ["--locale= 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": "--locale= locale", "source_url": "/docs/10/app-initdb.html", "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 ."}, {"names": ["--lc-collate= locale", "--lc-ctype= locale", "--lc-messages= locale", "--lc-monetary= locale", "--lc-numeric= locale", "--lc-time= locale"], "summary": "Like --locale , but only sets the locale in the specified category.", "signature": "--lc-collate= locale --lc-ctype= locale --lc-messages= locale --lc-monetary= locale --lc-numeric= locale --lc-time= locale", "source_url": "/docs/10/app-initdb.html", "description": "Like --locale , but only sets the locale in the specified category."}, {"names": ["--no-locale"], "summary": "Equivalent to --locale=C .", "signature": "--no-locale", "source_url": "/docs/10/app-initdb.html", "description": "Equivalent to --locale=C ."}, {"names": ["-N", "--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": "-N --no-sync", "source_url": "/docs/10/app-initdb.html", "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": ["--pwfile= filename"], "summary": "Makes initdb read the database superuser's password from a file. The first line of the file is taken as the password.", "signature": "--pwfile= filename", "source_url": "/docs/10/app-initdb.html", "description": "Makes initdb read the database superuser's password from a file. The first line of the file is taken as the password."}, {"names": ["-S", "--sync-only"], "summary": "Safely write all database files to disk and exit. This does not perform any of the normal initdb operations.", "signature": "-S --sync-only", "source_url": "/docs/10/app-initdb.html", "description": "Safely write all database files to disk and exit. This does not perform any of the normal initdb operations."}, {"names": ["-T config", "--text-search-config= config"], "summary": "Sets the default text search configuration. See default_text_search_config for further information.", "signature": "-T config --text-search-config= config", "source_url": "/docs/10/app-initdb.html", "description": "Sets the default text search configuration. See default_text_search_config for further information."}, {"names": ["-U username", "--username= username"], "summary": "Selects the user name of the database superuser. This defaults to the name of the effective user running initdb . It is really not important what the superuser's name is, but one might choose to keep the customary name postgres , even if the operating system user's name is different.", "signature": "-U username --username= username", "source_url": "/docs/10/app-initdb.html", "description": "Selects the user name of the database superuser. This defaults to the name of the effective user running initdb . It is really not important what the superuser's name is, but one might choose to keep the customary name postgres , even if the operating system user's name is different."}, {"names": ["-W", "--pwprompt"], "summary": "Makes initdb prompt for a password to give the database 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": "-W --pwprompt", "source_url": "/docs/10/app-initdb.html", "description": "Makes initdb prompt for a password to give the database 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": ["-X directory", "--waldir= directory"], "summary": "This option specifies the directory where the write-ahead log should be stored.", "signature": "-X directory --waldir= directory", "source_url": "/docs/10/app-initdb.html", "description": "This option specifies the directory where the write-ahead log should be stored."}, {"names": ["-d", "--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": "-d --debug", "source_url": "/docs/10/app-initdb.html", "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": ["-L directory"], "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": "-L directory", "source_url": "/docs/10/app-initdb.html", "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": ["-n", "--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": "-n --no-clean", "source_url": "/docs/10/app-initdb.html", "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": ["-V", "--version"], "summary": "Print the initdb version and exit.", "signature": "-V --version", "source_url": "/docs/10/app-initdb.html", "description": "Print the initdb version and exit."}, {"names": ["-?", "--help"], "summary": "Show help about initdb command line arguments, and exit.", "signature": "-? --help", "source_url": "/docs/10/app-initdb.html", "description": "Show help about initdb command line arguments, and exit."}], "related": [], "release": {"ref": "https://ftp.postgresql.org/pub/source/v10.23/postgresql-10.23.tar.bz2", "label": "10.23", "major": "10", "channel": "historical", "manifest": {"pdf": {"A4": {"url": "/files/documentation/pdf/10/postgresql-10-A4.pdf", "bytes": 12631706, "pages": 2591, "sha256": "34497ab9efb45c5bdf1bd11b9016b5451354feb462fa029cf74557a5fa5fbbc1", "built_at": "2026-09-26"}, "US": {"url": "/files/documentation/pdf/10/postgresql-10-US.pdf", "bytes": 12531684, "pages": 2724, "sha256": "429cc7133ddf4f97c560aa466dc9caea4b718721a8321e293357037cf0af4733", "built_at": "2026-09-26"}}, "tree": "10", "index": "index.html", "major": "10", "pages": 1085, "release": "10.23", "source_url": "https://ftp.postgresql.org/pub/source/v10.23/postgresql-10.23.tar.bz2", "svg_assets": 0, "source_mode": "en HTML verified against the pinned official archive", "source_sha256": "94a4b2528372458e5662c18d406629266667c437198160a18cdfd2c4a4d6eee9"}, "revision": "f9301feba91e2e2566038a36b8cee0e4402db68989538f88670fddd20b1f78ea", "evidence_kind": "English manual and source declarations", "source_sha256": "94a4b2528372458e5662c18d406629266667c437198160a18cdfd2c4a4d6eee9"}, "sources": [{"url": "/docs/10/app-initdb.html", "file": "app-initdb.html", "label": "10.23 English manual \u00b7 app-initdb.html", "anchor": "", "sha256": "ca0e86b1e5c9356e5d4d7753e9e179ab92796eead67d049397b4f2a7183110d1"}, {"url": "/docs/10/reference-server.html", "file": "reference-server.html", "label": "Server applications inventory", "anchor": "", "sha256": "2a6043b88501763a31348758a370a42cd7f9a179c7fdf3ef0e353c82e95b33e9"}], "sections": [], "synopsis": ["initdb [ option ...] [ --pgdata | -D ] directory"], "signature": "initdb [ option ...] [ --pgdata | -D ] directory", "description": ["initdb \u2014 create a new PostgreSQL database cluster"], "environment": [{"name": "PGDATA", "description": "Specifies the directory where the database cluster is to be stored; can be overridden using the -D option."}, {"name": "TZ", "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 )."}], "manual_html": "<div><div class=\"refentry\" id=\"APP-INITDB\">\n<div class=\"titlepage\"></div>\n\n<div class=\"refnamediv\">\n<h2><span class=\"refentrytitle\">initdb</span></h2>\n<p>initdb \u2014 create a new <span class=\"productname\">PostgreSQL</span> database cluster</p>\n</div>\n<div class=\"refsynopsisdiv\">\n<h2>Synopsis</h2>\n<div class=\"cmdsynopsis\">\n<p id=\"id-1.9.5.3.4.1\"><code class=\"command\">initdb</code> [<em class=\"replaceable\"><code>option</code></em>...] [ <code class=\"option\">--pgdata</code> | <code class=\"option\">-D</code> ] <em class=\"replaceable\"><code>directory</code></em></p>\n</div>\n</div>\n<div class=\"refsect1\" id=\"R1-APP-INITDB-1\">\n<h2>Description</h2>\n<p><code class=\"command\">initdb</code> creates a new <span class=\"productname\">PostgreSQL</span> database cluster. A database cluster is a collection of databases that are managed by a single server instance.</p>\n<p>Creating a database cluster consists of creating the directories in which the database data will live, generating the shared catalog tables (tables that belong to the whole cluster rather than to any particular database), and creating the <code class=\"literal\">template1</code> and <code class=\"literal\">postgres</code> databases. When you later create a new database, everything in the <code class=\"literal\">template1</code> database is copied. (Therefore, anything installed in <code class=\"literal\">template1</code> is automatically copied into each database created later.) The <code class=\"literal\">postgres</code> database is a default database meant for use by users, utilities and third party applications.</p>\n<p>Although <code class=\"command\">initdb</code> 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 <code class=\"command\">chown</code> to assign ownership of that directory to the database user account, then <code class=\"command\">su</code> to become the database user to run <code class=\"command\">initdb</code>.</p>\n<p><code class=\"command\">initdb</code> 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 <code class=\"command\">initdb</code> creates. Since the server cannot be run as root, you must not run <code class=\"command\">initdb</code> as root either. (It will in fact refuse to do so.)</p>\n<p><code class=\"command\">initdb</code> initializes the database cluster's default locale and character set encoding. The character set encoding, collation order (<code class=\"literal\">LC_COLLATE</code>) and character set classes (<code class=\"literal\">LC_CTYPE</code>, e.g., upper, lower, digit) can be set separately for a database when it is created. <code class=\"command\">initdb</code> determines those settings for the <code class=\"literal\">template1</code> database, which will serve as the default for all other databases.</p>\n<p>To alter the default collation order or character set classes, use the <code class=\"option\">--lc-collate</code> and <code class=\"option\">--lc-ctype</code> options. Collation orders other than <code class=\"literal\">C</code> or <code class=\"literal\">POSIX</code> also have a performance penalty. For these reasons it is important to choose the right locale when running <code class=\"command\">initdb</code>.</p>\n<p>The remaining locale categories can be changed later when the server is started. You can also use <code class=\"option\">--locale</code> to set the default for all locale categories, including collation order and character set classes. All server locale values (<code class=\"literal\">lc_*</code>) can be displayed via <code class=\"command\">SHOW ALL</code>. More details can be found in <a class=\"xref\" href=\"/docs/10/locale.html\" title=\"23.1.\u00a0Locale Support\">Section\u00a023.1</a>.</p>\n<p>To alter the default encoding, use the <code class=\"option\">--encoding</code>. More details can be found in <a class=\"xref\" href=\"/docs/10/multibyte.html\" title=\"23.3.\u00a0Character Set Support\">Section\u00a023.3</a>.</p>\n</div>\n<div class=\"refsect1\" id=\"id-1.9.5.3.6\">\n<h2>Options</h2>\n<div class=\"variablelist\">\n<dl class=\"variablelist\">\n<dt><span class=\"term\"><code class=\"option\">-A <em class=\"replaceable\"><code>authmethod</code></em></code><br></span><span class=\"term\"><code class=\"option\">--auth=<em class=\"replaceable\"><code>authmethod</code></em></code></span></dt>\n<dd>\n<p>This option specifies the default authentication method for local users used in <code class=\"filename\">pg_hba.conf</code> (<code class=\"literal\">host</code> and <code class=\"literal\">local</code> lines). <code class=\"command\">initdb</code> will prepopulate <code class=\"filename\">pg_hba.conf</code> entries using the specified authentication method for non-replication as well as replication connections.</p>\n<p>Do not use <code class=\"literal\">trust</code> unless you trust all local users on your system. <code class=\"literal\">trust</code> is the default for ease of installation.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--auth-host=<em class=\"replaceable\"><code>authmethod</code></em></code></span></dt>\n<dd>\n<p>This option specifies the authentication method for local users via TCP/IP connections used in <code class=\"filename\">pg_hba.conf</code> (<code class=\"literal\">host</code> lines).</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--auth-local=<em class=\"replaceable\"><code>authmethod</code></em></code></span></dt>\n<dd>\n<p>This option specifies the authentication method for local users via Unix-domain socket connections used in <code class=\"filename\">pg_hba.conf</code> (<code class=\"literal\">local</code> lines).</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-D <em class=\"replaceable\"><code>directory</code></em></code><br></span><span class=\"term\"><code class=\"option\">--pgdata=<em class=\"replaceable\"><code>directory</code></em></code></span></dt>\n<dd>\n<p>This option specifies the directory where the database cluster should be stored. This is the only information required by <code class=\"command\">initdb</code>, but you can avoid writing it by setting the <code class=\"envar\">PGDATA</code> environment variable, which can be convenient since the database server (<code class=\"command\">postgres</code>) can find the database directory later by the same variable.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-E <em class=\"replaceable\"><code>encoding</code></em></code><br></span><span class=\"term\"><code class=\"option\">--encoding=<em class=\"replaceable\"><code>encoding</code></em></code></span></dt>\n<dd>\n<p>Selects the encoding of the template database. This will also be the default encoding of any database you create later, unless you override it there. The default is derived from the locale, or <code class=\"literal\">SQL_ASCII</code> if that does not work. The character sets supported by the <span class=\"productname\">PostgreSQL</span> server are described in <a class=\"xref\" href=\"/docs/10/multibyte.html#MULTIBYTE-CHARSET-SUPPORTED\" title=\"23.3.1.\u00a0Supported Character Sets\">Section\u00a023.3.1</a>.</p>\n</dd>\n<dt id=\"APP-INITDB-DATA-CHECKSUMS\"><span class=\"term\"><code class=\"option\">-k</code><br></span><span class=\"term\"><code class=\"option\">--data-checksums</code></span></dt>\n<dd>\n<p>Use checksums on data pages to help detect corruption by the I/O system that would otherwise be silent. Enabling checksums may incur a noticeable performance penalty. This option can only be set during initialization, and cannot be changed later. If set, checksums are calculated for all objects, in all databases.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--locale=<em class=\"replaceable\"><code>locale</code></em></code></span></dt>\n<dd>\n<p>Sets the default locale for the database cluster. If this option is not specified, the locale is inherited from the environment that <code class=\"command\">initdb</code> runs in. Locale support is described in <a class=\"xref\" href=\"/docs/10/locale.html\" title=\"23.1.\u00a0Locale Support\">Section\u00a023.1</a>.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--lc-collate=<em class=\"replaceable\"><code>locale</code></em></code><br></span><span class=\"term\"><code class=\"option\">--lc-ctype=<em class=\"replaceable\"><code>locale</code></em></code><br></span><span class=\"term\"><code class=\"option\">--lc-messages=<em class=\"replaceable\"><code>locale</code></em></code><br></span><span class=\"term\"><code class=\"option\">--lc-monetary=<em class=\"replaceable\"><code>locale</code></em></code><br></span><span class=\"term\"><code class=\"option\">--lc-numeric=<em class=\"replaceable\"><code>locale</code></em></code><br></span><span class=\"term\"><code class=\"option\">--lc-time=<em class=\"replaceable\"><code>locale</code></em></code></span></dt>\n<dd>\n<p>Like <code class=\"option\">--locale</code>, but only sets the locale in the specified category.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--no-locale</code></span></dt>\n<dd>\n<p>Equivalent to <code class=\"option\">--locale=C</code>.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-N</code><br></span><span class=\"term\"><code class=\"option\">--no-sync</code></span></dt>\n<dd>\n<p>By default, <code class=\"command\">initdb</code> will wait for all files to be written safely to disk. This option causes <code class=\"command\">initdb</code> 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.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--pwfile=<em class=\"replaceable\"><code>filename</code></em></code></span></dt>\n<dd>\n<p>Makes <code class=\"command\">initdb</code> read the database superuser's password from a file. The first line of the file is taken as the password.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-S</code><br></span><span class=\"term\"><code class=\"option\">--sync-only</code></span></dt>\n<dd>\n<p>Safely write all database files to disk and exit. This does not perform any of the normal <span class=\"application\">initdb</span> operations.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-T <em class=\"replaceable\"><code>config</code></em></code><br></span><span class=\"term\"><code class=\"option\">--text-search-config=<em class=\"replaceable\"><code>config</code></em></code></span></dt>\n<dd>\n<p>Sets the default text search configuration. See <a class=\"xref\" href=\"/docs/10/runtime-config-client.html#GUC-DEFAULT-TEXT-SEARCH-CONFIG\">default_text_search_config</a> for further information.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-U <em class=\"replaceable\"><code>username</code></em></code><br></span><span class=\"term\"><code class=\"option\">--username=<em class=\"replaceable\"><code>username</code></em></code></span></dt>\n<dd>\n<p>Selects the user name of the database superuser. This defaults to the name of the effective user running <code class=\"command\">initdb</code>. It is really not important what the superuser's name is, but one might choose to keep the customary name <span class=\"systemitem\">postgres</span>, even if the operating system user's name is different.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-W</code><br></span><span class=\"term\"><code class=\"option\">--pwprompt</code></span></dt>\n<dd>\n<p>Makes <code class=\"command\">initdb</code> prompt for a password to give the database 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.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-X <em class=\"replaceable\"><code>directory</code></em></code><br></span><span class=\"term\"><code class=\"option\">--waldir=<em class=\"replaceable\"><code>directory</code></em></code></span></dt>\n<dd>\n<p>This option specifies the directory where the write-ahead log should be stored.</p>\n</dd>\n</dl>\n</div>\n<p>Other, less commonly used, options are also available:</p>\n<div class=\"variablelist\">\n<dl class=\"variablelist\">\n<dt><span class=\"term\"><code class=\"option\">-d</code><br></span><span class=\"term\"><code class=\"option\">--debug</code></span></dt>\n<dd>\n<p>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 <code class=\"command\">initdb</code> uses to create the catalog tables. This option generates a tremendous amount of extremely boring output.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-L <em class=\"replaceable\"><code>directory</code></em></code></span></dt>\n<dd>\n<p>Specifies where <code class=\"command\">initdb</code> 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.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-n</code><br></span><span class=\"term\"><code class=\"option\">--no-clean</code></span></dt>\n<dd>\n<p>By default, when <code class=\"command\">initdb</code> 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.</p>\n</dd>\n</dl>\n</div>\n<p>Other options:</p>\n<div class=\"variablelist\">\n<dl class=\"variablelist\">\n<dt><span class=\"term\"><code class=\"option\">-V</code><br></span><span class=\"term\"><code class=\"option\">--version</code></span></dt>\n<dd>\n<p>Print the <span class=\"application\">initdb</span> version and exit.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-?</code><br></span><span class=\"term\"><code class=\"option\">--help</code></span></dt>\n<dd>\n<p>Show help about <span class=\"application\">initdb</span> command line arguments, and exit.</p>\n</dd>\n</dl>\n</div>\n</div>\n<div class=\"refsect1\" id=\"id-1.9.5.3.7\">\n<h2>Environment</h2>\n<div class=\"variablelist\">\n<dl class=\"variablelist\">\n<dt><span class=\"term\"><code class=\"envar\">PGDATA</code></span></dt>\n<dd>\n<p>Specifies the directory where the database cluster is to be stored; can be overridden using the <code class=\"option\">-D</code> option.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"envar\">TZ</code></span></dt>\n<dd>\n<p>Specifies the default time zone of the created database cluster. The value should be a full time zone name (see <a class=\"xref\" href=\"/docs/10/datatype-datetime.html#DATATYPE-TIMEZONES\" title=\"8.5.3.\u00a0Time Zones\">Section\u00a08.5.3</a>).</p>\n</dd>\n</dl>\n</div>\n<p>This utility, like most other <span class=\"productname\">PostgreSQL</span> utilities, also uses the environment variables supported by <span class=\"application\">libpq</span> (see <a class=\"xref\" href=\"/docs/10/libpq-envars.html\" title=\"33.14.\u00a0Environment Variables\">Section\u00a033.14</a>).</p>\n</div>\n<div class=\"refsect1\" id=\"id-1.9.5.3.8\">\n<h2>Notes</h2>\n<p><code class=\"command\">initdb</code> can also be invoked via <code class=\"command\">pg_ctl initdb</code>.</p>\n</div>\n<div class=\"refsect1\" id=\"id-1.9.5.3.9\">\n<h2>See Also</h2>\n<span class=\"simplelist\"><a class=\"xref\" href=\"/docs/10/app-pg-ctl.html\" title=\"pg_ctl\"><span class=\"refentrytitle\"><span class=\"application\">pg_ctl</span></span></a>, <a class=\"xref\" href=\"/docs/10/app-postgres.html\" title=\"postgres\"><span class=\"refentrytitle\"><span class=\"application\">postgres</span></span></a></span></div>\n</div></div>", "manual_path": "app-initdb.html", "comparison_data": {"options": [{"names": ["-A authmethod", "--auth= authmethod"], "signature": "-A authmethod --auth= authmethod", "description": "This option specifies the default authentication method for local users used in pg_hba.conf ( host and local lines). 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": ["--auth-host= authmethod"], "signature": "--auth-host= authmethod", "description": "This option specifies the authentication method for local users via TCP/IP connections used in pg_hba.conf ( host lines)."}, {"names": ["--auth-local= authmethod"], "signature": "--auth-local= authmethod", "description": "This option specifies the authentication method for local users via Unix-domain socket connections used in pg_hba.conf ( local lines)."}, {"names": ["-D directory", "--pgdata= directory"], "signature": "-D directory --pgdata= directory", "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 database directory later by the same variable."}, {"names": ["-E encoding", "--encoding= encoding"], "signature": "-E encoding --encoding= encoding", "description": "Selects the encoding of the template database. This will also be the default encoding of any database you create later, unless you override it there. The default is derived from the locale, or SQL_ASCII if that does not work. The character sets supported by the PostgreSQL server are described in Section 23.3.1 ."}, {"names": ["-k", "--data-checksums"], "signature": "-k --data-checksums", "description": "Use checksums on data pages to help detect corruption by the I/O system that would otherwise be silent. Enabling checksums may incur a noticeable performance penalty. This option can only be set during initialization, and cannot be changed later. If set, checksums are calculated for all objects, in all databases."}, {"names": ["--locale= locale"], "signature": "--locale= locale", "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 ."}, {"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": "Like --locale , but only sets the locale in the specified category."}, {"names": ["--no-locale"], "signature": "--no-locale", "description": "Equivalent to --locale=C ."}, {"names": ["-N", "--no-sync"], "signature": "-N --no-sync", "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": ["--pwfile= filename"], "signature": "--pwfile= filename", "description": "Makes initdb read the database superuser's password from a file. The first line of the file is taken as the password."}, {"names": ["-S", "--sync-only"], "signature": "-S --sync-only", "description": "Safely write all database files to disk and exit. This does not perform any of the normal initdb operations."}, {"names": ["-T config", "--text-search-config= config"], "signature": "-T config --text-search-config= config", "description": "Sets the default text search configuration. See default_text_search_config for further information."}, {"names": ["-U username", "--username= username"], "signature": "-U username --username= username", "description": "Selects the user name of the database superuser. This defaults to the name of the effective user running initdb . It is really not important what the superuser's name is, but one might choose to keep the customary name postgres , even if the operating system user's name is different."}, {"names": ["-W", "--pwprompt"], "signature": "-W --pwprompt", "description": "Makes initdb prompt for a password to give the database 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": ["-X directory", "--waldir= directory"], "signature": "-X directory --waldir= directory", "description": "This option specifies the directory where the write-ahead log should be stored."}, {"names": ["-d", "--debug"], "signature": "-d --debug", "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": ["-L directory"], "signature": "-L directory", "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": ["-n", "--no-clean"], "signature": "-n --no-clean", "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": ["-V", "--version"], "signature": "-V --version", "description": "Print the initdb version and exit."}, {"names": ["-?", "--help"], "signature": "-? --help", "description": "Show help about initdb command line arguments, and exit."}], "synopsis": ["initdb [ option ...] [ --pgdata | -D ] directory"], "environment": [{"name": "PGDATA", "description": "Specifies the directory where the database cluster is to be stored; can be overridden using the -D option."}, {"name": "TZ", "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 )."}]}, "comparison_hash": "2c10a82dc53694faca13bee1a875bc8fc6c5e77607d7d73cbd68afd8287b2976"}, "11": {"facts": [{"label": "Documented executable", "value": "initdb"}, {"label": "Executable version", "value": "11.22"}, {"label": "Reference inventory", "value": "Server applications"}, {"label": "Option definition groups", "value": "23"}], "tables": [{"key": "options", "rows": [{"summary": "This option specifies the default authentication method for local users used in pg_hba.conf ( host and local lines). initdb will prepopulate pg_hba.conf entries using the specified authentication method for non-replication as well as replication connections.", "signature": {"url": "/docs/11/app-initdb.html", "text": "-A authmethod --auth= authmethod"}}, {"summary": "This option specifies the authentication method for local users via TCP/IP connections used in pg_hba.conf ( host lines).", "signature": {"url": "/docs/11/app-initdb.html", "text": "--auth-host= authmethod"}}, {"summary": "This option specifies the authentication method for local users via Unix-domain socket connections used in pg_hba.conf ( local lines).", "signature": {"url": "/docs/11/app-initdb.html", "text": "--auth-local= authmethod"}}, {"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 database directory later by the same variable.", "signature": {"url": "/docs/11/app-initdb.html", "text": "-D directory --pgdata= directory"}}, {"summary": "Selects the encoding of the template database. This will also be the default encoding of any database you create later, unless you override it there. The default is derived from the locale, or SQL_ASCII if that does not work. The character sets supported by the PostgreSQL server are described in Section 23.3.1 .", "signature": {"url": "/docs/11/app-initdb.html", "text": "-E encoding --encoding= encoding"}}, {"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": {"url": "/docs/11/app-initdb.html#APP-INITDB-ALLOW-GROUP-ACCESS", "text": "-g --allow-group-access"}}, {"summary": "Use checksums on data pages to help detect corruption by the I/O system that would otherwise be silent. Enabling checksums may incur a noticeable performance penalty. This option can only be set during initialization, and cannot be changed later. If set, checksums are calculated for all objects, in all databases.", "signature": {"url": "/docs/11/app-initdb.html#APP-INITDB-DATA-CHECKSUMS", "text": "-k --data-checksums"}}, {"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": {"url": "/docs/11/app-initdb.html", "text": "--locale= locale"}}, {"summary": "Like --locale , but only sets the locale in the specified category.", "signature": {"url": "/docs/11/app-initdb.html", "text": "--lc-collate= locale --lc-ctype= locale --lc-messages= locale --lc-monetary= locale --lc-numeric= locale --lc-time= locale"}}, {"summary": "Equivalent to --locale=C .", "signature": {"url": "/docs/11/app-initdb.html", "text": "--no-locale"}}, {"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": {"url": "/docs/11/app-initdb.html", "text": "-N --no-sync"}}, {"summary": "Makes initdb read the database superuser's password from a file. The first line of the file is taken as the password.", "signature": {"url": "/docs/11/app-initdb.html", "text": "--pwfile= filename"}}, {"summary": "Safely write all database files to disk and exit. This does not perform any of the normal initdb operations.", "signature": {"url": "/docs/11/app-initdb.html", "text": "-S --sync-only"}}, {"summary": "Sets the default text search configuration. See default_text_search_config for further information.", "signature": {"url": "/docs/11/app-initdb.html", "text": "-T config --text-search-config= config"}}, {"summary": "Selects the user name of the database superuser. This defaults to the name of the effective user running initdb . It is really not important what the superuser's name is, but one might choose to keep the customary name postgres , even if the operating system user's name is different.", "signature": {"url": "/docs/11/app-initdb.html", "text": "-U username --username= username"}}, {"summary": "Makes initdb prompt for a password to give the database 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": {"url": "/docs/11/app-initdb.html", "text": "-W --pwprompt"}}, {"summary": "This option specifies the directory where the write-ahead log should be stored.", "signature": {"url": "/docs/11/app-initdb.html", "text": "-X directory --waldir= directory"}}, {"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": {"url": "/docs/11/app-initdb.html", "text": "--wal-segsize= size"}}, {"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": {"url": "/docs/11/app-initdb.html", "text": "-d --debug"}}, {"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": {"url": "/docs/11/app-initdb.html", "text": "-L directory"}}, {"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": {"url": "/docs/11/app-initdb.html", "text": "-n --no-clean"}}, {"summary": "Print the initdb version and exit.", "signature": {"url": "/docs/11/app-initdb.html", "text": "-V --version"}}, {"summary": "Show help about initdb command line arguments, and exit.", "signature": {"url": "/docs/11/app-initdb.html", "text": "-? --help"}}], "title": "Documented options", "columns": [{"key": "signature", "label": "Option and arguments"}, {"key": "summary", "label": "Description"}]}, {"key": "environment", "rows": [{"name": "PGDATA", "description": "Specifies the directory where the database cluster is to be stored; can be overridden using the -D option."}, {"name": "TZ", "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 )."}], "title": "Environment variables", "columns": [{"key": "name", "label": "Variable"}, {"key": "description", "label": "Meaning"}]}], "options": [{"names": ["-A authmethod", "--auth= authmethod"], "summary": "This option specifies the default authentication method for local users used in pg_hba.conf ( host and local lines). initdb will prepopulate pg_hba.conf entries using the specified authentication method for non-replication as well as replication connections.", "signature": "-A authmethod --auth= authmethod", "source_url": "/docs/11/app-initdb.html", "description": "This option specifies the default authentication method for local users used in pg_hba.conf ( host and local lines). 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": ["--auth-host= authmethod"], "summary": "This option specifies the authentication method for local users via TCP/IP connections used in pg_hba.conf ( host lines).", "signature": "--auth-host= authmethod", "source_url": "/docs/11/app-initdb.html", "description": "This option specifies the authentication method for local users via TCP/IP connections used in pg_hba.conf ( host lines)."}, {"names": ["--auth-local= authmethod"], "summary": "This option specifies the authentication method for local users via Unix-domain socket connections used in pg_hba.conf ( local lines).", "signature": "--auth-local= authmethod", "source_url": "/docs/11/app-initdb.html", "description": "This option specifies the authentication method for local users via Unix-domain socket connections used in pg_hba.conf ( local lines)."}, {"names": ["-D directory", "--pgdata= directory"], "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 database directory later by the same variable.", "signature": "-D directory --pgdata= directory", "source_url": "/docs/11/app-initdb.html", "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 database directory later by the same variable."}, {"names": ["-E encoding", "--encoding= encoding"], "summary": "Selects the encoding of the template database. This will also be the default encoding of any database you create later, unless you override it there. The default is derived from the locale, or SQL_ASCII if that does not work. The character sets supported by the PostgreSQL server are described in Section 23.3.1 .", "signature": "-E encoding --encoding= encoding", "source_url": "/docs/11/app-initdb.html", "description": "Selects the encoding of the template database. This will also be the default encoding of any database you create later, unless you override it there. The default is derived from the locale, or SQL_ASCII if that does not work. The character sets supported by the PostgreSQL server are described in Section 23.3.1 ."}, {"names": ["-g", "--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": "-g --allow-group-access", "source_url": "/docs/11/app-initdb.html#APP-INITDB-ALLOW-GROUP-ACCESS", "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": ["-k", "--data-checksums"], "summary": "Use checksums on data pages to help detect corruption by the I/O system that would otherwise be silent. Enabling checksums may incur a noticeable performance penalty. This option can only be set during initialization, and cannot be changed later. If set, checksums are calculated for all objects, in all databases.", "signature": "-k --data-checksums", "source_url": "/docs/11/app-initdb.html#APP-INITDB-DATA-CHECKSUMS", "description": "Use checksums on data pages to help detect corruption by the I/O system that would otherwise be silent. Enabling checksums may incur a noticeable performance penalty. This option can only be set during initialization, and cannot be changed later. If set, checksums are calculated for all objects, in all databases."}, {"names": ["--locale= 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": "--locale= locale", "source_url": "/docs/11/app-initdb.html", "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 ."}, {"names": ["--lc-collate= locale", "--lc-ctype= locale", "--lc-messages= locale", "--lc-monetary= locale", "--lc-numeric= locale", "--lc-time= locale"], "summary": "Like --locale , but only sets the locale in the specified category.", "signature": "--lc-collate= locale --lc-ctype= locale --lc-messages= locale --lc-monetary= locale --lc-numeric= locale --lc-time= locale", "source_url": "/docs/11/app-initdb.html", "description": "Like --locale , but only sets the locale in the specified category."}, {"names": ["--no-locale"], "summary": "Equivalent to --locale=C .", "signature": "--no-locale", "source_url": "/docs/11/app-initdb.html", "description": "Equivalent to --locale=C ."}, {"names": ["-N", "--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": "-N --no-sync", "source_url": "/docs/11/app-initdb.html", "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": ["--pwfile= filename"], "summary": "Makes initdb read the database superuser's password from a file. The first line of the file is taken as the password.", "signature": "--pwfile= filename", "source_url": "/docs/11/app-initdb.html", "description": "Makes initdb read the database superuser's password from a file. The first line of the file is taken as the password."}, {"names": ["-S", "--sync-only"], "summary": "Safely write all database files to disk and exit. This does not perform any of the normal initdb operations.", "signature": "-S --sync-only", "source_url": "/docs/11/app-initdb.html", "description": "Safely write all database files to disk and exit. This does not perform any of the normal initdb operations."}, {"names": ["-T config", "--text-search-config= config"], "summary": "Sets the default text search configuration. See default_text_search_config for further information.", "signature": "-T config --text-search-config= config", "source_url": "/docs/11/app-initdb.html", "description": "Sets the default text search configuration. See default_text_search_config for further information."}, {"names": ["-U username", "--username= username"], "summary": "Selects the user name of the database superuser. This defaults to the name of the effective user running initdb . It is really not important what the superuser's name is, but one might choose to keep the customary name postgres , even if the operating system user's name is different.", "signature": "-U username --username= username", "source_url": "/docs/11/app-initdb.html", "description": "Selects the user name of the database superuser. This defaults to the name of the effective user running initdb . It is really not important what the superuser's name is, but one might choose to keep the customary name postgres , even if the operating system user's name is different."}, {"names": ["-W", "--pwprompt"], "summary": "Makes initdb prompt for a password to give the database 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": "-W --pwprompt", "source_url": "/docs/11/app-initdb.html", "description": "Makes initdb prompt for a password to give the database 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": ["-X directory", "--waldir= directory"], "summary": "This option specifies the directory where the write-ahead log should be stored.", "signature": "-X directory --waldir= directory", "source_url": "/docs/11/app-initdb.html", "description": "This option specifies the directory where the write-ahead log should be stored."}, {"names": ["--wal-segsize= size"], "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": "--wal-segsize= size", "source_url": "/docs/11/app-initdb.html", "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": ["-d", "--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": "-d --debug", "source_url": "/docs/11/app-initdb.html", "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": ["-L directory"], "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": "-L directory", "source_url": "/docs/11/app-initdb.html", "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": ["-n", "--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": "-n --no-clean", "source_url": "/docs/11/app-initdb.html", "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": ["-V", "--version"], "summary": "Print the initdb version and exit.", "signature": "-V --version", "source_url": "/docs/11/app-initdb.html", "description": "Print the initdb version and exit."}, {"names": ["-?", "--help"], "summary": "Show help about initdb command line arguments, and exit.", "signature": "-? --help", "source_url": "/docs/11/app-initdb.html", "description": "Show help about initdb command line arguments, and exit."}], "related": [], "release": {"ref": "https://ftp.postgresql.org/pub/source/v11.22/postgresql-11.22.tar.bz2", "label": "11.22", "major": "11", "channel": "historical", "manifest": {"pdf": {"A4": {"url": "/files/documentation/pdf/11/postgresql-11-A4.pdf", "bytes": 13057499, "pages": 2732, "sha256": "41d75855e610d0d9b8802b87dc5b080bef8d7e91c7cf69401fbf8d3cf801b4b5", "built_at": "2026-09-26"}, "US": {"url": "/files/documentation/pdf/11/postgresql-11-US.pdf", "bytes": 12961189, "pages": 2883, "sha256": "6a8899ef36935a5b7ed2b436207564a567a4ef1eb1c2200195876b8de4d4fa30", "built_at": "2026-09-26"}}, "tree": "11", "index": "index.html", "major": "11", "pages": 1125, "release": "11.22", "source_url": "https://ftp.postgresql.org/pub/source/v11.22/postgresql-11.22.tar.bz2", "svg_assets": 0, "source_mode": "en HTML verified against the pinned official archive", "source_sha256": "2cb7c97d7a0d7278851bbc9c61f467b69c094c72b81740b751108e7892ebe1f0"}, "revision": "53315ddaf3b3f9e6669fd1edc096bbb2cd4a65ea3e836c89e542b43af9ba3a7f", "evidence_kind": "English manual and source declarations", "source_sha256": "2cb7c97d7a0d7278851bbc9c61f467b69c094c72b81740b751108e7892ebe1f0"}, "sources": [{"url": "/docs/11/app-initdb.html", "file": "app-initdb.html", "label": "11.22 English manual \u00b7 app-initdb.html", "anchor": "", "sha256": "7691fcbcb372037aa62767669c66e9650515d881e9f07ce4c2b675ee4dcee18e"}, {"url": "/docs/11/reference-server.html", "file": "reference-server.html", "label": "Server applications inventory", "anchor": "", "sha256": "e940a8505b6742c717a1683d19bf8f759aad245633a59db9e83a345ae7c5709a"}], "sections": [], "synopsis": ["initdb [ option ...] [ --pgdata | -D ] directory"], "signature": "initdb [ option ...] [ --pgdata | -D ] directory", "description": ["initdb \u2014 create a new PostgreSQL database cluster"], "environment": [{"name": "PGDATA", "description": "Specifies the directory where the database cluster is to be stored; can be overridden using the -D option."}, {"name": "TZ", "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 )."}], "manual_html": "<div><div class=\"refentry\" id=\"APP-INITDB\">\n<div class=\"titlepage\"></div>\n<div class=\"refnamediv\">\n<h2><span class=\"refentrytitle\">initdb</span></h2>\n<p>initdb \u2014 create a new <span class=\"productname\">PostgreSQL</span> database cluster</p>\n</div>\n<div class=\"refsynopsisdiv\">\n<h2>Synopsis</h2>\n<div class=\"cmdsynopsis\">\n<p id=\"id-1.9.5.3.4.1\"><code class=\"command\">initdb</code> [<em class=\"replaceable\"><code>option</code></em>...] [ <code class=\"option\">--pgdata</code> | <code class=\"option\">-D</code> ] <em class=\"replaceable\"><code>directory</code></em></p>\n</div>\n</div>\n<div class=\"refsect1\" id=\"R1-APP-INITDB-1\">\n<h2>Description</h2>\n<p><code class=\"command\">initdb</code> creates a new <span class=\"productname\">PostgreSQL</span> database cluster. A database cluster is a collection of databases that are managed by a single server instance.</p>\n<p>Creating a database cluster consists of creating the directories in which the database data will live, generating the shared catalog tables (tables that belong to the whole cluster rather than to any particular database), and creating the <code class=\"literal\">template1</code> and <code class=\"literal\">postgres</code> databases. When you later create a new database, everything in the <code class=\"literal\">template1</code> database is copied. (Therefore, anything installed in <code class=\"literal\">template1</code> is automatically copied into each database created later.) The <code class=\"literal\">postgres</code> database is a default database meant for use by users, utilities and third party applications.</p>\n<p>Although <code class=\"command\">initdb</code> 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 <code class=\"command\">chown</code> to assign ownership of that directory to the database user account, then <code class=\"command\">su</code> to become the database user to run <code class=\"command\">initdb</code>.</p>\n<p><code class=\"command\">initdb</code> 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 <code class=\"command\">initdb</code> creates. Since the server cannot be run as root, you must not run <code class=\"command\">initdb</code> as root either. (It will in fact refuse to do so.)</p>\n<p>For security reasons the new cluster created by <code class=\"command\">initdb</code> will only be accessible by the cluster owner by default. The <code class=\"option\">--allow-group-access</code> 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.</p>\n<p><code class=\"command\">initdb</code> initializes the database cluster's default locale and character set encoding. The character set encoding, collation order (<code class=\"literal\">LC_COLLATE</code>) and character set classes (<code class=\"literal\">LC_CTYPE</code>, e.g., upper, lower, digit) can be set separately for a database when it is created. <code class=\"command\">initdb</code> determines those settings for the <code class=\"literal\">template1</code> database, which will serve as the default for all other databases.</p>\n<p>To alter the default collation order or character set classes, use the <code class=\"option\">--lc-collate</code> and <code class=\"option\">--lc-ctype</code> options. Collation orders other than <code class=\"literal\">C</code> or <code class=\"literal\">POSIX</code> also have a performance penalty. For these reasons it is important to choose the right locale when running <code class=\"command\">initdb</code>.</p>\n<p>The remaining locale categories can be changed later when the server is started. You can also use <code class=\"option\">--locale</code> to set the default for all locale categories, including collation order and character set classes. All server locale values (<code class=\"literal\">lc_*</code>) can be displayed via <code class=\"command\">SHOW ALL</code>. More details can be found in <a class=\"xref\" href=\"/docs/11/locale.html\" title=\"23.1.\u00a0Locale Support\">Section\u00a023.1</a>.</p>\n<p>To alter the default encoding, use the <code class=\"option\">--encoding</code>. More details can be found in <a class=\"xref\" href=\"/docs/11/multibyte.html\" title=\"23.3.\u00a0Character Set Support\">Section\u00a023.3</a>.</p>\n</div>\n<div class=\"refsect1\" id=\"id-1.9.5.3.6\">\n<h2>Options</h2>\n<div class=\"variablelist\">\n<dl class=\"variablelist\">\n<dt><span class=\"term\"><code class=\"option\">-A <em class=\"replaceable\"><code>authmethod</code></em></code><br></span><span class=\"term\"><code class=\"option\">--auth=<em class=\"replaceable\"><code>authmethod</code></em></code></span></dt>\n<dd>\n<p>This option specifies the default authentication method for local users used in <code class=\"filename\">pg_hba.conf</code> (<code class=\"literal\">host</code> and <code class=\"literal\">local</code> lines). <code class=\"command\">initdb</code> will prepopulate <code class=\"filename\">pg_hba.conf</code> entries using the specified authentication method for non-replication as well as replication connections.</p>\n<p>Do not use <code class=\"literal\">trust</code> unless you trust all local users on your system. <code class=\"literal\">trust</code> is the default for ease of installation.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--auth-host=<em class=\"replaceable\"><code>authmethod</code></em></code></span></dt>\n<dd>\n<p>This option specifies the authentication method for local users via TCP/IP connections used in <code class=\"filename\">pg_hba.conf</code> (<code class=\"literal\">host</code> lines).</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--auth-local=<em class=\"replaceable\"><code>authmethod</code></em></code></span></dt>\n<dd>\n<p>This option specifies the authentication method for local users via Unix-domain socket connections used in <code class=\"filename\">pg_hba.conf</code> (<code class=\"literal\">local</code> lines).</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-D <em class=\"replaceable\"><code>directory</code></em></code><br></span><span class=\"term\"><code class=\"option\">--pgdata=<em class=\"replaceable\"><code>directory</code></em></code></span></dt>\n<dd>\n<p>This option specifies the directory where the database cluster should be stored. This is the only information required by <code class=\"command\">initdb</code>, but you can avoid writing it by setting the <code class=\"envar\">PGDATA</code> environment variable, which can be convenient since the database server (<code class=\"command\">postgres</code>) can find the database directory later by the same variable.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-E <em class=\"replaceable\"><code>encoding</code></em></code><br></span><span class=\"term\"><code class=\"option\">--encoding=<em class=\"replaceable\"><code>encoding</code></em></code></span></dt>\n<dd>\n<p>Selects the encoding of the template database. This will also be the default encoding of any database you create later, unless you override it there. The default is derived from the locale, or <code class=\"literal\">SQL_ASCII</code> if that does not work. The character sets supported by the <span class=\"productname\">PostgreSQL</span> server are described in <a class=\"xref\" href=\"/docs/11/multibyte.html#MULTIBYTE-CHARSET-SUPPORTED\" title=\"23.3.1.\u00a0Supported Character Sets\">Section\u00a023.3.1</a>.</p>\n</dd>\n<dt id=\"APP-INITDB-ALLOW-GROUP-ACCESS\"><span class=\"term\"><code class=\"option\">-g</code><br></span><span class=\"term\"><code class=\"option\">--allow-group-access</code></span></dt>\n<dd>\n<p>Allows users in the same group as the cluster owner to read all cluster files created by <code class=\"command\">initdb</code>. This option is ignored on <span class=\"productname\">Windows</span> as it does not support POSIX-style group permissions.</p>\n</dd>\n<dt id=\"APP-INITDB-DATA-CHECKSUMS\"><span class=\"term\"><code class=\"option\">-k</code><br></span><span class=\"term\"><code class=\"option\">--data-checksums</code></span></dt>\n<dd>\n<p>Use checksums on data pages to help detect corruption by the I/O system that would otherwise be silent. Enabling checksums may incur a noticeable performance penalty. This option can only be set during initialization, and cannot be changed later. If set, checksums are calculated for all objects, in all databases.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--locale=<em class=\"replaceable\"><code>locale</code></em></code></span></dt>\n<dd>\n<p>Sets the default locale for the database cluster. If this option is not specified, the locale is inherited from the environment that <code class=\"command\">initdb</code> runs in. Locale support is described in <a class=\"xref\" href=\"/docs/11/locale.html\" title=\"23.1.\u00a0Locale Support\">Section\u00a023.1</a>.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--lc-collate=<em class=\"replaceable\"><code>locale</code></em></code><br></span><span class=\"term\"><code class=\"option\">--lc-ctype=<em class=\"replaceable\"><code>locale</code></em></code><br></span><span class=\"term\"><code class=\"option\">--lc-messages=<em class=\"replaceable\"><code>locale</code></em></code><br></span><span class=\"term\"><code class=\"option\">--lc-monetary=<em class=\"replaceable\"><code>locale</code></em></code><br></span><span class=\"term\"><code class=\"option\">--lc-numeric=<em class=\"replaceable\"><code>locale</code></em></code><br></span><span class=\"term\"><code class=\"option\">--lc-time=<em class=\"replaceable\"><code>locale</code></em></code></span></dt>\n<dd>\n<p>Like <code class=\"option\">--locale</code>, but only sets the locale in the specified category.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--no-locale</code></span></dt>\n<dd>\n<p>Equivalent to <code class=\"option\">--locale=C</code>.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-N</code><br></span><span class=\"term\"><code class=\"option\">--no-sync</code></span></dt>\n<dd>\n<p>By default, <code class=\"command\">initdb</code> will wait for all files to be written safely to disk. This option causes <code class=\"command\">initdb</code> 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.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--pwfile=<em class=\"replaceable\"><code>filename</code></em></code></span></dt>\n<dd>\n<p>Makes <code class=\"command\">initdb</code> read the database superuser's password from a file. The first line of the file is taken as the password.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-S</code><br></span><span class=\"term\"><code class=\"option\">--sync-only</code></span></dt>\n<dd>\n<p>Safely write all database files to disk and exit. This does not perform any of the normal <span class=\"application\">initdb</span> operations.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-T <em class=\"replaceable\"><code>config</code></em></code><br></span><span class=\"term\"><code class=\"option\">--text-search-config=<em class=\"replaceable\"><code>config</code></em></code></span></dt>\n<dd>\n<p>Sets the default text search configuration. See <a class=\"xref\" href=\"/docs/11/runtime-config-client.html#GUC-DEFAULT-TEXT-SEARCH-CONFIG\">default_text_search_config</a> for further information.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-U <em class=\"replaceable\"><code>username</code></em></code><br></span><span class=\"term\"><code class=\"option\">--username=<em class=\"replaceable\"><code>username</code></em></code></span></dt>\n<dd>\n<p>Selects the user name of the database superuser. This defaults to the name of the effective user running <code class=\"command\">initdb</code>. It is really not important what the superuser's name is, but one might choose to keep the customary name <span class=\"systemitem\">postgres</span>, even if the operating system user's name is different.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-W</code><br></span><span class=\"term\"><code class=\"option\">--pwprompt</code></span></dt>\n<dd>\n<p>Makes <code class=\"command\">initdb</code> prompt for a password to give the database 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.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-X <em class=\"replaceable\"><code>directory</code></em></code><br></span><span class=\"term\"><code class=\"option\">--waldir=<em class=\"replaceable\"><code>directory</code></em></code></span></dt>\n<dd>\n<p>This option specifies the directory where the write-ahead log should be stored.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--wal-segsize=<em class=\"replaceable\"><code>size</code></em></code></span></dt>\n<dd>\n<p>Set the <em class=\"firstterm\">WAL segment size</em>, 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.</p>\n<p>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.</p>\n</dd>\n</dl>\n</div>\n<p>Other, less commonly used, options are also available:</p>\n<div class=\"variablelist\">\n<dl class=\"variablelist\">\n<dt><span class=\"term\"><code class=\"option\">-d</code><br></span><span class=\"term\"><code class=\"option\">--debug</code></span></dt>\n<dd>\n<p>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 <code class=\"command\">initdb</code> uses to create the catalog tables. This option generates a tremendous amount of extremely boring output.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-L <em class=\"replaceable\"><code>directory</code></em></code></span></dt>\n<dd>\n<p>Specifies where <code class=\"command\">initdb</code> 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.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-n</code><br></span><span class=\"term\"><code class=\"option\">--no-clean</code></span></dt>\n<dd>\n<p>By default, when <code class=\"command\">initdb</code> 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.</p>\n</dd>\n</dl>\n</div>\n<p>Other options:</p>\n<div class=\"variablelist\">\n<dl class=\"variablelist\">\n<dt><span class=\"term\"><code class=\"option\">-V</code><br></span><span class=\"term\"><code class=\"option\">--version</code></span></dt>\n<dd>\n<p>Print the <span class=\"application\">initdb</span> version and exit.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-?</code><br></span><span class=\"term\"><code class=\"option\">--help</code></span></dt>\n<dd>\n<p>Show help about <span class=\"application\">initdb</span> command line arguments, and exit.</p>\n</dd>\n</dl>\n</div>\n</div>\n<div class=\"refsect1\" id=\"id-1.9.5.3.7\">\n<h2>Environment</h2>\n<div class=\"variablelist\">\n<dl class=\"variablelist\">\n<dt><span class=\"term\"><code class=\"envar\">PGDATA</code></span></dt>\n<dd>\n<p>Specifies the directory where the database cluster is to be stored; can be overridden using the <code class=\"option\">-D</code> option.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"envar\">TZ</code></span></dt>\n<dd>\n<p>Specifies the default time zone of the created database cluster. The value should be a full time zone name (see <a class=\"xref\" href=\"/docs/11/datatype-datetime.html#DATATYPE-TIMEZONES\" title=\"8.5.3.\u00a0Time Zones\">Section\u00a08.5.3</a>).</p>\n</dd>\n</dl>\n</div>\n<p>This utility, like most other <span class=\"productname\">PostgreSQL</span> utilities, also uses the environment variables supported by <span class=\"application\">libpq</span> (see <a class=\"xref\" href=\"/docs/11/libpq-envars.html\" title=\"34.14.\u00a0Environment Variables\">Section\u00a034.14</a>).</p>\n</div>\n<div class=\"refsect1\" id=\"id-1.9.5.3.8\">\n<h2>Notes</h2>\n<p><code class=\"command\">initdb</code> can also be invoked via <code class=\"command\">pg_ctl initdb</code>.</p>\n</div>\n<div class=\"refsect1\" id=\"id-1.9.5.3.9\">\n<h2>See Also</h2><span class=\"simplelist\"><a class=\"xref\" href=\"/docs/11/app-pg-ctl.html\" title=\"pg_ctl\"><span class=\"refentrytitle\"><span class=\"application\">pg_ctl</span></span></a>, <a class=\"xref\" href=\"/docs/11/app-postgres.html\" title=\"postgres\"><span class=\"refentrytitle\"><span class=\"application\">postgres</span></span></a></span>\n</div>\n</div></div>", "manual_path": "app-initdb.html", "comparison_data": {"options": [{"names": ["-A authmethod", "--auth= authmethod"], "signature": "-A authmethod --auth= authmethod", "description": "This option specifies the default authentication method for local users used in pg_hba.conf ( host and local lines). 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": ["--auth-host= authmethod"], "signature": "--auth-host= authmethod", "description": "This option specifies the authentication method for local users via TCP/IP connections used in pg_hba.conf ( host lines)."}, {"names": ["--auth-local= authmethod"], "signature": "--auth-local= authmethod", "description": "This option specifies the authentication method for local users via Unix-domain socket connections used in pg_hba.conf ( local lines)."}, {"names": ["-D directory", "--pgdata= directory"], "signature": "-D directory --pgdata= directory", "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 database directory later by the same variable."}, {"names": ["-E encoding", "--encoding= encoding"], "signature": "-E encoding --encoding= encoding", "description": "Selects the encoding of the template database. This will also be the default encoding of any database you create later, unless you override it there. The default is derived from the locale, or SQL_ASCII if that does not work. The character sets supported by the PostgreSQL server are described in Section 23.3.1 ."}, {"names": ["-g", "--allow-group-access"], "signature": "-g --allow-group-access", "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": ["-k", "--data-checksums"], "signature": "-k --data-checksums", "description": "Use checksums on data pages to help detect corruption by the I/O system that would otherwise be silent. Enabling checksums may incur a noticeable performance penalty. This option can only be set during initialization, and cannot be changed later. If set, checksums are calculated for all objects, in all databases."}, {"names": ["--locale= locale"], "signature": "--locale= locale", "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 ."}, {"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": "Like --locale , but only sets the locale in the specified category."}, {"names": ["--no-locale"], "signature": "--no-locale", "description": "Equivalent to --locale=C ."}, {"names": ["-N", "--no-sync"], "signature": "-N --no-sync", "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": ["--pwfile= filename"], "signature": "--pwfile= filename", "description": "Makes initdb read the database superuser's password from a file. The first line of the file is taken as the password."}, {"names": ["-S", "--sync-only"], "signature": "-S --sync-only", "description": "Safely write all database files to disk and exit. This does not perform any of the normal initdb operations."}, {"names": ["-T config", "--text-search-config= config"], "signature": "-T config --text-search-config= config", "description": "Sets the default text search configuration. See default_text_search_config for further information."}, {"names": ["-U username", "--username= username"], "signature": "-U username --username= username", "description": "Selects the user name of the database superuser. This defaults to the name of the effective user running initdb . It is really not important what the superuser's name is, but one might choose to keep the customary name postgres , even if the operating system user's name is different."}, {"names": ["-W", "--pwprompt"], "signature": "-W --pwprompt", "description": "Makes initdb prompt for a password to give the database 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": ["-X directory", "--waldir= directory"], "signature": "-X directory --waldir= directory", "description": "This option specifies the directory where the write-ahead log should be stored."}, {"names": ["--wal-segsize= size"], "signature": "--wal-segsize= size", "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": ["-d", "--debug"], "signature": "-d --debug", "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": ["-L directory"], "signature": "-L directory", "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": ["-n", "--no-clean"], "signature": "-n --no-clean", "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": ["-V", "--version"], "signature": "-V --version", "description": "Print the initdb version and exit."}, {"names": ["-?", "--help"], "signature": "-? --help", "description": "Show help about initdb command line arguments, and exit."}], "synopsis": ["initdb [ option ...] [ --pgdata | -D ] directory"], "environment": [{"name": "PGDATA", "description": "Specifies the directory where the database cluster is to be stored; can be overridden using the -D option."}, {"name": "TZ", "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 )."}]}, "comparison_hash": "55ce5325249eab0519af7c3055e8772084c095e6f5bf637664dcd878d09c446b"}, "12": {"facts": [{"label": "Documented executable", "value": "initdb"}, {"label": "Executable version", "value": "12.22"}, {"label": "Reference inventory", "value": "Server applications"}, {"label": "Option definition groups", "value": "23"}], "tables": [{"key": "options", "rows": [{"summary": "This option specifies the default authentication method for local users used in pg_hba.conf ( host and local lines). initdb will prepopulate pg_hba.conf entries using the specified authentication method for non-replication as well as replication connections.", "signature": {"url": "/docs/12/app-initdb.html", "text": "-A authmethod --auth= authmethod"}}, {"summary": "This option specifies the authentication method for local users via TCP/IP connections used in pg_hba.conf ( host lines).", "signature": {"url": "/docs/12/app-initdb.html", "text": "--auth-host= authmethod"}}, {"summary": "This option specifies the authentication method for local users via Unix-domain socket connections used in pg_hba.conf ( local lines).", "signature": {"url": "/docs/12/app-initdb.html", "text": "--auth-local= authmethod"}}, {"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 database directory later by the same variable.", "signature": {"url": "/docs/12/app-initdb.html", "text": "-D directory --pgdata= directory"}}, {"summary": "Selects the encoding of the template database. This will also be the default encoding of any database you create later, unless you override it there. The default is derived from the locale, or SQL_ASCII if that does not work. The character sets supported by the PostgreSQL server are described in Section 23.3.1 .", "signature": {"url": "/docs/12/app-initdb.html", "text": "-E encoding --encoding= encoding"}}, {"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": {"url": "/docs/12/app-initdb.html#APP-INITDB-ALLOW-GROUP-ACCESS", "text": "-g --allow-group-access"}}, {"summary": "Use checksums on data pages to help detect corruption by the I/O system that would otherwise be silent. Enabling checksums may incur a noticeable 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.", "signature": {"url": "/docs/12/app-initdb.html#APP-INITDB-DATA-CHECKSUMS", "text": "-k --data-checksums"}}, {"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": {"url": "/docs/12/app-initdb.html", "text": "--locale= locale"}}, {"summary": "Like --locale , but only sets the locale in the specified category.", "signature": {"url": "/docs/12/app-initdb.html", "text": "--lc-collate= locale --lc-ctype= locale --lc-messages= locale --lc-monetary= locale --lc-numeric= locale --lc-time= locale"}}, {"summary": "Equivalent to --locale=C .", "signature": {"url": "/docs/12/app-initdb.html", "text": "--no-locale"}}, {"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": {"url": "/docs/12/app-initdb.html", "text": "-N --no-sync"}}, {"summary": "Makes initdb read the database superuser's password from a file. The first line of the file is taken as the password.", "signature": {"url": "/docs/12/app-initdb.html", "text": "--pwfile= filename"}}, {"summary": "Safely write all database files to disk and exit. This does not perform any of the normal initdb operations.", "signature": {"url": "/docs/12/app-initdb.html", "text": "-S --sync-only"}}, {"summary": "Sets the default text search configuration. See default_text_search_config for further information.", "signature": {"url": "/docs/12/app-initdb.html", "text": "-T config --text-search-config= config"}}, {"summary": "Selects the user name of the database superuser. This defaults to the name of the effective user running initdb . It is really not important what the superuser's name is, but one might choose to keep the customary name postgres , even if the operating system user's name is different.", "signature": {"url": "/docs/12/app-initdb.html", "text": "-U username --username= username"}}, {"summary": "Makes initdb prompt for a password to give the database 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": {"url": "/docs/12/app-initdb.html", "text": "-W --pwprompt"}}, {"summary": "This option specifies the directory where the write-ahead log should be stored.", "signature": {"url": "/docs/12/app-initdb.html", "text": "-X directory --waldir= directory"}}, {"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": {"url": "/docs/12/app-initdb.html", "text": "--wal-segsize= size"}}, {"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": {"url": "/docs/12/app-initdb.html", "text": "-d --debug"}}, {"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": {"url": "/docs/12/app-initdb.html", "text": "-L directory"}}, {"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": {"url": "/docs/12/app-initdb.html", "text": "-n --no-clean"}}, {"summary": "Print the initdb version and exit.", "signature": {"url": "/docs/12/app-initdb.html", "text": "-V --version"}}, {"summary": "Show help about initdb command line arguments, and exit.", "signature": {"url": "/docs/12/app-initdb.html", "text": "-? --help"}}], "title": "Documented options", "columns": [{"key": "signature", "label": "Option and arguments"}, {"key": "summary", "label": "Description"}]}, {"key": "environment", "rows": [{"name": "PGDATA", "description": "Specifies the directory where the database cluster is to be stored; can be overridden using the -D option."}, {"name": "PG_COLOR", "description": "Specifies whether to use color in diagnostic messages. Possible values are always , auto and never ."}, {"name": "TZ", "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 )."}], "title": "Environment variables", "columns": [{"key": "name", "label": "Variable"}, {"key": "description", "label": "Meaning"}]}], "options": [{"names": ["-A authmethod", "--auth= authmethod"], "summary": "This option specifies the default authentication method for local users used in pg_hba.conf ( host and local lines). initdb will prepopulate pg_hba.conf entries using the specified authentication method for non-replication as well as replication connections.", "signature": "-A authmethod --auth= authmethod", "source_url": "/docs/12/app-initdb.html", "description": "This option specifies the default authentication method for local users used in pg_hba.conf ( host and local lines). 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": ["--auth-host= authmethod"], "summary": "This option specifies the authentication method for local users via TCP/IP connections used in pg_hba.conf ( host lines).", "signature": "--auth-host= authmethod", "source_url": "/docs/12/app-initdb.html", "description": "This option specifies the authentication method for local users via TCP/IP connections used in pg_hba.conf ( host lines)."}, {"names": ["--auth-local= authmethod"], "summary": "This option specifies the authentication method for local users via Unix-domain socket connections used in pg_hba.conf ( local lines).", "signature": "--auth-local= authmethod", "source_url": "/docs/12/app-initdb.html", "description": "This option specifies the authentication method for local users via Unix-domain socket connections used in pg_hba.conf ( local lines)."}, {"names": ["-D directory", "--pgdata= directory"], "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 database directory later by the same variable.", "signature": "-D directory --pgdata= directory", "source_url": "/docs/12/app-initdb.html", "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 database directory later by the same variable."}, {"names": ["-E encoding", "--encoding= encoding"], "summary": "Selects the encoding of the template database. This will also be the default encoding of any database you create later, unless you override it there. The default is derived from the locale, or SQL_ASCII if that does not work. The character sets supported by the PostgreSQL server are described in Section 23.3.1 .", "signature": "-E encoding --encoding= encoding", "source_url": "/docs/12/app-initdb.html", "description": "Selects the encoding of the template database. This will also be the default encoding of any database you create later, unless you override it there. The default is derived from the locale, or SQL_ASCII if that does not work. The character sets supported by the PostgreSQL server are described in Section 23.3.1 ."}, {"names": ["-g", "--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": "-g --allow-group-access", "source_url": "/docs/12/app-initdb.html#APP-INITDB-ALLOW-GROUP-ACCESS", "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": ["-k", "--data-checksums"], "summary": "Use checksums on data pages to help detect corruption by the I/O system that would otherwise be silent. Enabling checksums may incur a noticeable 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.", "signature": "-k --data-checksums", "source_url": "/docs/12/app-initdb.html#APP-INITDB-DATA-CHECKSUMS", "description": "Use checksums on data pages to help detect corruption by the I/O system that would otherwise be silent. Enabling checksums may incur a noticeable 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."}, {"names": ["--locale= 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": "--locale= locale", "source_url": "/docs/12/app-initdb.html", "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 ."}, {"names": ["--lc-collate= locale", "--lc-ctype= locale", "--lc-messages= locale", "--lc-monetary= locale", "--lc-numeric= locale", "--lc-time= locale"], "summary": "Like --locale , but only sets the locale in the specified category.", "signature": "--lc-collate= locale --lc-ctype= locale --lc-messages= locale --lc-monetary= locale --lc-numeric= locale --lc-time= locale", "source_url": "/docs/12/app-initdb.html", "description": "Like --locale , but only sets the locale in the specified category."}, {"names": ["--no-locale"], "summary": "Equivalent to --locale=C .", "signature": "--no-locale", "source_url": "/docs/12/app-initdb.html", "description": "Equivalent to --locale=C ."}, {"names": ["-N", "--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": "-N --no-sync", "source_url": "/docs/12/app-initdb.html", "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": ["--pwfile= filename"], "summary": "Makes initdb read the database superuser's password from a file. The first line of the file is taken as the password.", "signature": "--pwfile= filename", "source_url": "/docs/12/app-initdb.html", "description": "Makes initdb read the database superuser's password from a file. The first line of the file is taken as the password."}, {"names": ["-S", "--sync-only"], "summary": "Safely write all database files to disk and exit. This does not perform any of the normal initdb operations.", "signature": "-S --sync-only", "source_url": "/docs/12/app-initdb.html", "description": "Safely write all database files to disk and exit. This does not perform any of the normal initdb operations."}, {"names": ["-T config", "--text-search-config= config"], "summary": "Sets the default text search configuration. See default_text_search_config for further information.", "signature": "-T config --text-search-config= config", "source_url": "/docs/12/app-initdb.html", "description": "Sets the default text search configuration. See default_text_search_config for further information."}, {"names": ["-U username", "--username= username"], "summary": "Selects the user name of the database superuser. This defaults to the name of the effective user running initdb . It is really not important what the superuser's name is, but one might choose to keep the customary name postgres , even if the operating system user's name is different.", "signature": "-U username --username= username", "source_url": "/docs/12/app-initdb.html", "description": "Selects the user name of the database superuser. This defaults to the name of the effective user running initdb . It is really not important what the superuser's name is, but one might choose to keep the customary name postgres , even if the operating system user's name is different."}, {"names": ["-W", "--pwprompt"], "summary": "Makes initdb prompt for a password to give the database 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": "-W --pwprompt", "source_url": "/docs/12/app-initdb.html", "description": "Makes initdb prompt for a password to give the database 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": ["-X directory", "--waldir= directory"], "summary": "This option specifies the directory where the write-ahead log should be stored.", "signature": "-X directory --waldir= directory", "source_url": "/docs/12/app-initdb.html", "description": "This option specifies the directory where the write-ahead log should be stored."}, {"names": ["--wal-segsize= size"], "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": "--wal-segsize= size", "source_url": "/docs/12/app-initdb.html", "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": ["-d", "--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": "-d --debug", "source_url": "/docs/12/app-initdb.html", "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": ["-L directory"], "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": "-L directory", "source_url": "/docs/12/app-initdb.html", "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": ["-n", "--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": "-n --no-clean", "source_url": "/docs/12/app-initdb.html", "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": ["-V", "--version"], "summary": "Print the initdb version and exit.", "signature": "-V --version", "source_url": "/docs/12/app-initdb.html", "description": "Print the initdb version and exit."}, {"names": ["-?", "--help"], "summary": "Show help about initdb command line arguments, and exit.", "signature": "-? --help", "source_url": "/docs/12/app-initdb.html", "description": "Show help about initdb command line arguments, and exit."}], "related": [], "release": {"ref": "https://ftp.postgresql.org/pub/source/v12.22/postgresql-12.22.tar.bz2", "label": "12.22", "major": "12", "channel": "historical", "manifest": {"pdf": {"A4": {"url": "/files/documentation/pdf/12/postgresql-12-A4.pdf", "bytes": 13424351, "pages": 2803, "sha256": "7422cf53fd1939e7a3d2925231a88b0330e468afa5393627cac0ff86158a0621", "built_at": "2026-09-26"}, "US": {"url": "/files/documentation/pdf/12/postgresql-12-US.pdf", "bytes": 13322565, "pages": 2958, "sha256": "51f3b04e72907fc38512685946223452ea65f84419c60c66241dfa3396035e77", "built_at": "2026-09-26"}}, "tree": "12", "index": "index.html", "major": "12", "pages": 1131, "release": "12.22", "source_url": "https://ftp.postgresql.org/pub/source/v12.22/postgresql-12.22.tar.bz2", "svg_assets": 2, "source_mode": "en HTML verified against the pinned official archive", "source_sha256": "8df3c0474782589d3c6f374b5133b1bd14d168086edbc13c6e72e67dd4527a3b"}, "revision": "7a827e97cbfacd7febff75f34443e2043e40723de5b6d8c9d81a9430b65a37e4", "evidence_kind": "English manual and source declarations", "source_sha256": "8df3c0474782589d3c6f374b5133b1bd14d168086edbc13c6e72e67dd4527a3b"}, "sources": [{"url": "/docs/12/app-initdb.html", "file": "app-initdb.html", "label": "12.22 English manual \u00b7 app-initdb.html", "anchor": "", "sha256": "41958064734e64d5ed7faa266fcb184cd2813b1776f1c4e8901a022cabdc5869"}, {"url": "/docs/12/reference-server.html", "file": "reference-server.html", "label": "Server applications inventory", "anchor": "", "sha256": "7f6ae1fadc1b0bffa606551460e62aacdc2508a3fb66566ddae861928ca6080b"}], "sections": [], "synopsis": ["initdb [ option ...] [ --pgdata | -D ] directory"], "signature": "initdb [ option ...] [ --pgdata | -D ] directory", "description": ["initdb \u2014 create a new PostgreSQL database cluster"], "environment": [{"name": "PGDATA", "description": "Specifies the directory where the database cluster is to be stored; can be overridden using the -D option."}, {"name": "PG_COLOR", "description": "Specifies whether to use color in diagnostic messages. Possible values are always , auto and never ."}, {"name": "TZ", "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 )."}], "manual_html": "<div><div class=\"refentry\" id=\"APP-INITDB\">\n<div class=\"titlepage\"></div>\n<div class=\"refnamediv\">\n<h2><span class=\"refentrytitle\">initdb</span></h2>\n<p>initdb \u2014 create a new <span class=\"productname\">PostgreSQL</span> database cluster</p>\n</div>\n<div class=\"refsynopsisdiv\">\n<h2>Synopsis</h2>\n<div class=\"cmdsynopsis\">\n<p id=\"id-1.9.5.3.4.1\"><code class=\"command\">initdb</code> [<em class=\"replaceable\"><code>option</code></em>...] [ <code class=\"option\">--pgdata</code> | <code class=\"option\">-D</code> ] <em class=\"replaceable\"><code>directory</code></em></p>\n</div>\n</div>\n<div class=\"refsect1\" id=\"R1-APP-INITDB-1\">\n<h2>Description</h2>\n<p><code class=\"command\">initdb</code> creates a new <span class=\"productname\">PostgreSQL</span> database cluster. A database cluster is a collection of databases that are managed by a single server instance.</p>\n<p>Creating a database cluster consists of creating the directories in which the database data will live, generating the shared catalog tables (tables that belong to the whole cluster rather than to any particular database), and creating the <code class=\"literal\">template1</code> and <code class=\"literal\">postgres</code> databases. When you later create a new database, everything in the <code class=\"literal\">template1</code> database is copied. (Therefore, anything installed in <code class=\"literal\">template1</code> is automatically copied into each database created later.) The <code class=\"literal\">postgres</code> database is a default database meant for use by users, utilities and third party applications.</p>\n<p>Although <code class=\"command\">initdb</code> 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 <code class=\"command\">chown</code> to assign ownership of that directory to the database user account, then <code class=\"command\">su</code> to become the database user to run <code class=\"command\">initdb</code>.</p>\n<p><code class=\"command\">initdb</code> 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 <code class=\"command\">initdb</code> creates. Since the server cannot be run as root, you must not run <code class=\"command\">initdb</code> as root either. (It will in fact refuse to do so.)</p>\n<p>For security reasons the new cluster created by <code class=\"command\">initdb</code> will only be accessible by the cluster owner by default. The <code class=\"option\">--allow-group-access</code> 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.</p>\n<p><code class=\"command\">initdb</code> initializes the database cluster's default locale and character set encoding. The character set encoding, collation order (<code class=\"literal\">LC_COLLATE</code>) and character set classes (<code class=\"literal\">LC_CTYPE</code>, e.g., upper, lower, digit) can be set separately for a database when it is created. <code class=\"command\">initdb</code> determines those settings for the <code class=\"literal\">template1</code> database, which will serve as the default for all other databases.</p>\n<p>To alter the default collation order or character set classes, use the <code class=\"option\">--lc-collate</code> and <code class=\"option\">--lc-ctype</code> options. Collation orders other than <code class=\"literal\">C</code> or <code class=\"literal\">POSIX</code> also have a performance penalty. For these reasons it is important to choose the right locale when running <code class=\"command\">initdb</code>.</p>\n<p>The remaining locale categories can be changed later when the server is started. You can also use <code class=\"option\">--locale</code> to set the default for all locale categories, including collation order and character set classes. All server locale values (<code class=\"literal\">lc_*</code>) can be displayed via <code class=\"command\">SHOW ALL</code>. More details can be found in <a class=\"xref\" href=\"/docs/12/locale.html\" title=\"23.1.\u00a0Locale Support\">Section\u00a023.1</a>.</p>\n<p>To alter the default encoding, use the <code class=\"option\">--encoding</code>. More details can be found in <a class=\"xref\" href=\"/docs/12/multibyte.html\" title=\"23.3.\u00a0Character Set Support\">Section\u00a023.3</a>.</p>\n</div>\n<div class=\"refsect1\" id=\"id-1.9.5.3.6\">\n<h2>Options</h2>\n<div class=\"variablelist\">\n<dl class=\"variablelist\">\n<dt><span class=\"term\"><code class=\"option\">-A <em class=\"replaceable\"><code>authmethod</code></em></code><br></span><span class=\"term\"><code class=\"option\">--auth=<em class=\"replaceable\"><code>authmethod</code></em></code></span></dt>\n<dd>\n<p>This option specifies the default authentication method for local users used in <code class=\"filename\">pg_hba.conf</code> (<code class=\"literal\">host</code> and <code class=\"literal\">local</code> lines). <code class=\"command\">initdb</code> will prepopulate <code class=\"filename\">pg_hba.conf</code> entries using the specified authentication method for non-replication as well as replication connections.</p>\n<p>Do not use <code class=\"literal\">trust</code> unless you trust all local users on your system. <code class=\"literal\">trust</code> is the default for ease of installation.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--auth-host=<em class=\"replaceable\"><code>authmethod</code></em></code></span></dt>\n<dd>\n<p>This option specifies the authentication method for local users via TCP/IP connections used in <code class=\"filename\">pg_hba.conf</code> (<code class=\"literal\">host</code> lines).</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--auth-local=<em class=\"replaceable\"><code>authmethod</code></em></code></span></dt>\n<dd>\n<p>This option specifies the authentication method for local users via Unix-domain socket connections used in <code class=\"filename\">pg_hba.conf</code> (<code class=\"literal\">local</code> lines).</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-D <em class=\"replaceable\"><code>directory</code></em></code><br></span><span class=\"term\"><code class=\"option\">--pgdata=<em class=\"replaceable\"><code>directory</code></em></code></span></dt>\n<dd>\n<p>This option specifies the directory where the database cluster should be stored. This is the only information required by <code class=\"command\">initdb</code>, but you can avoid writing it by setting the <code class=\"envar\">PGDATA</code> environment variable, which can be convenient since the database server (<code class=\"command\">postgres</code>) can find the database directory later by the same variable.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-E <em class=\"replaceable\"><code>encoding</code></em></code><br></span><span class=\"term\"><code class=\"option\">--encoding=<em class=\"replaceable\"><code>encoding</code></em></code></span></dt>\n<dd>\n<p>Selects the encoding of the template database. This will also be the default encoding of any database you create later, unless you override it there. The default is derived from the locale, or <code class=\"literal\">SQL_ASCII</code> if that does not work. The character sets supported by the <span class=\"productname\">PostgreSQL</span> server are described in <a class=\"xref\" href=\"/docs/12/multibyte.html#MULTIBYTE-CHARSET-SUPPORTED\" title=\"23.3.1.\u00a0Supported Character Sets\">Section\u00a023.3.1</a>.</p>\n</dd>\n<dt id=\"APP-INITDB-ALLOW-GROUP-ACCESS\"><span class=\"term\"><code class=\"option\">-g</code><br></span><span class=\"term\"><code class=\"option\">--allow-group-access</code></span></dt>\n<dd>\n<p>Allows users in the same group as the cluster owner to read all cluster files created by <code class=\"command\">initdb</code>. This option is ignored on <span class=\"productname\">Windows</span> as it does not support POSIX-style group permissions.</p>\n</dd>\n<dt id=\"APP-INITDB-DATA-CHECKSUMS\"><span class=\"term\"><code class=\"option\">-k</code><br></span><span class=\"term\"><code class=\"option\">--data-checksums</code></span></dt>\n<dd>\n<p>Use checksums on data pages to help detect corruption by the I/O system that would otherwise be silent. Enabling checksums may incur a noticeable performance penalty. If set, checksums are calculated for all objects, in all databases. All checksum failures will be reported in the <a class=\"xref\" href=\"/docs/12/monitoring-stats.html#PG-STAT-DATABASE-VIEW\" title=\"Table\u00a027.12.\u00a0pg_stat_database View\">pg_stat_database</a> view.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--locale=<em class=\"replaceable\"><code>locale</code></em></code></span></dt>\n<dd>\n<p>Sets the default locale for the database cluster. If this option is not specified, the locale is inherited from the environment that <code class=\"command\">initdb</code> runs in. Locale support is described in <a class=\"xref\" href=\"/docs/12/locale.html\" title=\"23.1.\u00a0Locale Support\">Section\u00a023.1</a>.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--lc-collate=<em class=\"replaceable\"><code>locale</code></em></code><br></span><span class=\"term\"><code class=\"option\">--lc-ctype=<em class=\"replaceable\"><code>locale</code></em></code><br></span><span class=\"term\"><code class=\"option\">--lc-messages=<em class=\"replaceable\"><code>locale</code></em></code><br></span><span class=\"term\"><code class=\"option\">--lc-monetary=<em class=\"replaceable\"><code>locale</code></em></code><br></span><span class=\"term\"><code class=\"option\">--lc-numeric=<em class=\"replaceable\"><code>locale</code></em></code><br></span><span class=\"term\"><code class=\"option\">--lc-time=<em class=\"replaceable\"><code>locale</code></em></code></span></dt>\n<dd>\n<p>Like <code class=\"option\">--locale</code>, but only sets the locale in the specified category.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--no-locale</code></span></dt>\n<dd>\n<p>Equivalent to <code class=\"option\">--locale=C</code>.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-N</code><br></span><span class=\"term\"><code class=\"option\">--no-sync</code></span></dt>\n<dd>\n<p>By default, <code class=\"command\">initdb</code> will wait for all files to be written safely to disk. This option causes <code class=\"command\">initdb</code> 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.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--pwfile=<em class=\"replaceable\"><code>filename</code></em></code></span></dt>\n<dd>\n<p>Makes <code class=\"command\">initdb</code> read the database superuser's password from a file. The first line of the file is taken as the password.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-S</code><br></span><span class=\"term\"><code class=\"option\">--sync-only</code></span></dt>\n<dd>\n<p>Safely write all database files to disk and exit. This does not perform any of the normal <span class=\"application\">initdb</span> operations.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-T <em class=\"replaceable\"><code>config</code></em></code><br></span><span class=\"term\"><code class=\"option\">--text-search-config=<em class=\"replaceable\"><code>config</code></em></code></span></dt>\n<dd>\n<p>Sets the default text search configuration. See <a class=\"xref\" href=\"/docs/12/runtime-config-client.html#GUC-DEFAULT-TEXT-SEARCH-CONFIG\">default_text_search_config</a> for further information.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-U <em class=\"replaceable\"><code>username</code></em></code><br></span><span class=\"term\"><code class=\"option\">--username=<em class=\"replaceable\"><code>username</code></em></code></span></dt>\n<dd>\n<p>Selects the user name of the database superuser. This defaults to the name of the effective user running <code class=\"command\">initdb</code>. It is really not important what the superuser's name is, but one might choose to keep the customary name <span class=\"systemitem\">postgres</span>, even if the operating system user's name is different.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-W</code><br></span><span class=\"term\"><code class=\"option\">--pwprompt</code></span></dt>\n<dd>\n<p>Makes <code class=\"command\">initdb</code> prompt for a password to give the database 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.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-X <em class=\"replaceable\"><code>directory</code></em></code><br></span><span class=\"term\"><code class=\"option\">--waldir=<em class=\"replaceable\"><code>directory</code></em></code></span></dt>\n<dd>\n<p>This option specifies the directory where the write-ahead log should be stored.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--wal-segsize=<em class=\"replaceable\"><code>size</code></em></code></span></dt>\n<dd>\n<p>Set the <em class=\"firstterm\">WAL segment size</em>, 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.</p>\n<p>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.</p>\n</dd>\n</dl>\n</div>\n<p>Other, less commonly used, options are also available:</p>\n<div class=\"variablelist\">\n<dl class=\"variablelist\">\n<dt><span class=\"term\"><code class=\"option\">-d</code><br></span><span class=\"term\"><code class=\"option\">--debug</code></span></dt>\n<dd>\n<p>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 <code class=\"command\">initdb</code> uses to create the catalog tables. This option generates a tremendous amount of extremely boring output.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-L <em class=\"replaceable\"><code>directory</code></em></code></span></dt>\n<dd>\n<p>Specifies where <code class=\"command\">initdb</code> 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.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-n</code><br></span><span class=\"term\"><code class=\"option\">--no-clean</code></span></dt>\n<dd>\n<p>By default, when <code class=\"command\">initdb</code> 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.</p>\n</dd>\n</dl>\n</div>\n<p>Other options:</p>\n<div class=\"variablelist\">\n<dl class=\"variablelist\">\n<dt><span class=\"term\"><code class=\"option\">-V</code><br></span><span class=\"term\"><code class=\"option\">--version</code></span></dt>\n<dd>\n<p>Print the <span class=\"application\">initdb</span> version and exit.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-?</code><br></span><span class=\"term\"><code class=\"option\">--help</code></span></dt>\n<dd>\n<p>Show help about <span class=\"application\">initdb</span> command line arguments, and exit.</p>\n</dd>\n</dl>\n</div>\n</div>\n<div class=\"refsect1\" id=\"id-1.9.5.3.7\">\n<h2>Environment</h2>\n<div class=\"variablelist\">\n<dl class=\"variablelist\">\n<dt><span class=\"term\"><code class=\"envar\">PGDATA</code></span></dt>\n<dd>\n<p>Specifies the directory where the database cluster is to be stored; can be overridden using the <code class=\"option\">-D</code> option.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"envar\">PG_COLOR</code></span></dt>\n<dd>\n<p>Specifies whether to use color in diagnostic messages. Possible values are <code class=\"literal\">always</code>, <code class=\"literal\">auto</code> and <code class=\"literal\">never</code>.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"envar\">TZ</code></span></dt>\n<dd>\n<p>Specifies the default time zone of the created database cluster. The value should be a full time zone name (see <a class=\"xref\" href=\"/docs/12/datatype-datetime.html#DATATYPE-TIMEZONES\" title=\"8.5.3.\u00a0Time Zones\">Section\u00a08.5.3</a>).</p>\n</dd>\n</dl>\n</div>\n</div>\n<div class=\"refsect1\" id=\"id-1.9.5.3.8\">\n<h2>Notes</h2>\n<p><code class=\"command\">initdb</code> can also be invoked via <code class=\"command\">pg_ctl initdb</code>.</p>\n</div>\n<div class=\"refsect1\" id=\"id-1.9.5.3.9\">\n<h2>See Also</h2><span class=\"simplelist\"><a class=\"xref\" href=\"/docs/12/app-pg-ctl.html\" title=\"pg_ctl\"><span class=\"refentrytitle\"><span class=\"application\">pg_ctl</span></span></a>, <a class=\"xref\" href=\"/docs/12/app-postgres.html\" title=\"postgres\"><span class=\"refentrytitle\"><span class=\"application\">postgres</span></span></a></span>\n</div>\n</div></div>", "manual_path": "app-initdb.html", "comparison_data": {"options": [{"names": ["-A authmethod", "--auth= authmethod"], "signature": "-A authmethod --auth= authmethod", "description": "This option specifies the default authentication method for local users used in pg_hba.conf ( host and local lines). 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": ["--auth-host= authmethod"], "signature": "--auth-host= authmethod", "description": "This option specifies the authentication method for local users via TCP/IP connections used in pg_hba.conf ( host lines)."}, {"names": ["--auth-local= authmethod"], "signature": "--auth-local= authmethod", "description": "This option specifies the authentication method for local users via Unix-domain socket connections used in pg_hba.conf ( local lines)."}, {"names": ["-D directory", "--pgdata= directory"], "signature": "-D directory --pgdata= directory", "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 database directory later by the same variable."}, {"names": ["-E encoding", "--encoding= encoding"], "signature": "-E encoding --encoding= encoding", "description": "Selects the encoding of the template database. This will also be the default encoding of any database you create later, unless you override it there. The default is derived from the locale, or SQL_ASCII if that does not work. The character sets supported by the PostgreSQL server are described in Section 23.3.1 ."}, {"names": ["-g", "--allow-group-access"], "signature": "-g --allow-group-access", "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": ["-k", "--data-checksums"], "signature": "-k --data-checksums", "description": "Use checksums on data pages to help detect corruption by the I/O system that would otherwise be silent. Enabling checksums may incur a noticeable 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."}, {"names": ["--locale= locale"], "signature": "--locale= locale", "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 ."}, {"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": "Like --locale , but only sets the locale in the specified category."}, {"names": ["--no-locale"], "signature": "--no-locale", "description": "Equivalent to --locale=C ."}, {"names": ["-N", "--no-sync"], "signature": "-N --no-sync", "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": ["--pwfile= filename"], "signature": "--pwfile= filename", "description": "Makes initdb read the database superuser's password from a file. The first line of the file is taken as the password."}, {"names": ["-S", "--sync-only"], "signature": "-S --sync-only", "description": "Safely write all database files to disk and exit. This does not perform any of the normal initdb operations."}, {"names": ["-T config", "--text-search-config= config"], "signature": "-T config --text-search-config= config", "description": "Sets the default text search configuration. See default_text_search_config for further information."}, {"names": ["-U username", "--username= username"], "signature": "-U username --username= username", "description": "Selects the user name of the database superuser. This defaults to the name of the effective user running initdb . It is really not important what the superuser's name is, but one might choose to keep the customary name postgres , even if the operating system user's name is different."}, {"names": ["-W", "--pwprompt"], "signature": "-W --pwprompt", "description": "Makes initdb prompt for a password to give the database 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": ["-X directory", "--waldir= directory"], "signature": "-X directory --waldir= directory", "description": "This option specifies the directory where the write-ahead log should be stored."}, {"names": ["--wal-segsize= size"], "signature": "--wal-segsize= size", "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": ["-d", "--debug"], "signature": "-d --debug", "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": ["-L directory"], "signature": "-L directory", "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": ["-n", "--no-clean"], "signature": "-n --no-clean", "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": ["-V", "--version"], "signature": "-V --version", "description": "Print the initdb version and exit."}, {"names": ["-?", "--help"], "signature": "-? --help", "description": "Show help about initdb command line arguments, and exit."}], "synopsis": ["initdb [ option ...] [ --pgdata | -D ] directory"], "environment": [{"name": "PGDATA", "description": "Specifies the directory where the database cluster is to be stored; can be overridden using the -D option."}, {"name": "PG_COLOR", "description": "Specifies whether to use color in diagnostic messages. Possible values are always , auto and never ."}, {"name": "TZ", "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 )."}]}, "comparison_hash": "fd8378a489ace6c139d4892ed4f5bf64818080be14f06fc480818d295bc39590"}, "13": {"facts": [{"label": "Documented executable", "value": "initdb"}, {"label": "Executable version", "value": "13.23"}, {"label": "Reference inventory", "value": "Server applications"}, {"label": "Option definition groups", "value": "23"}], "tables": [{"key": "options", "rows": [{"summary": "This option specifies the default authentication method for local users used in pg_hba.conf ( host and local lines). initdb will prepopulate pg_hba.conf entries using the specified authentication method for non-replication as well as replication connections.", "signature": {"url": "/docs/13/app-initdb.html", "text": "-A authmethod --auth= authmethod"}}, {"summary": "This option specifies the authentication method for local users via TCP/IP connections used in pg_hba.conf ( host lines).", "signature": {"url": "/docs/13/app-initdb.html", "text": "--auth-host= authmethod"}}, {"summary": "This option specifies the authentication method for local users via Unix-domain socket connections used in pg_hba.conf ( local lines).", "signature": {"url": "/docs/13/app-initdb.html", "text": "--auth-local= authmethod"}}, {"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 database directory later by the same variable.", "signature": {"url": "/docs/13/app-initdb.html", "text": "-D directory --pgdata= directory"}}, {"summary": "Selects the encoding of the template database. This will also be the default encoding of any database you create later, unless you override it there. The default is derived from the locale, or SQL_ASCII if that does not work. The character sets supported by the PostgreSQL server are described in Section 23.3.1 .", "signature": {"url": "/docs/13/app-initdb.html", "text": "-E encoding --encoding= encoding"}}, {"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": {"url": "/docs/13/app-initdb.html#APP-INITDB-ALLOW-GROUP-ACCESS", "text": "-g --allow-group-access"}}, {"summary": "Use checksums on data pages to help detect corruption by the I/O system that would otherwise be silent. Enabling checksums may incur a noticeable 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.", "signature": {"url": "/docs/13/app-initdb.html#APP-INITDB-DATA-CHECKSUMS", "text": "-k --data-checksums"}}, {"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": {"url": "/docs/13/app-initdb.html", "text": "--locale= locale"}}, {"summary": "Like --locale , but only sets the locale in the specified category.", "signature": {"url": "/docs/13/app-initdb.html", "text": "--lc-collate= locale --lc-ctype= locale --lc-messages= locale --lc-monetary= locale --lc-numeric= locale --lc-time= locale"}}, {"summary": "Equivalent to --locale=C .", "signature": {"url": "/docs/13/app-initdb.html", "text": "--no-locale"}}, {"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": {"url": "/docs/13/app-initdb.html", "text": "-N --no-sync"}}, {"summary": "Makes initdb read the database superuser's password from a file. The first line of the file is taken as the password.", "signature": {"url": "/docs/13/app-initdb.html", "text": "--pwfile= filename"}}, {"summary": "Safely write all database files to disk and exit. This does not perform any of the normal initdb operations.", "signature": {"url": "/docs/13/app-initdb.html", "text": "-S --sync-only"}}, {"summary": "Sets the default text search configuration. See default_text_search_config for further information.", "signature": {"url": "/docs/13/app-initdb.html", "text": "-T config --text-search-config= config"}}, {"summary": "Selects the user name of the database superuser. This defaults to the name of the effective user running initdb . It is really not important what the superuser's name is, but one might choose to keep the customary name postgres , even if the operating system user's name is different.", "signature": {"url": "/docs/13/app-initdb.html", "text": "-U username --username= username"}}, {"summary": "Makes initdb prompt for a password to give the database 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": {"url": "/docs/13/app-initdb.html", "text": "-W --pwprompt"}}, {"summary": "This option specifies the directory where the write-ahead log should be stored.", "signature": {"url": "/docs/13/app-initdb.html", "text": "-X directory --waldir= directory"}}, {"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": {"url": "/docs/13/app-initdb.html", "text": "--wal-segsize= size"}}, {"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": {"url": "/docs/13/app-initdb.html", "text": "-d --debug"}}, {"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": {"url": "/docs/13/app-initdb.html", "text": "-L directory"}}, {"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": {"url": "/docs/13/app-initdb.html", "text": "-n --no-clean"}}, {"summary": "Print the initdb version and exit.", "signature": {"url": "/docs/13/app-initdb.html", "text": "-V --version"}}, {"summary": "Show help about initdb command line arguments, and exit.", "signature": {"url": "/docs/13/app-initdb.html", "text": "-? --help"}}], "title": "Documented options", "columns": [{"key": "signature", "label": "Option and arguments"}, {"key": "summary", "label": "Description"}]}, {"key": "environment", "rows": [{"name": "PGDATA", "description": "Specifies the directory where the database cluster is to be stored; can be overridden using the -D option."}, {"name": "PG_COLOR", "description": "Specifies whether to use color in diagnostic messages. Possible values are always , auto and never ."}, {"name": "TZ", "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 )."}], "title": "Environment variables", "columns": [{"key": "name", "label": "Variable"}, {"key": "description", "label": "Meaning"}]}], "options": [{"names": ["-A authmethod", "--auth= authmethod"], "summary": "This option specifies the default authentication method for local users used in pg_hba.conf ( host and local lines). initdb will prepopulate pg_hba.conf entries using the specified authentication method for non-replication as well as replication connections.", "signature": "-A authmethod --auth= authmethod", "source_url": "/docs/13/app-initdb.html", "description": "This option specifies the default authentication method for local users used in pg_hba.conf ( host and local lines). 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": ["--auth-host= authmethod"], "summary": "This option specifies the authentication method for local users via TCP/IP connections used in pg_hba.conf ( host lines).", "signature": "--auth-host= authmethod", "source_url": "/docs/13/app-initdb.html", "description": "This option specifies the authentication method for local users via TCP/IP connections used in pg_hba.conf ( host lines)."}, {"names": ["--auth-local= authmethod"], "summary": "This option specifies the authentication method for local users via Unix-domain socket connections used in pg_hba.conf ( local lines).", "signature": "--auth-local= authmethod", "source_url": "/docs/13/app-initdb.html", "description": "This option specifies the authentication method for local users via Unix-domain socket connections used in pg_hba.conf ( local lines)."}, {"names": ["-D directory", "--pgdata= directory"], "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 database directory later by the same variable.", "signature": "-D directory --pgdata= directory", "source_url": "/docs/13/app-initdb.html", "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 database directory later by the same variable."}, {"names": ["-E encoding", "--encoding= encoding"], "summary": "Selects the encoding of the template database. This will also be the default encoding of any database you create later, unless you override it there. The default is derived from the locale, or SQL_ASCII if that does not work. The character sets supported by the PostgreSQL server are described in Section 23.3.1 .", "signature": "-E encoding --encoding= encoding", "source_url": "/docs/13/app-initdb.html", "description": "Selects the encoding of the template database. This will also be the default encoding of any database you create later, unless you override it there. The default is derived from the locale, or SQL_ASCII if that does not work. The character sets supported by the PostgreSQL server are described in Section 23.3.1 ."}, {"names": ["-g", "--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": "-g --allow-group-access", "source_url": "/docs/13/app-initdb.html#APP-INITDB-ALLOW-GROUP-ACCESS", "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": ["-k", "--data-checksums"], "summary": "Use checksums on data pages to help detect corruption by the I/O system that would otherwise be silent. Enabling checksums may incur a noticeable 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.", "signature": "-k --data-checksums", "source_url": "/docs/13/app-initdb.html#APP-INITDB-DATA-CHECKSUMS", "description": "Use checksums on data pages to help detect corruption by the I/O system that would otherwise be silent. Enabling checksums may incur a noticeable 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."}, {"names": ["--locale= 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": "--locale= locale", "source_url": "/docs/13/app-initdb.html", "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 ."}, {"names": ["--lc-collate= locale", "--lc-ctype= locale", "--lc-messages= locale", "--lc-monetary= locale", "--lc-numeric= locale", "--lc-time= locale"], "summary": "Like --locale , but only sets the locale in the specified category.", "signature": "--lc-collate= locale --lc-ctype= locale --lc-messages= locale --lc-monetary= locale --lc-numeric= locale --lc-time= locale", "source_url": "/docs/13/app-initdb.html", "description": "Like --locale , but only sets the locale in the specified category."}, {"names": ["--no-locale"], "summary": "Equivalent to --locale=C .", "signature": "--no-locale", "source_url": "/docs/13/app-initdb.html", "description": "Equivalent to --locale=C ."}, {"names": ["-N", "--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": "-N --no-sync", "source_url": "/docs/13/app-initdb.html", "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": ["--pwfile= filename"], "summary": "Makes initdb read the database superuser's password from a file. The first line of the file is taken as the password.", "signature": "--pwfile= filename", "source_url": "/docs/13/app-initdb.html", "description": "Makes initdb read the database superuser's password from a file. The first line of the file is taken as the password."}, {"names": ["-S", "--sync-only"], "summary": "Safely write all database files to disk and exit. This does not perform any of the normal initdb operations.", "signature": "-S --sync-only", "source_url": "/docs/13/app-initdb.html", "description": "Safely write all database files to disk and exit. This does not perform any of the normal initdb operations."}, {"names": ["-T config", "--text-search-config= config"], "summary": "Sets the default text search configuration. See default_text_search_config for further information.", "signature": "-T config --text-search-config= config", "source_url": "/docs/13/app-initdb.html", "description": "Sets the default text search configuration. See default_text_search_config for further information."}, {"names": ["-U username", "--username= username"], "summary": "Selects the user name of the database superuser. This defaults to the name of the effective user running initdb . It is really not important what the superuser's name is, but one might choose to keep the customary name postgres , even if the operating system user's name is different.", "signature": "-U username --username= username", "source_url": "/docs/13/app-initdb.html", "description": "Selects the user name of the database superuser. This defaults to the name of the effective user running initdb . It is really not important what the superuser's name is, but one might choose to keep the customary name postgres , even if the operating system user's name is different."}, {"names": ["-W", "--pwprompt"], "summary": "Makes initdb prompt for a password to give the database 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": "-W --pwprompt", "source_url": "/docs/13/app-initdb.html", "description": "Makes initdb prompt for a password to give the database 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": ["-X directory", "--waldir= directory"], "summary": "This option specifies the directory where the write-ahead log should be stored.", "signature": "-X directory --waldir= directory", "source_url": "/docs/13/app-initdb.html", "description": "This option specifies the directory where the write-ahead log should be stored."}, {"names": ["--wal-segsize= size"], "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": "--wal-segsize= size", "source_url": "/docs/13/app-initdb.html", "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": ["-d", "--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": "-d --debug", "source_url": "/docs/13/app-initdb.html", "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": ["-L directory"], "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": "-L directory", "source_url": "/docs/13/app-initdb.html", "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": ["-n", "--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": "-n --no-clean", "source_url": "/docs/13/app-initdb.html", "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": ["-V", "--version"], "summary": "Print the initdb version and exit.", "signature": "-V --version", "source_url": "/docs/13/app-initdb.html", "description": "Print the initdb version and exit."}, {"names": ["-?", "--help"], "summary": "Show help about initdb command line arguments, and exit.", "signature": "-? --help", "source_url": "/docs/13/app-initdb.html", "description": "Show help about initdb command line arguments, and exit."}], "related": [], "release": {"ref": "https://ftp.postgresql.org/pub/source/v13.23/postgresql-13.23.tar.bz2", "label": "13.23", "major": "13", "channel": "historical", "manifest": {"pdf": {"A4": {"url": "/files/documentation/pdf/13/postgresql-13-A4.pdf", "bytes": 13843239, "pages": 2826, "sha256": "171cc09f90936dbc1cbd503a98ff07ae72ea58ab9771ff051313f1217737799c", "built_at": "2026-09-26"}, "US": {"url": "/files/documentation/pdf/13/postgresql-13-US.pdf", "bytes": 13739572, "pages": 2984, "sha256": "48d09c6e197d9db4220f41afe83efe848a8661b1b168d3b89419751ecaf6c24d", "built_at": "2026-09-26"}}, "tree": "13", "index": "index.html", "major": "13", "pages": 1139, "release": "13.23", "source_url": "https://ftp.postgresql.org/pub/source/v13.23/postgresql-13.23.tar.bz2", "svg_assets": 3, "source_mode": "en HTML verified against the pinned official archive", "source_sha256": "6ec3c82726af92b7dec873fa1cdf881eca92a4219787dfad05acb6b10e041fd6"}, "revision": "614ee3133270254e476c118cdf6f72af78d4e4b8bbd9b28ed9ab1e14e4e9c0f6", "evidence_kind": "English manual and source declarations", "source_sha256": "6ec3c82726af92b7dec873fa1cdf881eca92a4219787dfad05acb6b10e041fd6"}, "sources": [{"url": "/docs/13/app-initdb.html", "file": "app-initdb.html", "label": "13.23 English manual \u00b7 app-initdb.html", "anchor": "", "sha256": "4f0926cfb1d27eca883b7a69e33d2d24ffe5ef8b49ec15b2637e9ec5e9664009"}, {"url": "/docs/13/reference-server.html", "file": "reference-server.html", "label": "Server applications inventory", "anchor": "", "sha256": "074ef8577fd368272a2360309e1226e2d0b1e570a3e1da62dfcca63ac9ee5539"}], "sections": [], "synopsis": ["initdb [ option ...] [ --pgdata | -D ] directory"], "signature": "initdb [ option ...] [ --pgdata | -D ] directory", "description": ["initdb \u2014 create a new PostgreSQL database cluster"], "environment": [{"name": "PGDATA", "description": "Specifies the directory where the database cluster is to be stored; can be overridden using the -D option."}, {"name": "PG_COLOR", "description": "Specifies whether to use color in diagnostic messages. Possible values are always , auto and never ."}, {"name": "TZ", "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 )."}], "manual_html": "<div><div class=\"refentry\" id=\"APP-INITDB\">\n<div class=\"titlepage\"></div>\n<div class=\"refnamediv\">\n<h2><span class=\"refentrytitle\">initdb</span></h2>\n<p>initdb \u2014 create a new <span class=\"productname\">PostgreSQL</span> database cluster</p>\n</div>\n<div class=\"refsynopsisdiv\">\n<h2>Synopsis</h2>\n<div class=\"cmdsynopsis\">\n<p id=\"id-1.9.5.3.4.1\"><code class=\"command\">initdb</code> [<em class=\"replaceable\"><code>option</code></em>...] [ <code class=\"option\">--pgdata</code> | <code class=\"option\">-D</code> ] <em class=\"replaceable\"><code>directory</code></em></p>\n</div>\n</div>\n<div class=\"refsect1\" id=\"R1-APP-INITDB-1\">\n<h2>Description</h2>\n<p><code class=\"command\">initdb</code> creates a new <span class=\"productname\">PostgreSQL</span> database cluster. A database cluster is a collection of databases that are managed by a single server instance.</p>\n<p>Creating a database cluster consists of creating the directories in which the database data will live, generating the shared catalog tables (tables that belong to the whole cluster rather than to any particular database), and creating the <code class=\"literal\">template1</code> and <code class=\"literal\">postgres</code> databases. When you later create a new database, everything in the <code class=\"literal\">template1</code> database is copied. (Therefore, anything installed in <code class=\"literal\">template1</code> is automatically copied into each database created later.) The <code class=\"literal\">postgres</code> database is a default database meant for use by users, utilities and third party applications.</p>\n<p>Although <code class=\"command\">initdb</code> 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 <code class=\"command\">chown</code> to assign ownership of that directory to the database user account, then <code class=\"command\">su</code> to become the database user to run <code class=\"command\">initdb</code>.</p>\n<p><code class=\"command\">initdb</code> 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 <code class=\"command\">initdb</code> creates. Since the server cannot be run as root, you must not run <code class=\"command\">initdb</code> as root either. (It will in fact refuse to do so.)</p>\n<p>For security reasons the new cluster created by <code class=\"command\">initdb</code> will only be accessible by the cluster owner by default. The <code class=\"option\">--allow-group-access</code> 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.</p>\n<p><code class=\"command\">initdb</code> initializes the database cluster's default locale and character set encoding. The character set encoding, collation order (<code class=\"literal\">LC_COLLATE</code>) and character set classes (<code class=\"literal\">LC_CTYPE</code>, e.g., upper, lower, digit) can be set separately for a database when it is created. <code class=\"command\">initdb</code> determines those settings for the <code class=\"literal\">template1</code> database, which will serve as the default for all other databases.</p>\n<p>To alter the default collation order or character set classes, use the <code class=\"option\">--lc-collate</code> and <code class=\"option\">--lc-ctype</code> options. Collation orders other than <code class=\"literal\">C</code> or <code class=\"literal\">POSIX</code> also have a performance penalty. For these reasons it is important to choose the right locale when running <code class=\"command\">initdb</code>.</p>\n<p>The remaining locale categories can be changed later when the server is started. You can also use <code class=\"option\">--locale</code> to set the default for all locale categories, including collation order and character set classes. All server locale values (<code class=\"literal\">lc_*</code>) can be displayed via <code class=\"command\">SHOW ALL</code>. More details can be found in <a class=\"xref\" href=\"/docs/13/locale.html\" title=\"23.1.\u00a0Locale Support\">Section\u00a023.1</a>.</p>\n<p>To alter the default encoding, use the <code class=\"option\">--encoding</code>. More details can be found in <a class=\"xref\" href=\"/docs/13/multibyte.html\" title=\"23.3.\u00a0Character Set Support\">Section\u00a023.3</a>.</p>\n</div>\n<div class=\"refsect1\" id=\"id-1.9.5.3.6\">\n<h2>Options</h2>\n<div class=\"variablelist\">\n<dl class=\"variablelist\">\n<dt><span class=\"term\"><code class=\"option\">-A <em class=\"replaceable\"><code>authmethod</code></em></code><br></span><span class=\"term\"><code class=\"option\">--auth=<em class=\"replaceable\"><code>authmethod</code></em></code></span></dt>\n<dd>\n<p>This option specifies the default authentication method for local users used in <code class=\"filename\">pg_hba.conf</code> (<code class=\"literal\">host</code> and <code class=\"literal\">local</code> lines). <code class=\"command\">initdb</code> will prepopulate <code class=\"filename\">pg_hba.conf</code> entries using the specified authentication method for non-replication as well as replication connections.</p>\n<p>Do not use <code class=\"literal\">trust</code> unless you trust all local users on your system. <code class=\"literal\">trust</code> is the default for ease of installation.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--auth-host=<em class=\"replaceable\"><code>authmethod</code></em></code></span></dt>\n<dd>\n<p>This option specifies the authentication method for local users via TCP/IP connections used in <code class=\"filename\">pg_hba.conf</code> (<code class=\"literal\">host</code> lines).</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--auth-local=<em class=\"replaceable\"><code>authmethod</code></em></code></span></dt>\n<dd>\n<p>This option specifies the authentication method for local users via Unix-domain socket connections used in <code class=\"filename\">pg_hba.conf</code> (<code class=\"literal\">local</code> lines).</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-D <em class=\"replaceable\"><code>directory</code></em></code><br></span><span class=\"term\"><code class=\"option\">--pgdata=<em class=\"replaceable\"><code>directory</code></em></code></span></dt>\n<dd>\n<p>This option specifies the directory where the database cluster should be stored. This is the only information required by <code class=\"command\">initdb</code>, but you can avoid writing it by setting the <code class=\"envar\">PGDATA</code> environment variable, which can be convenient since the database server (<code class=\"command\">postgres</code>) can find the database directory later by the same variable.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-E <em class=\"replaceable\"><code>encoding</code></em></code><br></span><span class=\"term\"><code class=\"option\">--encoding=<em class=\"replaceable\"><code>encoding</code></em></code></span></dt>\n<dd>\n<p>Selects the encoding of the template database. This will also be the default encoding of any database you create later, unless you override it there. The default is derived from the locale, or <code class=\"literal\">SQL_ASCII</code> if that does not work. The character sets supported by the <span class=\"productname\">PostgreSQL</span> server are described in <a class=\"xref\" href=\"/docs/13/multibyte.html#MULTIBYTE-CHARSET-SUPPORTED\" title=\"23.3.1.\u00a0Supported Character Sets\">Section\u00a023.3.1</a>.</p>\n</dd>\n<dt id=\"APP-INITDB-ALLOW-GROUP-ACCESS\"><span class=\"term\"><code class=\"option\">-g</code><br></span><span class=\"term\"><code class=\"option\">--allow-group-access</code></span></dt>\n<dd>\n<p>Allows users in the same group as the cluster owner to read all cluster files created by <code class=\"command\">initdb</code>. This option is ignored on <span class=\"productname\">Windows</span> as it does not support POSIX-style group permissions.</p>\n</dd>\n<dt id=\"APP-INITDB-DATA-CHECKSUMS\"><span class=\"term\"><code class=\"option\">-k</code><br></span><span class=\"term\"><code class=\"option\">--data-checksums</code></span></dt>\n<dd>\n<p>Use checksums on data pages to help detect corruption by the I/O system that would otherwise be silent. Enabling checksums may incur a noticeable performance penalty. If set, checksums are calculated for all objects, in all databases. All checksum failures will be reported in the <a class=\"link\" href=\"/docs/13/monitoring-stats.html#MONITORING-PG-STAT-DATABASE-VIEW\" title=\"27.2.11.\u00a0pg_stat_database\"><code class=\"structname\">pg_stat_database</code></a> view.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--locale=<em class=\"replaceable\"><code>locale</code></em></code></span></dt>\n<dd>\n<p>Sets the default locale for the database cluster. If this option is not specified, the locale is inherited from the environment that <code class=\"command\">initdb</code> runs in. Locale support is described in <a class=\"xref\" href=\"/docs/13/locale.html\" title=\"23.1.\u00a0Locale Support\">Section\u00a023.1</a>.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--lc-collate=<em class=\"replaceable\"><code>locale</code></em></code><br></span><span class=\"term\"><code class=\"option\">--lc-ctype=<em class=\"replaceable\"><code>locale</code></em></code><br></span><span class=\"term\"><code class=\"option\">--lc-messages=<em class=\"replaceable\"><code>locale</code></em></code><br></span><span class=\"term\"><code class=\"option\">--lc-monetary=<em class=\"replaceable\"><code>locale</code></em></code><br></span><span class=\"term\"><code class=\"option\">--lc-numeric=<em class=\"replaceable\"><code>locale</code></em></code><br></span><span class=\"term\"><code class=\"option\">--lc-time=<em class=\"replaceable\"><code>locale</code></em></code></span></dt>\n<dd>\n<p>Like <code class=\"option\">--locale</code>, but only sets the locale in the specified category.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--no-locale</code></span></dt>\n<dd>\n<p>Equivalent to <code class=\"option\">--locale=C</code>.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-N</code><br></span><span class=\"term\"><code class=\"option\">--no-sync</code></span></dt>\n<dd>\n<p>By default, <code class=\"command\">initdb</code> will wait for all files to be written safely to disk. This option causes <code class=\"command\">initdb</code> 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.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--pwfile=<em class=\"replaceable\"><code>filename</code></em></code></span></dt>\n<dd>\n<p>Makes <code class=\"command\">initdb</code> read the database superuser's password from a file. The first line of the file is taken as the password.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-S</code><br></span><span class=\"term\"><code class=\"option\">--sync-only</code></span></dt>\n<dd>\n<p>Safely write all database files to disk and exit. This does not perform any of the normal <span class=\"application\">initdb</span> operations.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-T <em class=\"replaceable\"><code>config</code></em></code><br></span><span class=\"term\"><code class=\"option\">--text-search-config=<em class=\"replaceable\"><code>config</code></em></code></span></dt>\n<dd>\n<p>Sets the default text search configuration. See <a class=\"xref\" href=\"/docs/13/runtime-config-client.html#GUC-DEFAULT-TEXT-SEARCH-CONFIG\">default_text_search_config</a> for further information.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-U <em class=\"replaceable\"><code>username</code></em></code><br></span><span class=\"term\"><code class=\"option\">--username=<em class=\"replaceable\"><code>username</code></em></code></span></dt>\n<dd>\n<p>Selects the user name of the database superuser. This defaults to the name of the effective user running <code class=\"command\">initdb</code>. It is really not important what the superuser's name is, but one might choose to keep the customary name <span class=\"systemitem\">postgres</span>, even if the operating system user's name is different.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-W</code><br></span><span class=\"term\"><code class=\"option\">--pwprompt</code></span></dt>\n<dd>\n<p>Makes <code class=\"command\">initdb</code> prompt for a password to give the database 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.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-X <em class=\"replaceable\"><code>directory</code></em></code><br></span><span class=\"term\"><code class=\"option\">--waldir=<em class=\"replaceable\"><code>directory</code></em></code></span></dt>\n<dd>\n<p>This option specifies the directory where the write-ahead log should be stored.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--wal-segsize=<em class=\"replaceable\"><code>size</code></em></code></span></dt>\n<dd>\n<p>Set the <em class=\"firstterm\">WAL segment size</em>, 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.</p>\n<p>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.</p>\n</dd>\n</dl>\n</div>\n<p>Other, less commonly used, options are also available:</p>\n<div class=\"variablelist\">\n<dl class=\"variablelist\">\n<dt><span class=\"term\"><code class=\"option\">-d</code><br></span><span class=\"term\"><code class=\"option\">--debug</code></span></dt>\n<dd>\n<p>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 <code class=\"command\">initdb</code> uses to create the catalog tables. This option generates a tremendous amount of extremely boring output.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-L <em class=\"replaceable\"><code>directory</code></em></code></span></dt>\n<dd>\n<p>Specifies where <code class=\"command\">initdb</code> 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.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-n</code><br></span><span class=\"term\"><code class=\"option\">--no-clean</code></span></dt>\n<dd>\n<p>By default, when <code class=\"command\">initdb</code> 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.</p>\n</dd>\n</dl>\n</div>\n<p>Other options:</p>\n<div class=\"variablelist\">\n<dl class=\"variablelist\">\n<dt><span class=\"term\"><code class=\"option\">-V</code><br></span><span class=\"term\"><code class=\"option\">--version</code></span></dt>\n<dd>\n<p>Print the <span class=\"application\">initdb</span> version and exit.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-?</code><br></span><span class=\"term\"><code class=\"option\">--help</code></span></dt>\n<dd>\n<p>Show help about <span class=\"application\">initdb</span> command line arguments, and exit.</p>\n</dd>\n</dl>\n</div>\n</div>\n<div class=\"refsect1\" id=\"id-1.9.5.3.7\">\n<h2>Environment</h2>\n<div class=\"variablelist\">\n<dl class=\"variablelist\">\n<dt><span class=\"term\"><code class=\"envar\">PGDATA</code></span></dt>\n<dd>\n<p>Specifies the directory where the database cluster is to be stored; can be overridden using the <code class=\"option\">-D</code> option.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"envar\">PG_COLOR</code></span></dt>\n<dd>\n<p>Specifies whether to use color in diagnostic messages. Possible values are <code class=\"literal\">always</code>, <code class=\"literal\">auto</code> and <code class=\"literal\">never</code>.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"envar\">TZ</code></span></dt>\n<dd>\n<p>Specifies the default time zone of the created database cluster. The value should be a full time zone name (see <a class=\"xref\" href=\"/docs/13/datatype-datetime.html#DATATYPE-TIMEZONES\" title=\"8.5.3.\u00a0Time Zones\">Section\u00a08.5.3</a>).</p>\n</dd>\n</dl>\n</div>\n</div>\n<div class=\"refsect1\" id=\"id-1.9.5.3.8\">\n<h2>Notes</h2>\n<p><code class=\"command\">initdb</code> can also be invoked via <code class=\"command\">pg_ctl initdb</code>.</p>\n</div>\n<div class=\"refsect1\" id=\"id-1.9.5.3.9\">\n<h2>See Also</h2><span class=\"simplelist\"><a class=\"xref\" href=\"/docs/13/app-pg-ctl.html\" title=\"pg_ctl\"><span class=\"refentrytitle\"><span class=\"application\">pg_ctl</span></span></a>, <a class=\"xref\" href=\"/docs/13/app-postgres.html\" title=\"postgres\"><span class=\"refentrytitle\"><span class=\"application\">postgres</span></span></a></span>\n</div>\n</div></div>", "manual_path": "app-initdb.html", "comparison_data": {"options": [{"names": ["-A authmethod", "--auth= authmethod"], "signature": "-A authmethod --auth= authmethod", "description": "This option specifies the default authentication method for local users used in pg_hba.conf ( host and local lines). 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": ["--auth-host= authmethod"], "signature": "--auth-host= authmethod", "description": "This option specifies the authentication method for local users via TCP/IP connections used in pg_hba.conf ( host lines)."}, {"names": ["--auth-local= authmethod"], "signature": "--auth-local= authmethod", "description": "This option specifies the authentication method for local users via Unix-domain socket connections used in pg_hba.conf ( local lines)."}, {"names": ["-D directory", "--pgdata= directory"], "signature": "-D directory --pgdata= directory", "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 database directory later by the same variable."}, {"names": ["-E encoding", "--encoding= encoding"], "signature": "-E encoding --encoding= encoding", "description": "Selects the encoding of the template database. This will also be the default encoding of any database you create later, unless you override it there. The default is derived from the locale, or SQL_ASCII if that does not work. The character sets supported by the PostgreSQL server are described in Section 23.3.1 ."}, {"names": ["-g", "--allow-group-access"], "signature": "-g --allow-group-access", "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": ["-k", "--data-checksums"], "signature": "-k --data-checksums", "description": "Use checksums on data pages to help detect corruption by the I/O system that would otherwise be silent. Enabling checksums may incur a noticeable 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."}, {"names": ["--locale= locale"], "signature": "--locale= locale", "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 ."}, {"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": "Like --locale , but only sets the locale in the specified category."}, {"names": ["--no-locale"], "signature": "--no-locale", "description": "Equivalent to --locale=C ."}, {"names": ["-N", "--no-sync"], "signature": "-N --no-sync", "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": ["--pwfile= filename"], "signature": "--pwfile= filename", "description": "Makes initdb read the database superuser's password from a file. The first line of the file is taken as the password."}, {"names": ["-S", "--sync-only"], "signature": "-S --sync-only", "description": "Safely write all database files to disk and exit. This does not perform any of the normal initdb operations."}, {"names": ["-T config", "--text-search-config= config"], "signature": "-T config --text-search-config= config", "description": "Sets the default text search configuration. See default_text_search_config for further information."}, {"names": ["-U username", "--username= username"], "signature": "-U username --username= username", "description": "Selects the user name of the database superuser. This defaults to the name of the effective user running initdb . It is really not important what the superuser's name is, but one might choose to keep the customary name postgres , even if the operating system user's name is different."}, {"names": ["-W", "--pwprompt"], "signature": "-W --pwprompt", "description": "Makes initdb prompt for a password to give the database 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": ["-X directory", "--waldir= directory"], "signature": "-X directory --waldir= directory", "description": "This option specifies the directory where the write-ahead log should be stored."}, {"names": ["--wal-segsize= size"], "signature": "--wal-segsize= size", "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": ["-d", "--debug"], "signature": "-d --debug", "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": ["-L directory"], "signature": "-L directory", "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": ["-n", "--no-clean"], "signature": "-n --no-clean", "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": ["-V", "--version"], "signature": "-V --version", "description": "Print the initdb version and exit."}, {"names": ["-?", "--help"], "signature": "-? --help", "description": "Show help about initdb command line arguments, and exit."}], "synopsis": ["initdb [ option ...] [ --pgdata | -D ] directory"], "environment": [{"name": "PGDATA", "description": "Specifies the directory where the database cluster is to be stored; can be overridden using the -D option."}, {"name": "PG_COLOR", "description": "Specifies whether to use color in diagnostic messages. Possible values are always , auto and never ."}, {"name": "TZ", "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 )."}]}, "comparison_hash": "fd8378a489ace6c139d4892ed4f5bf64818080be14f06fc480818d295bc39590"}, "14": {"facts": [{"label": "Documented executable", "value": "initdb"}, {"label": "Executable version", "value": "14.24"}, {"label": "Reference inventory", "value": "Server applications"}, {"label": "Option definition groups", "value": "25"}], "tables": [{"key": "options", "rows": [{"summary": "This option specifies the default authentication method for local users used in pg_hba.conf ( host and local lines). initdb will prepopulate pg_hba.conf entries using the specified authentication method for non-replication as well as replication connections.", "signature": {"url": "/docs/14/app-initdb.html", "text": "-A authmethod --auth= authmethod"}}, {"summary": "This option specifies the authentication method for local users via TCP/IP connections used in pg_hba.conf ( host lines).", "signature": {"url": "/docs/14/app-initdb.html", "text": "--auth-host= authmethod"}}, {"summary": "This option specifies the authentication method for local users via Unix-domain socket connections used in pg_hba.conf ( local lines).", "signature": {"url": "/docs/14/app-initdb.html", "text": "--auth-local= authmethod"}}, {"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 database directory later by the same variable.", "signature": {"url": "/docs/14/app-initdb.html", "text": "-D directory --pgdata= directory"}}, {"summary": "Selects the encoding of the template database. This will also be the default encoding of any database you create later, unless you override it there. The default is derived from the locale, or SQL_ASCII if that does not work. The character sets supported by the PostgreSQL server are described in Section 24.3.1 .", "signature": {"url": "/docs/14/app-initdb.html", "text": "-E encoding --encoding= encoding"}}, {"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": {"url": "/docs/14/app-initdb.html#APP-INITDB-ALLOW-GROUP-ACCESS", "text": "-g --allow-group-access"}}, {"summary": "Use checksums on data pages to help detect corruption by the I/O system that would otherwise be silent. Enabling checksums may incur a noticeable 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 30.2 for details.", "signature": {"url": "/docs/14/app-initdb.html#APP-INITDB-DATA-CHECKSUMS", "text": "-k --data-checksums"}}, {"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 24.1 .", "signature": {"url": "/docs/14/app-initdb.html", "text": "--locale= locale"}}, {"summary": "Like --locale , but only sets the locale in the specified category.", "signature": {"url": "/docs/14/app-initdb.html", "text": "--lc-collate= locale --lc-ctype= locale --lc-messages= locale --lc-monetary= locale --lc-numeric= locale --lc-time= locale"}}, {"summary": "Equivalent to --locale=C .", "signature": {"url": "/docs/14/app-initdb.html", "text": "--no-locale"}}, {"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": {"url": "/docs/14/app-initdb.html", "text": "-N --no-sync"}}, {"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": {"url": "/docs/14/app-initdb.html", "text": "--no-instructions"}}, {"summary": "Makes initdb read the database superuser's password from a file. The first line of the file is taken as the password.", "signature": {"url": "/docs/14/app-initdb.html", "text": "--pwfile= filename"}}, {"summary": "Safely write all database files to disk and exit. This does not perform any of the normal initdb operations.", "signature": {"url": "/docs/14/app-initdb.html", "text": "-S --sync-only"}}, {"summary": "Sets the default text search configuration. See default_text_search_config for further information.", "signature": {"url": "/docs/14/app-initdb.html", "text": "-T config --text-search-config= config"}}, {"summary": "Selects the user name of the database superuser. This defaults to the name of the effective user running initdb . It is really not important what the superuser's name is, but one might choose to keep the customary name postgres , even if the operating system user's name is different.", "signature": {"url": "/docs/14/app-initdb.html", "text": "-U username --username= username"}}, {"summary": "Makes initdb prompt for a password to give the database 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": {"url": "/docs/14/app-initdb.html", "text": "-W --pwprompt"}}, {"summary": "This option specifies the directory where the write-ahead log should be stored.", "signature": {"url": "/docs/14/app-initdb.html", "text": "-X directory --waldir= directory"}}, {"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": {"url": "/docs/14/app-initdb.html", "text": "--wal-segsize= size"}}, {"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": {"url": "/docs/14/app-initdb.html", "text": "-d --debug"}}, {"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": {"url": "/docs/14/app-initdb.html", "text": "--discard-caches"}}, {"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": {"url": "/docs/14/app-initdb.html", "text": "-L directory"}}, {"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": {"url": "/docs/14/app-initdb.html", "text": "-n --no-clean"}}, {"summary": "Print the initdb version and exit.", "signature": {"url": "/docs/14/app-initdb.html", "text": "-V --version"}}, {"summary": "Show help about initdb command line arguments, and exit.", "signature": {"url": "/docs/14/app-initdb.html", "text": "-? --help"}}], "title": "Documented options", "columns": [{"key": "signature", "label": "Option and arguments"}, {"key": "summary", "label": "Description"}]}, {"key": "environment", "rows": [{"name": "PGDATA", "description": "Specifies the directory where the database cluster is to be stored; can be overridden using the -D option."}, {"name": "PG_COLOR", "description": "Specifies whether to use color in diagnostic messages. Possible values are always , auto and never ."}, {"name": "TZ", "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 )."}], "title": "Environment variables", "columns": [{"key": "name", "label": "Variable"}, {"key": "description", "label": "Meaning"}]}], "options": [{"names": ["-A authmethod", "--auth= authmethod"], "summary": "This option specifies the default authentication method for local users used in pg_hba.conf ( host and local lines). initdb will prepopulate pg_hba.conf entries using the specified authentication method for non-replication as well as replication connections.", "signature": "-A authmethod --auth= authmethod", "source_url": "/docs/14/app-initdb.html", "description": "This option specifies the default authentication method for local users used in pg_hba.conf ( host and local lines). 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": ["--auth-host= authmethod"], "summary": "This option specifies the authentication method for local users via TCP/IP connections used in pg_hba.conf ( host lines).", "signature": "--auth-host= authmethod", "source_url": "/docs/14/app-initdb.html", "description": "This option specifies the authentication method for local users via TCP/IP connections used in pg_hba.conf ( host lines)."}, {"names": ["--auth-local= authmethod"], "summary": "This option specifies the authentication method for local users via Unix-domain socket connections used in pg_hba.conf ( local lines).", "signature": "--auth-local= authmethod", "source_url": "/docs/14/app-initdb.html", "description": "This option specifies the authentication method for local users via Unix-domain socket connections used in pg_hba.conf ( local lines)."}, {"names": ["-D directory", "--pgdata= directory"], "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 database directory later by the same variable.", "signature": "-D directory --pgdata= directory", "source_url": "/docs/14/app-initdb.html", "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 database directory later by the same variable."}, {"names": ["-E encoding", "--encoding= encoding"], "summary": "Selects the encoding of the template database. This will also be the default encoding of any database you create later, unless you override it there. The default is derived from the locale, or SQL_ASCII if that does not work. The character sets supported by the PostgreSQL server are described in Section 24.3.1 .", "signature": "-E encoding --encoding= encoding", "source_url": "/docs/14/app-initdb.html", "description": "Selects the encoding of the template database. This will also be the default encoding of any database you create later, unless you override it there. The default is derived from the locale, or SQL_ASCII if that does not work. The character sets supported by the PostgreSQL server are described in Section 24.3.1 ."}, {"names": ["-g", "--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": "-g --allow-group-access", "source_url": "/docs/14/app-initdb.html#APP-INITDB-ALLOW-GROUP-ACCESS", "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": ["-k", "--data-checksums"], "summary": "Use checksums on data pages to help detect corruption by the I/O system that would otherwise be silent. Enabling checksums may incur a noticeable 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 30.2 for details.", "signature": "-k --data-checksums", "source_url": "/docs/14/app-initdb.html#APP-INITDB-DATA-CHECKSUMS", "description": "Use checksums on data pages to help detect corruption by the I/O system that would otherwise be silent. Enabling checksums may incur a noticeable 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 30.2 for details."}, {"names": ["--locale= 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 24.1 .", "signature": "--locale= locale", "source_url": "/docs/14/app-initdb.html", "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 24.1 ."}, {"names": ["--lc-collate= locale", "--lc-ctype= locale", "--lc-messages= locale", "--lc-monetary= locale", "--lc-numeric= locale", "--lc-time= locale"], "summary": "Like --locale , but only sets the locale in the specified category.", "signature": "--lc-collate= locale --lc-ctype= locale --lc-messages= locale --lc-monetary= locale --lc-numeric= locale --lc-time= locale", "source_url": "/docs/14/app-initdb.html", "description": "Like --locale , but only sets the locale in the specified category."}, {"names": ["--no-locale"], "summary": "Equivalent to --locale=C .", "signature": "--no-locale", "source_url": "/docs/14/app-initdb.html", "description": "Equivalent to --locale=C ."}, {"names": ["-N", "--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": "-N --no-sync", "source_url": "/docs/14/app-initdb.html", "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": ["--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": "--no-instructions", "source_url": "/docs/14/app-initdb.html", "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": ["--pwfile= filename"], "summary": "Makes initdb read the database superuser's password from a file. The first line of the file is taken as the password.", "signature": "--pwfile= filename", "source_url": "/docs/14/app-initdb.html", "description": "Makes initdb read the database superuser's password from a file. The first line of the file is taken as the password."}, {"names": ["-S", "--sync-only"], "summary": "Safely write all database files to disk and exit. This does not perform any of the normal initdb operations.", "signature": "-S --sync-only", "source_url": "/docs/14/app-initdb.html", "description": "Safely write all database files to disk and exit. This does not perform any of the normal initdb operations."}, {"names": ["-T config", "--text-search-config= config"], "summary": "Sets the default text search configuration. See default_text_search_config for further information.", "signature": "-T config --text-search-config= config", "source_url": "/docs/14/app-initdb.html", "description": "Sets the default text search configuration. See default_text_search_config for further information."}, {"names": ["-U username", "--username= username"], "summary": "Selects the user name of the database superuser. This defaults to the name of the effective user running initdb . It is really not important what the superuser's name is, but one might choose to keep the customary name postgres , even if the operating system user's name is different.", "signature": "-U username --username= username", "source_url": "/docs/14/app-initdb.html", "description": "Selects the user name of the database superuser. This defaults to the name of the effective user running initdb . It is really not important what the superuser's name is, but one might choose to keep the customary name postgres , even if the operating system user's name is different."}, {"names": ["-W", "--pwprompt"], "summary": "Makes initdb prompt for a password to give the database 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": "-W --pwprompt", "source_url": "/docs/14/app-initdb.html", "description": "Makes initdb prompt for a password to give the database 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": ["-X directory", "--waldir= directory"], "summary": "This option specifies the directory where the write-ahead log should be stored.", "signature": "-X directory --waldir= directory", "source_url": "/docs/14/app-initdb.html", "description": "This option specifies the directory where the write-ahead log should be stored."}, {"names": ["--wal-segsize= size"], "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": "--wal-segsize= size", "source_url": "/docs/14/app-initdb.html", "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": ["-d", "--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": "-d --debug", "source_url": "/docs/14/app-initdb.html", "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": ["--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": "--discard-caches", "source_url": "/docs/14/app-initdb.html", "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": ["-L directory"], "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": "-L directory", "source_url": "/docs/14/app-initdb.html", "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": ["-n", "--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": "-n --no-clean", "source_url": "/docs/14/app-initdb.html", "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": ["-V", "--version"], "summary": "Print the initdb version and exit.", "signature": "-V --version", "source_url": "/docs/14/app-initdb.html", "description": "Print the initdb version and exit."}, {"names": ["-?", "--help"], "summary": "Show help about initdb command line arguments, and exit.", "signature": "-? --help", "source_url": "/docs/14/app-initdb.html", "description": "Show help about initdb command line arguments, and exit."}], "related": [], "release": {"ref": "https://ftp.postgresql.org/pub/source/v14.24/postgresql-14.24.tar.bz2", "label": "14.24", "major": "14", "channel": "stable", "manifest": {"pdf": {"A4": {"url": "/files/documentation/pdf/14/postgresql-14-A4.pdf", "bytes": 14354704, "pages": 2944, "sha256": "8bc6b9dd7b246888bb77f0a5e8c39a2eae52e9926569832669c7d1600becb27c", "built_at": "2026-09-26"}, "US": {"url": "/files/documentation/pdf/14/postgresql-14-US.pdf", "bytes": 14242178, "pages": 3102, "sha256": "b7ecb5a5f62d8b9f73a69e25a7d26ba285373bc53168a553bff7b77955506db4", "built_at": "2026-09-26"}}, "tree": "14", "index": "index.html", "major": "14", "pages": 1158, "release": "14.24", "source_url": "https://ftp.postgresql.org/pub/source/v14.24/postgresql-14.24.tar.bz2", "svg_assets": 3, "source_mode": "en HTML verified against the pinned official archive", "source_sha256": "a7fa7ed3d558172355f51406097a7bd4f6b473be80f311ef7cda96bf383d8897"}, "revision": "588700d46356d8837c77c7c0a4e71e645fe6535983b8f1830aa8f2e4e41c40ae", "evidence_kind": "English manual and source declarations", "source_sha256": "a7fa7ed3d558172355f51406097a7bd4f6b473be80f311ef7cda96bf383d8897"}, "sources": [{"url": "/docs/14/app-initdb.html", "file": "app-initdb.html", "label": "14.24 English manual \u00b7 app-initdb.html", "anchor": "", "sha256": "121b9021b6a64ab299a3be4821e567065afd5aca067bb7ed1bfd605913f3d2be"}, {"url": "/docs/14/reference-server.html", "file": "reference-server.html", "label": "Server applications inventory", "anchor": "", "sha256": "db0cdccaa8d3c65ad3b2a07d4956eb5a783a18505bfa0f9d9626eef4ab94fe44"}], "sections": [], "synopsis": ["initdb [ option ...] [ --pgdata | -D ] directory"], "signature": "initdb [ option ...] [ --pgdata | -D ] directory", "description": ["initdb \u2014 create a new PostgreSQL database cluster"], "environment": [{"name": "PGDATA", "description": "Specifies the directory where the database cluster is to be stored; can be overridden using the -D option."}, {"name": "PG_COLOR", "description": "Specifies whether to use color in diagnostic messages. Possible values are always , auto and never ."}, {"name": "TZ", "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 )."}], "manual_html": "<div><div class=\"refentry\" id=\"APP-INITDB\">\n<div class=\"titlepage\"></div>\n<div class=\"refnamediv\">\n<h2><span class=\"refentrytitle\"><span class=\"application\">initdb</span></span></h2>\n<p>initdb \u2014 create a new <span class=\"productname\">PostgreSQL</span> database cluster</p>\n</div>\n<div class=\"refsynopsisdiv\">\n<h2>Synopsis</h2>\n<div class=\"cmdsynopsis\">\n<p id=\"id-1.9.5.3.4.1\"><code class=\"command\">initdb</code> [<em class=\"replaceable\"><code>option</code></em>...] [ <code class=\"option\">--pgdata</code> | <code class=\"option\">-D</code> ] <em class=\"replaceable\"><code>directory</code></em></p>\n</div>\n</div>\n<div class=\"refsect1\" id=\"R1-APP-INITDB-1\">\n<h2>Description</h2>\n<p><code class=\"command\">initdb</code> creates a new <span class=\"productname\">PostgreSQL</span> database cluster. A database cluster is a collection of databases that are managed by a single server instance.</p>\n<p>Creating a database cluster consists of creating the directories in which the database data will live, generating the shared catalog tables (tables that belong to the whole cluster rather than to any particular database), and creating the <code class=\"literal\">template1</code> and <code class=\"literal\">postgres</code> databases. When you later create a new database, everything in the <code class=\"literal\">template1</code> database is copied. (Therefore, anything installed in <code class=\"literal\">template1</code> is automatically copied into each database created later.) The <code class=\"literal\">postgres</code> database is a default database meant for use by users, utilities and third party applications.</p>\n<p>Although <code class=\"command\">initdb</code> 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 <code class=\"command\">chown</code> to assign ownership of that directory to the database user account, then <code class=\"command\">su</code> to become the database user to run <code class=\"command\">initdb</code>.</p>\n<p><code class=\"command\">initdb</code> 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 <code class=\"command\">initdb</code> creates. Since the server cannot be run as root, you must not run <code class=\"command\">initdb</code> as root either. (It will in fact refuse to do so.)</p>\n<p>For security reasons the new cluster created by <code class=\"command\">initdb</code> will only be accessible by the cluster owner by default. The <code class=\"option\">--allow-group-access</code> 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.</p>\n<p><code class=\"command\">initdb</code> initializes the database cluster's default locale and character set encoding. The character set encoding, collation order (<code class=\"literal\">LC_COLLATE</code>) and character set classes (<code class=\"literal\">LC_CTYPE</code>, e.g., upper, lower, digit) can be set separately for a database when it is created. <code class=\"command\">initdb</code> determines those settings for the <code class=\"literal\">template1</code> database, which will serve as the default for all other databases.</p>\n<p>To alter the default collation order or character set classes, use the <code class=\"option\">--lc-collate</code> and <code class=\"option\">--lc-ctype</code> options. Collation orders other than <code class=\"literal\">C</code> or <code class=\"literal\">POSIX</code> also have a performance penalty. For these reasons it is important to choose the right locale when running <code class=\"command\">initdb</code>.</p>\n<p>The remaining locale categories can be changed later when the server is started. You can also use <code class=\"option\">--locale</code> to set the default for all locale categories, including collation order and character set classes. All server locale values (<code class=\"literal\">lc_*</code>) can be displayed via <code class=\"command\">SHOW ALL</code>. More details can be found in <a class=\"xref\" href=\"/docs/14/locale.html\" title=\"24.1.\u00a0Locale Support\">Section\u00a024.1</a>.</p>\n<p>To alter the default encoding, use the <code class=\"option\">--encoding</code>. More details can be found in <a class=\"xref\" href=\"/docs/14/multibyte.html\" title=\"24.3.\u00a0Character Set Support\">Section\u00a024.3</a>.</p>\n</div>\n<div class=\"refsect1\" id=\"id-1.9.5.3.6\">\n<h2>Options</h2>\n<div class=\"variablelist\">\n<dl class=\"variablelist\">\n<dt><span class=\"term\"><code class=\"option\">-A <em class=\"replaceable\"><code>authmethod</code></em></code><br></span><span class=\"term\"><code class=\"option\">--auth=<em class=\"replaceable\"><code>authmethod</code></em></code></span></dt>\n<dd>\n<p>This option specifies the default authentication method for local users used in <code class=\"filename\">pg_hba.conf</code> (<code class=\"literal\">host</code> and <code class=\"literal\">local</code> lines). <code class=\"command\">initdb</code> will prepopulate <code class=\"filename\">pg_hba.conf</code> entries using the specified authentication method for non-replication as well as replication connections.</p>\n<p>Do not use <code class=\"literal\">trust</code> unless you trust all local users on your system. <code class=\"literal\">trust</code> is the default for ease of installation.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--auth-host=<em class=\"replaceable\"><code>authmethod</code></em></code></span></dt>\n<dd>\n<p>This option specifies the authentication method for local users via TCP/IP connections used in <code class=\"filename\">pg_hba.conf</code> (<code class=\"literal\">host</code> lines).</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--auth-local=<em class=\"replaceable\"><code>authmethod</code></em></code></span></dt>\n<dd>\n<p>This option specifies the authentication method for local users via Unix-domain socket connections used in <code class=\"filename\">pg_hba.conf</code> (<code class=\"literal\">local</code> lines).</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-D <em class=\"replaceable\"><code>directory</code></em></code><br></span><span class=\"term\"><code class=\"option\">--pgdata=<em class=\"replaceable\"><code>directory</code></em></code></span></dt>\n<dd>\n<p>This option specifies the directory where the database cluster should be stored. This is the only information required by <code class=\"command\">initdb</code>, but you can avoid writing it by setting the <code class=\"envar\">PGDATA</code> environment variable, which can be convenient since the database server (<code class=\"command\">postgres</code>) can find the database directory later by the same variable.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-E <em class=\"replaceable\"><code>encoding</code></em></code><br></span><span class=\"term\"><code class=\"option\">--encoding=<em class=\"replaceable\"><code>encoding</code></em></code></span></dt>\n<dd>\n<p>Selects the encoding of the template database. This will also be the default encoding of any database you create later, unless you override it there. The default is derived from the locale, or <code class=\"literal\">SQL_ASCII</code> if that does not work. The character sets supported by the <span class=\"productname\">PostgreSQL</span> server are described in <a class=\"xref\" href=\"/docs/14/multibyte.html#MULTIBYTE-CHARSET-SUPPORTED\" title=\"24.3.1.\u00a0Supported Character Sets\">Section\u00a024.3.1</a>.</p>\n</dd>\n<dt id=\"APP-INITDB-ALLOW-GROUP-ACCESS\"><span class=\"term\"><code class=\"option\">-g</code><br></span><span class=\"term\"><code class=\"option\">--allow-group-access</code></span></dt>\n<dd>\n<p>Allows users in the same group as the cluster owner to read all cluster files created by <code class=\"command\">initdb</code>. This option is ignored on <span class=\"productname\">Windows</span> as it does not support POSIX-style group permissions.</p>\n</dd>\n<dt id=\"APP-INITDB-DATA-CHECKSUMS\"><span class=\"term\"><code class=\"option\">-k</code><br></span><span class=\"term\"><code class=\"option\">--data-checksums</code></span></dt>\n<dd>\n<p>Use checksums on data pages to help detect corruption by the I/O system that would otherwise be silent. Enabling checksums may incur a noticeable performance penalty. If set, checksums are calculated for all objects, in all databases. All checksum failures will be reported in the <a class=\"link\" href=\"/docs/14/monitoring-stats.html#MONITORING-PG-STAT-DATABASE-VIEW\" title=\"28.2.13.\u00a0pg_stat_database\"><code class=\"structname\">pg_stat_database</code></a> view. See <a class=\"xref\" href=\"/docs/14/checksums.html\" title=\"30.2.\u00a0Data Checksums\">Section\u00a030.2</a> for details.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--locale=<em class=\"replaceable\"><code>locale</code></em></code></span></dt>\n<dd>\n<p>Sets the default locale for the database cluster. If this option is not specified, the locale is inherited from the environment that <code class=\"command\">initdb</code> runs in. Locale support is described in <a class=\"xref\" href=\"/docs/14/locale.html\" title=\"24.1.\u00a0Locale Support\">Section\u00a024.1</a>.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--lc-collate=<em class=\"replaceable\"><code>locale</code></em></code><br></span><span class=\"term\"><code class=\"option\">--lc-ctype=<em class=\"replaceable\"><code>locale</code></em></code><br></span><span class=\"term\"><code class=\"option\">--lc-messages=<em class=\"replaceable\"><code>locale</code></em></code><br></span><span class=\"term\"><code class=\"option\">--lc-monetary=<em class=\"replaceable\"><code>locale</code></em></code><br></span><span class=\"term\"><code class=\"option\">--lc-numeric=<em class=\"replaceable\"><code>locale</code></em></code><br></span><span class=\"term\"><code class=\"option\">--lc-time=<em class=\"replaceable\"><code>locale</code></em></code></span></dt>\n<dd>\n<p>Like <code class=\"option\">--locale</code>, but only sets the locale in the specified category.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--no-locale</code></span></dt>\n<dd>\n<p>Equivalent to <code class=\"option\">--locale=C</code>.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-N</code><br></span><span class=\"term\"><code class=\"option\">--no-sync</code></span></dt>\n<dd>\n<p>By default, <code class=\"command\">initdb</code> will wait for all files to be written safely to disk. This option causes <code class=\"command\">initdb</code> 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.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--no-instructions</code></span></dt>\n<dd>\n<p>By default, <code class=\"command\">initdb</code> 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 <code class=\"command\">initdb</code> in platform-specific behavior, where those instructions are likely to be incorrect.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--pwfile=<em class=\"replaceable\"><code>filename</code></em></code></span></dt>\n<dd>\n<p>Makes <code class=\"command\">initdb</code> read the database superuser's password from a file. The first line of the file is taken as the password.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-S</code><br></span><span class=\"term\"><code class=\"option\">--sync-only</code></span></dt>\n<dd>\n<p>Safely write all database files to disk and exit. This does not perform any of the normal <span class=\"application\">initdb</span> operations.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-T <em class=\"replaceable\"><code>config</code></em></code><br></span><span class=\"term\"><code class=\"option\">--text-search-config=<em class=\"replaceable\"><code>config</code></em></code></span></dt>\n<dd>\n<p>Sets the default text search configuration. See <a class=\"xref\" href=\"/docs/14/runtime-config-client.html#GUC-DEFAULT-TEXT-SEARCH-CONFIG\">default_text_search_config</a> for further information.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-U <em class=\"replaceable\"><code>username</code></em></code><br></span><span class=\"term\"><code class=\"option\">--username=<em class=\"replaceable\"><code>username</code></em></code></span></dt>\n<dd>\n<p>Selects the user name of the database superuser. This defaults to the name of the effective user running <code class=\"command\">initdb</code>. It is really not important what the superuser's name is, but one might choose to keep the customary name <span class=\"systemitem\">postgres</span>, even if the operating system user's name is different.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-W</code><br></span><span class=\"term\"><code class=\"option\">--pwprompt</code></span></dt>\n<dd>\n<p>Makes <code class=\"command\">initdb</code> prompt for a password to give the database 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.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-X <em class=\"replaceable\"><code>directory</code></em></code><br></span><span class=\"term\"><code class=\"option\">--waldir=<em class=\"replaceable\"><code>directory</code></em></code></span></dt>\n<dd>\n<p>This option specifies the directory where the write-ahead log should be stored.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--wal-segsize=<em class=\"replaceable\"><code>size</code></em></code></span></dt>\n<dd>\n<p>Set the <em class=\"firstterm\">WAL segment size</em>, 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.</p>\n<p>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.</p>\n</dd>\n</dl>\n</div>\n<p>Other, less commonly used, options are also available:</p>\n<div class=\"variablelist\">\n<dl class=\"variablelist\">\n<dt><span class=\"term\"><code class=\"option\">-d</code><br></span><span class=\"term\"><code class=\"option\">--debug</code></span></dt>\n<dd>\n<p>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 <code class=\"command\">initdb</code> uses to create the catalog tables. This option generates a tremendous amount of extremely boring output.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--discard-caches</code></span></dt>\n<dd>\n<p>Run the bootstrap backend with the <code class=\"literal\">debug_discard_caches=1</code> option. This takes a very long time and is only of use for deep debugging.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-L <em class=\"replaceable\"><code>directory</code></em></code></span></dt>\n<dd>\n<p>Specifies where <code class=\"command\">initdb</code> 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.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-n</code><br></span><span class=\"term\"><code class=\"option\">--no-clean</code></span></dt>\n<dd>\n<p>By default, when <code class=\"command\">initdb</code> 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.</p>\n</dd>\n</dl>\n</div>\n<p>Other options:</p>\n<div class=\"variablelist\">\n<dl class=\"variablelist\">\n<dt><span class=\"term\"><code class=\"option\">-V</code><br></span><span class=\"term\"><code class=\"option\">--version</code></span></dt>\n<dd>\n<p>Print the <span class=\"application\">initdb</span> version and exit.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-?</code><br></span><span class=\"term\"><code class=\"option\">--help</code></span></dt>\n<dd>\n<p>Show help about <span class=\"application\">initdb</span> command line arguments, and exit.</p>\n</dd>\n</dl>\n</div>\n</div>\n<div class=\"refsect1\" id=\"id-1.9.5.3.7\">\n<h2>Environment</h2>\n<div class=\"variablelist\">\n<dl class=\"variablelist\">\n<dt><span class=\"term\"><code class=\"envar\">PGDATA</code></span></dt>\n<dd>\n<p>Specifies the directory where the database cluster is to be stored; can be overridden using the <code class=\"option\">-D</code> option.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"envar\">PG_COLOR</code></span></dt>\n<dd>\n<p>Specifies whether to use color in diagnostic messages. Possible values are <code class=\"literal\">always</code>, <code class=\"literal\">auto</code> and <code class=\"literal\">never</code>.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"envar\">TZ</code></span></dt>\n<dd>\n<p>Specifies the default time zone of the created database cluster. The value should be a full time zone name (see <a class=\"xref\" href=\"/docs/14/datatype-datetime.html#DATATYPE-TIMEZONES\" title=\"8.5.3.\u00a0Time Zones\">Section\u00a08.5.3</a>).</p>\n</dd>\n</dl>\n</div>\n</div>\n<div class=\"refsect1\" id=\"id-1.9.5.3.8\">\n<h2>Notes</h2>\n<p><code class=\"command\">initdb</code> can also be invoked via <code class=\"command\">pg_ctl initdb</code>.</p>\n</div>\n<div class=\"refsect1\" id=\"id-1.9.5.3.9\">\n<h2>See Also</h2><span class=\"simplelist\"><a class=\"xref\" href=\"/docs/14/app-pg-ctl.html\" title=\"pg_ctl\"><span class=\"refentrytitle\"><span class=\"application\">pg_ctl</span></span></a>, <a class=\"xref\" href=\"/docs/14/app-postgres.html\" title=\"postgres\"><span class=\"refentrytitle\"><span class=\"application\">postgres</span></span></a></span>\n</div>\n</div></div>", "manual_path": "app-initdb.html", "comparison_data": {"options": [{"names": ["-A authmethod", "--auth= authmethod"], "signature": "-A authmethod --auth= authmethod", "description": "This option specifies the default authentication method for local users used in pg_hba.conf ( host and local lines). 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": ["--auth-host= authmethod"], "signature": "--auth-host= authmethod", "description": "This option specifies the authentication method for local users via TCP/IP connections used in pg_hba.conf ( host lines)."}, {"names": ["--auth-local= authmethod"], "signature": "--auth-local= authmethod", "description": "This option specifies the authentication method for local users via Unix-domain socket connections used in pg_hba.conf ( local lines)."}, {"names": ["-D directory", "--pgdata= directory"], "signature": "-D directory --pgdata= directory", "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 database directory later by the same variable."}, {"names": ["-E encoding", "--encoding= encoding"], "signature": "-E encoding --encoding= encoding", "description": "Selects the encoding of the template database. This will also be the default encoding of any database you create later, unless you override it there. The default is derived from the locale, or SQL_ASCII if that does not work. The character sets supported by the PostgreSQL server are described in Section 24.3.1 ."}, {"names": ["-g", "--allow-group-access"], "signature": "-g --allow-group-access", "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": ["-k", "--data-checksums"], "signature": "-k --data-checksums", "description": "Use checksums on data pages to help detect corruption by the I/O system that would otherwise be silent. Enabling checksums may incur a noticeable 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 30.2 for details."}, {"names": ["--locale= locale"], "signature": "--locale= locale", "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 24.1 ."}, {"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": "Like --locale , but only sets the locale in the specified category."}, {"names": ["--no-locale"], "signature": "--no-locale", "description": "Equivalent to --locale=C ."}, {"names": ["-N", "--no-sync"], "signature": "-N --no-sync", "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": ["--no-instructions"], "signature": "--no-instructions", "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": ["--pwfile= filename"], "signature": "--pwfile= filename", "description": "Makes initdb read the database superuser's password from a file. The first line of the file is taken as the password."}, {"names": ["-S", "--sync-only"], "signature": "-S --sync-only", "description": "Safely write all database files to disk and exit. This does not perform any of the normal initdb operations."}, {"names": ["-T config", "--text-search-config= config"], "signature": "-T config --text-search-config= config", "description": "Sets the default text search configuration. See default_text_search_config for further information."}, {"names": ["-U username", "--username= username"], "signature": "-U username --username= username", "description": "Selects the user name of the database superuser. This defaults to the name of the effective user running initdb . It is really not important what the superuser's name is, but one might choose to keep the customary name postgres , even if the operating system user's name is different."}, {"names": ["-W", "--pwprompt"], "signature": "-W --pwprompt", "description": "Makes initdb prompt for a password to give the database 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": ["-X directory", "--waldir= directory"], "signature": "-X directory --waldir= directory", "description": "This option specifies the directory where the write-ahead log should be stored."}, {"names": ["--wal-segsize= size"], "signature": "--wal-segsize= size", "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": ["-d", "--debug"], "signature": "-d --debug", "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": ["--discard-caches"], "signature": "--discard-caches", "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": ["-L directory"], "signature": "-L directory", "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": ["-n", "--no-clean"], "signature": "-n --no-clean", "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": ["-V", "--version"], "signature": "-V --version", "description": "Print the initdb version and exit."}, {"names": ["-?", "--help"], "signature": "-? --help", "description": "Show help about initdb command line arguments, and exit."}], "synopsis": ["initdb [ option ...] [ --pgdata | -D ] directory"], "environment": [{"name": "PGDATA", "description": "Specifies the directory where the database cluster is to be stored; can be overridden using the -D option."}, {"name": "PG_COLOR", "description": "Specifies whether to use color in diagnostic messages. Possible values are always , auto and never ."}, {"name": "TZ", "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 )."}]}, "comparison_hash": "94a322c1996865eacd69438ed22894564b58ab5048d4c5c55af8e739e6b8a867"}, "15": {"facts": [{"label": "Documented executable", "value": "initdb"}, {"label": "Executable version", "value": "15.19"}, {"label": "Reference inventory", "value": "Server applications"}, {"label": "Option definition groups", "value": "27"}], "tables": [{"key": "options", "rows": [{"summary": "This option specifies the default authentication method for local users used in pg_hba.conf ( host and local lines). See Section 21.1 for an overview of valid values.", "signature": {"url": "/docs/15/app-initdb.html", "text": "-A authmethod --auth= authmethod"}}, {"summary": "This option specifies the authentication method for local users via TCP/IP connections used in pg_hba.conf ( host lines).", "signature": {"url": "/docs/15/app-initdb.html", "text": "--auth-host= authmethod"}}, {"summary": "This option specifies the authentication method for local users via Unix-domain socket connections used in pg_hba.conf ( local lines).", "signature": {"url": "/docs/15/app-initdb.html", "text": "--auth-local= authmethod"}}, {"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 database directory later by the same variable.", "signature": {"url": "/docs/15/app-initdb.html", "text": "-D directory --pgdata= directory"}}, {"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 default is derived from the locale, if the libc locale provider is used, or UTF8 if the ICU locale provider is used. The character sets supported by the PostgreSQL server are described in Section 24.3.1 .", "signature": {"url": "/docs/15/app-initdb.html", "text": "-E encoding --encoding= encoding"}}, {"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": {"url": "/docs/15/app-initdb.html#APP-INITDB-ALLOW-GROUP-ACCESS", "text": "-g --allow-group-access"}}, {"summary": "Specifies the ICU locale ID, if the ICU locale provider is used.", "signature": {"url": "/docs/15/app-initdb.html", "text": "--icu-locale= locale"}}, {"summary": "Use checksums on data pages to help detect corruption by the I/O system that would otherwise be silent. Enabling checksums may incur a noticeable 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 30.2 for details.", "signature": {"url": "/docs/15/app-initdb.html#APP-INITDB-DATA-CHECKSUMS", "text": "-k --data-checksums"}}, {"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 24.1 .", "signature": {"url": "/docs/15/app-initdb.html", "text": "--locale= locale"}}, {"summary": "Like --locale , but only sets the locale in the specified category.", "signature": {"url": "/docs/15/app-initdb.html", "text": "--lc-collate= locale --lc-ctype= locale --lc-messages= locale --lc-monetary= locale --lc-numeric= locale --lc-time= locale"}}, {"summary": "Equivalent to --locale=C .", "signature": {"url": "/docs/15/app-initdb.html", "text": "--no-locale"}}, {"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 .", "signature": {"url": "/docs/15/app-initdb.html", "text": "--locale-provider={ libc | icu }"}}, {"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": {"url": "/docs/15/app-initdb.html", "text": "-N --no-sync"}}, {"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": {"url": "/docs/15/app-initdb.html", "text": "--no-instructions"}}, {"summary": "Makes initdb read the database superuser's password from a file. The first line of the file is taken as the password.", "signature": {"url": "/docs/15/app-initdb.html", "text": "--pwfile= filename"}}, {"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": {"url": "/docs/15/app-initdb.html", "text": "-S --sync-only"}}, {"summary": "Sets the default text search configuration. See default_text_search_config for further information.", "signature": {"url": "/docs/15/app-initdb.html", "text": "-T config --text-search-config= config"}}, {"summary": "Selects the user name of the database superuser. This defaults to the name of the effective user running initdb . It is really not important what the superuser's name is, but one might choose to keep the customary name postgres , even if the operating system user's name is different.", "signature": {"url": "/docs/15/app-initdb.html", "text": "-U username --username= username"}}, {"summary": "Makes initdb prompt for a password to give the database 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": {"url": "/docs/15/app-initdb.html", "text": "-W --pwprompt"}}, {"summary": "This option specifies the directory where the write-ahead log should be stored.", "signature": {"url": "/docs/15/app-initdb.html", "text": "-X directory --waldir= directory"}}, {"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": {"url": "/docs/15/app-initdb.html", "text": "--wal-segsize= size"}}, {"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": {"url": "/docs/15/app-initdb.html", "text": "-d --debug"}}, {"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": {"url": "/docs/15/app-initdb.html", "text": "--discard-caches"}}, {"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": {"url": "/docs/15/app-initdb.html", "text": "-L directory"}}, {"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": {"url": "/docs/15/app-initdb.html", "text": "-n --no-clean"}}, {"summary": "Print the initdb version and exit.", "signature": {"url": "/docs/15/app-initdb.html", "text": "-V --version"}}, {"summary": "Show help about initdb command line arguments, and exit.", "signature": {"url": "/docs/15/app-initdb.html", "text": "-? --help"}}], "title": "Documented options", "columns": [{"key": "signature", "label": "Option and arguments"}, {"key": "summary", "label": "Description"}]}, {"key": "environment", "rows": [{"name": "PGDATA", "description": "Specifies the directory where the database cluster is to be stored; can be overridden using the -D option."}, {"name": "PG_COLOR", "description": "Specifies whether to use color in diagnostic messages. Possible values are always , auto and never ."}, {"name": "TZ", "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 )."}], "title": "Environment variables", "columns": [{"key": "name", "label": "Variable"}, {"key": "description", "label": "Meaning"}]}], "options": [{"names": ["-A authmethod", "--auth= authmethod"], "summary": "This option specifies the default authentication method for local users used in pg_hba.conf ( host and local lines). See Section 21.1 for an overview of valid values.", "signature": "-A authmethod --auth= authmethod", "source_url": "/docs/15/app-initdb.html", "description": "This option specifies the default authentication method for local users used in pg_hba.conf ( host and local lines). See Section 21.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": ["--auth-host= authmethod"], "summary": "This option specifies the authentication method for local users via TCP/IP connections used in pg_hba.conf ( host lines).", "signature": "--auth-host= authmethod", "source_url": "/docs/15/app-initdb.html", "description": "This option specifies the authentication method for local users via TCP/IP connections used in pg_hba.conf ( host lines)."}, {"names": ["--auth-local= authmethod"], "summary": "This option specifies the authentication method for local users via Unix-domain socket connections used in pg_hba.conf ( local lines).", "signature": "--auth-local= authmethod", "source_url": "/docs/15/app-initdb.html", "description": "This option specifies the authentication method for local users via Unix-domain socket connections used in pg_hba.conf ( local lines)."}, {"names": ["-D directory", "--pgdata= directory"], "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 database directory later by the same variable.", "signature": "-D directory --pgdata= directory", "source_url": "/docs/15/app-initdb.html", "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 database directory later by the same variable."}, {"names": ["-E encoding", "--encoding= 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 default is derived from the locale, if the libc locale provider is used, or UTF8 if the ICU locale provider is used. The character sets supported by the PostgreSQL server are described in Section 24.3.1 .", "signature": "-E encoding --encoding= encoding", "source_url": "/docs/15/app-initdb.html", "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 default is derived from the locale, if the libc locale provider is used, or UTF8 if the ICU locale provider is used. The character sets supported by the PostgreSQL server are described in Section 24.3.1 ."}, {"names": ["-g", "--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": "-g --allow-group-access", "source_url": "/docs/15/app-initdb.html#APP-INITDB-ALLOW-GROUP-ACCESS", "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": ["--icu-locale= locale"], "summary": "Specifies the ICU locale ID, if the ICU locale provider is used.", "signature": "--icu-locale= locale", "source_url": "/docs/15/app-initdb.html", "description": "Specifies the ICU locale ID, if the ICU locale provider is used."}, {"names": ["-k", "--data-checksums"], "summary": "Use checksums on data pages to help detect corruption by the I/O system that would otherwise be silent. Enabling checksums may incur a noticeable 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 30.2 for details.", "signature": "-k --data-checksums", "source_url": "/docs/15/app-initdb.html#APP-INITDB-DATA-CHECKSUMS", "description": "Use checksums on data pages to help detect corruption by the I/O system that would otherwise be silent. Enabling checksums may incur a noticeable 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 30.2 for details."}, {"names": ["--locale= 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 24.1 .", "signature": "--locale= locale", "source_url": "/docs/15/app-initdb.html", "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 24.1 ."}, {"names": ["--lc-collate= locale", "--lc-ctype= locale", "--lc-messages= locale", "--lc-monetary= locale", "--lc-numeric= locale", "--lc-time= locale"], "summary": "Like --locale , but only sets the locale in the specified category.", "signature": "--lc-collate= locale --lc-ctype= locale --lc-messages= locale --lc-monetary= locale --lc-numeric= locale --lc-time= locale", "source_url": "/docs/15/app-initdb.html", "description": "Like --locale , but only sets the locale in the specified category."}, {"names": ["--no-locale"], "summary": "Equivalent to --locale=C .", "signature": "--no-locale", "source_url": "/docs/15/app-initdb.html", "description": "Equivalent to --locale=C ."}, {"names": ["--locale-provider={ libc | icu }"], "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 .", "signature": "--locale-provider={ libc | icu }", "source_url": "/docs/15/app-initdb.html", "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 ."}, {"names": ["-N", "--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": "-N --no-sync", "source_url": "/docs/15/app-initdb.html", "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": ["--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": "--no-instructions", "source_url": "/docs/15/app-initdb.html", "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": ["--pwfile= filename"], "summary": "Makes initdb read the database superuser's password from a file. The first line of the file is taken as the password.", "signature": "--pwfile= filename", "source_url": "/docs/15/app-initdb.html", "description": "Makes initdb read the database superuser's password from a file. The first line of the file is taken as the password."}, {"names": ["-S", "--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": "-S --sync-only", "source_url": "/docs/15/app-initdb.html", "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": ["-T config", "--text-search-config= config"], "summary": "Sets the default text search configuration. See default_text_search_config for further information.", "signature": "-T config --text-search-config= config", "source_url": "/docs/15/app-initdb.html", "description": "Sets the default text search configuration. See default_text_search_config for further information."}, {"names": ["-U username", "--username= username"], "summary": "Selects the user name of the database superuser. This defaults to the name of the effective user running initdb . It is really not important what the superuser's name is, but one might choose to keep the customary name postgres , even if the operating system user's name is different.", "signature": "-U username --username= username", "source_url": "/docs/15/app-initdb.html", "description": "Selects the user name of the database superuser. This defaults to the name of the effective user running initdb . It is really not important what the superuser's name is, but one might choose to keep the customary name postgres , even if the operating system user's name is different."}, {"names": ["-W", "--pwprompt"], "summary": "Makes initdb prompt for a password to give the database 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": "-W --pwprompt", "source_url": "/docs/15/app-initdb.html", "description": "Makes initdb prompt for a password to give the database 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": ["-X directory", "--waldir= directory"], "summary": "This option specifies the directory where the write-ahead log should be stored.", "signature": "-X directory --waldir= directory", "source_url": "/docs/15/app-initdb.html", "description": "This option specifies the directory where the write-ahead log should be stored."}, {"names": ["--wal-segsize= size"], "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": "--wal-segsize= size", "source_url": "/docs/15/app-initdb.html", "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": ["-d", "--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": "-d --debug", "source_url": "/docs/15/app-initdb.html", "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": ["--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": "--discard-caches", "source_url": "/docs/15/app-initdb.html", "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": ["-L directory"], "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": "-L directory", "source_url": "/docs/15/app-initdb.html", "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": ["-n", "--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": "-n --no-clean", "source_url": "/docs/15/app-initdb.html", "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": ["-V", "--version"], "summary": "Print the initdb version and exit.", "signature": "-V --version", "source_url": "/docs/15/app-initdb.html", "description": "Print the initdb version and exit."}, {"names": ["-?", "--help"], "summary": "Show help about initdb command line arguments, and exit.", "signature": "-? --help", "source_url": "/docs/15/app-initdb.html", "description": "Show help about initdb command line arguments, and exit."}], "related": [], "release": {"ref": "https://ftp.postgresql.org/pub/source/v15.19/postgresql-15.19.tar.bz2", "label": "15.19", "major": "15", "channel": "stable", "manifest": {"pdf": {"A4": {"url": "/files/documentation/pdf/15/postgresql-15-A4.pdf", "bytes": 14609140, "pages": 2987, "sha256": "66228564a4d16efb47d6a914085716ecfe22ca1566db56bc7c3d82f790646d72", "built_at": "2026-09-26"}, "US": {"url": "/files/documentation/pdf/15/postgresql-15-US.pdf", "bytes": 14495690, "pages": 3153, "sha256": "645a498c2390d47a6223ec74770631185807a19c484edb0fc5a295d9f460bc02", "built_at": "2026-09-26"}}, "tree": "15", "index": "index.html", "major": "15", "pages": 1168, "release": "15.19", "source_url": "https://ftp.postgresql.org/pub/source/v15.19/postgresql-15.19.tar.bz2", "svg_assets": 3, "source_mode": "en HTML verified against the pinned official archive", "source_sha256": "e1a64a87a46b825b88c082e4518161a47aab53c45694964f8ba1df28f7859f89"}, "revision": "6af958c6520151fc7697d56e0616b03fb00522c4568158674d452ae0644ba545", "evidence_kind": "English manual and source declarations", "source_sha256": "e1a64a87a46b825b88c082e4518161a47aab53c45694964f8ba1df28f7859f89"}, "sources": [{"url": "/docs/15/app-initdb.html", "file": "app-initdb.html", "label": "15.19 English manual \u00b7 app-initdb.html", "anchor": "", "sha256": "9d8430c6c45a71ccb2016dde532079685a00f06b58cd26bd07690bef7fbcbd54"}, {"url": "/docs/15/reference-server.html", "file": "reference-server.html", "label": "Server applications inventory", "anchor": "", "sha256": "1240cfbb13ebfd22aac8d5ae40c62a9015b246f7774bcf0bce97355ce06350a0"}], "sections": [], "synopsis": ["initdb [ option ...] [ --pgdata | -D ] directory"], "signature": "initdb [ option ...] [ --pgdata | -D ] directory", "description": ["initdb \u2014 create a new PostgreSQL database cluster"], "environment": [{"name": "PGDATA", "description": "Specifies the directory where the database cluster is to be stored; can be overridden using the -D option."}, {"name": "PG_COLOR", "description": "Specifies whether to use color in diagnostic messages. Possible values are always , auto and never ."}, {"name": "TZ", "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 )."}], "manual_html": "<div><div class=\"refentry\" id=\"APP-INITDB\">\n<div class=\"titlepage\"></div>\n<div class=\"refnamediv\">\n<h2><span class=\"refentrytitle\"><span class=\"application\">initdb</span></span></h2>\n<p>initdb \u2014 create a new <span class=\"productname\">PostgreSQL</span> database cluster</p>\n</div>\n<div class=\"refsynopsisdiv\">\n<h2>Synopsis</h2>\n<div class=\"cmdsynopsis\">\n<p id=\"id-1.9.5.3.4.1\"><code class=\"command\">initdb</code> [<em class=\"replaceable\"><code>option</code></em>...] [ <code class=\"option\">--pgdata</code> | <code class=\"option\">-D</code> ] <em class=\"replaceable\"><code>directory</code></em></p>\n</div>\n</div>\n<div class=\"refsect1\" id=\"R1-APP-INITDB-1\">\n<h2>Description</h2>\n<p><code class=\"command\">initdb</code> creates a new <span class=\"productname\">PostgreSQL</span> database cluster. A database cluster is a collection of databases that are managed by a single server instance.</p>\n<p>Creating a database cluster consists of creating the directories in which the database data will live, generating the shared catalog tables (tables that belong to the whole cluster rather than to any particular database), and creating the <code class=\"literal\">postgres</code>, <code class=\"literal\">template1</code>, and <code class=\"literal\">template0</code> databases. The <code class=\"literal\">postgres</code> database is a default database meant for use by users, utilities and third party applications. <code class=\"literal\">template1</code> and <code class=\"literal\">template0</code> are meant as source databases to be copied by later <code class=\"command\">CREATE DATABASE</code> commands. <code class=\"literal\">template0</code> should never be modified, but you can add objects to <code class=\"literal\">template1</code>, which by default will be copied into databases created later. See <a class=\"xref\" href=\"/docs/15/manage-ag-templatedbs.html\" title=\"23.3.\u00a0Template Databases\">Section\u00a023.3</a> for more details.</p>\n<p>Although <code class=\"command\">initdb</code> 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 <code class=\"command\">chown</code> to assign ownership of that directory to the database user account, then <code class=\"command\">su</code> to become the database user to run <code class=\"command\">initdb</code>.</p>\n<p><code class=\"command\">initdb</code> 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 <code class=\"command\">initdb</code> creates. Since the server cannot be run as root, you must not run <code class=\"command\">initdb</code> as root either. (It will in fact refuse to do so.)</p>\n<p>For security reasons the new cluster created by <code class=\"command\">initdb</code> will only be accessible by the cluster owner by default. The <code class=\"option\">--allow-group-access</code> 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.</p>\n<p><code class=\"command\">initdb</code> initializes the database cluster's default locale and character set encoding. These can also be set separately for each database when it is created. <code class=\"command\">initdb</code> determines those settings for the template databases, which will serve as the default for all other databases. By default, <code class=\"command\">initdb</code> uses the locale provider <code class=\"literal\">libc</code>, takes the locale settings from the environment, and determines the encoding from the locale settings. This is almost always sufficient, unless there are special requirements.</p>\n<p>To choose a different locale for the cluster, use the option <code class=\"option\">--locale</code>. There are also individual options <code class=\"option\">--lc-*</code> (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.</p>\n<p>Alternatively, the ICU library can be used to provide locale services. (Again, this only sets the default for subsequently created databases.) To select this option, specify <code class=\"literal\">--locale-provider=icu</code>. To choose the specific ICU locale ID to apply, use the option <code class=\"option\">--icu-locale</code>. Note that for implementation reasons and to support legacy code, <code class=\"command\">initdb</code> will still select and initialize libc locale settings when the ICU locale provider is used.</p>\n<p>When <code class=\"command\">initdb</code> 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.</p>\n<p>More details about locale settings can be found in <a class=\"xref\" href=\"/docs/15/locale.html\" title=\"24.1.\u00a0Locale Support\">Section\u00a024.1</a>.</p>\n<p>To alter the default encoding, use the <code class=\"option\">--encoding</code>. More details can be found in <a class=\"xref\" href=\"/docs/15/multibyte.html\" title=\"24.3.\u00a0Character Set Support\">Section\u00a024.3</a>.</p>\n</div>\n<div class=\"refsect1\" id=\"id-1.9.5.3.6\">\n<h2>Options</h2>\n<div class=\"variablelist\">\n<dl class=\"variablelist\">\n<dt><span class=\"term\"><code class=\"option\">-A <em class=\"replaceable\"><code>authmethod</code></em></code><br></span><span class=\"term\"><code class=\"option\">--auth=<em class=\"replaceable\"><code>authmethod</code></em></code></span></dt>\n<dd>\n<p>This option specifies the default authentication method for local users used in <code class=\"filename\">pg_hba.conf</code> (<code class=\"literal\">host</code> and <code class=\"literal\">local</code> lines). See <a class=\"xref\" href=\"/docs/15/auth-pg-hba-conf.html\" title=\"21.1.\u00a0The pg_hba.conf File\">Section\u00a021.1</a> for an overview of valid values.</p>\n<p><code class=\"command\">initdb</code> will prepopulate <code class=\"filename\">pg_hba.conf</code> entries using the specified authentication method for non-replication as well as replication connections.</p>\n<p>Do not use <code class=\"literal\">trust</code> unless you trust all local users on your system. <code class=\"literal\">trust</code> is the default for ease of installation.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--auth-host=<em class=\"replaceable\"><code>authmethod</code></em></code></span></dt>\n<dd>\n<p>This option specifies the authentication method for local users via TCP/IP connections used in <code class=\"filename\">pg_hba.conf</code> (<code class=\"literal\">host</code> lines).</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--auth-local=<em class=\"replaceable\"><code>authmethod</code></em></code></span></dt>\n<dd>\n<p>This option specifies the authentication method for local users via Unix-domain socket connections used in <code class=\"filename\">pg_hba.conf</code> (<code class=\"literal\">local</code> lines).</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-D <em class=\"replaceable\"><code>directory</code></em></code><br></span><span class=\"term\"><code class=\"option\">--pgdata=<em class=\"replaceable\"><code>directory</code></em></code></span></dt>\n<dd>\n<p>This option specifies the directory where the database cluster should be stored. This is the only information required by <code class=\"command\">initdb</code>, but you can avoid writing it by setting the <code class=\"envar\">PGDATA</code> environment variable, which can be convenient since the database server (<code class=\"command\">postgres</code>) can find the database directory later by the same variable.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-E <em class=\"replaceable\"><code>encoding</code></em></code><br></span><span class=\"term\"><code class=\"option\">--encoding=<em class=\"replaceable\"><code>encoding</code></em></code></span></dt>\n<dd>\n<p>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 default is derived from the locale, if the libc locale provider is used, or <code class=\"literal\">UTF8</code> if the ICU locale provider is used. The character sets supported by the <span class=\"productname\">PostgreSQL</span> server are described in <a class=\"xref\" href=\"/docs/15/multibyte.html#MULTIBYTE-CHARSET-SUPPORTED\" title=\"24.3.1.\u00a0Supported Character Sets\">Section\u00a024.3.1</a>.</p>\n</dd>\n<dt id=\"APP-INITDB-ALLOW-GROUP-ACCESS\"><span class=\"term\"><code class=\"option\">-g</code><br></span><span class=\"term\"><code class=\"option\">--allow-group-access</code></span></dt>\n<dd>\n<p>Allows users in the same group as the cluster owner to read all cluster files created by <code class=\"command\">initdb</code>. This option is ignored on <span class=\"productname\">Windows</span> as it does not support POSIX-style group permissions.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--icu-locale=<em class=\"replaceable\"><code>locale</code></em></code></span></dt>\n<dd>\n<p>Specifies the ICU locale ID, if the ICU locale provider is used.</p>\n</dd>\n<dt id=\"APP-INITDB-DATA-CHECKSUMS\"><span class=\"term\"><code class=\"option\">-k</code><br></span><span class=\"term\"><code class=\"option\">--data-checksums</code></span></dt>\n<dd>\n<p>Use checksums on data pages to help detect corruption by the I/O system that would otherwise be silent. Enabling checksums may incur a noticeable performance penalty. If set, checksums are calculated for all objects, in all databases. All checksum failures will be reported in the <a class=\"link\" href=\"/docs/15/monitoring-stats.html#MONITORING-PG-STAT-DATABASE-VIEW\" title=\"28.2.15.\u00a0pg_stat_database\"><code class=\"structname\">pg_stat_database</code></a> view. See <a class=\"xref\" href=\"/docs/15/checksums.html\" title=\"30.2.\u00a0Data Checksums\">Section\u00a030.2</a> for details.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--locale=<em class=\"replaceable\"><code>locale</code></em></code></span></dt>\n<dd>\n<p>Sets the default locale for the database cluster. If this option is not specified, the locale is inherited from the environment that <code class=\"command\">initdb</code> runs in. Locale support is described in <a class=\"xref\" href=\"/docs/15/locale.html\" title=\"24.1.\u00a0Locale Support\">Section\u00a024.1</a>.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--lc-collate=<em class=\"replaceable\"><code>locale</code></em></code><br></span><span class=\"term\"><code class=\"option\">--lc-ctype=<em class=\"replaceable\"><code>locale</code></em></code><br></span><span class=\"term\"><code class=\"option\">--lc-messages=<em class=\"replaceable\"><code>locale</code></em></code><br></span><span class=\"term\"><code class=\"option\">--lc-monetary=<em class=\"replaceable\"><code>locale</code></em></code><br></span><span class=\"term\"><code class=\"option\">--lc-numeric=<em class=\"replaceable\"><code>locale</code></em></code><br></span><span class=\"term\"><code class=\"option\">--lc-time=<em class=\"replaceable\"><code>locale</code></em></code></span></dt>\n<dd>\n<p>Like <code class=\"option\">--locale</code>, but only sets the locale in the specified category.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--no-locale</code></span></dt>\n<dd>\n<p>Equivalent to <code class=\"option\">--locale=C</code>.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--locale-provider={<code class=\"literal\">libc</code>|<code class=\"literal\">icu</code>}</code></span></dt>\n<dd>\n<p>This option sets the locale provider for databases created in the new cluster. It can be overridden in the <code class=\"command\">CREATE DATABASE</code> command when new databases are subsequently created. The default is <code class=\"literal\">libc</code>.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-N</code><br></span><span class=\"term\"><code class=\"option\">--no-sync</code></span></dt>\n<dd>\n<p>By default, <code class=\"command\">initdb</code> will wait for all files to be written safely to disk. This option causes <code class=\"command\">initdb</code> 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.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--no-instructions</code></span></dt>\n<dd>\n<p>By default, <code class=\"command\">initdb</code> 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 <code class=\"command\">initdb</code> in platform-specific behavior, where those instructions are likely to be incorrect.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--pwfile=<em class=\"replaceable\"><code>filename</code></em></code></span></dt>\n<dd>\n<p>Makes <code class=\"command\">initdb</code> read the database superuser's password from a file. The first line of the file is taken as the password.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-S</code><br></span><span class=\"term\"><code class=\"option\">--sync-only</code></span></dt>\n<dd>\n<p>Safely write all database files to disk and exit. This does not perform any of the normal <span class=\"application\">initdb</span> operations. Generally, this option is useful for ensuring reliable recovery after changing <a class=\"xref\" href=\"/docs/15/runtime-config-wal.html#GUC-FSYNC\">fsync</a> from <code class=\"literal\">off</code> to <code class=\"literal\">on</code>.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-T <em class=\"replaceable\"><code>config</code></em></code><br></span><span class=\"term\"><code class=\"option\">--text-search-config=<em class=\"replaceable\"><code>config</code></em></code></span></dt>\n<dd>\n<p>Sets the default text search configuration. See <a class=\"xref\" href=\"/docs/15/runtime-config-client.html#GUC-DEFAULT-TEXT-SEARCH-CONFIG\">default_text_search_config</a> for further information.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-U <em class=\"replaceable\"><code>username</code></em></code><br></span><span class=\"term\"><code class=\"option\">--username=<em class=\"replaceable\"><code>username</code></em></code></span></dt>\n<dd>\n<p>Selects the user name of the database superuser. This defaults to the name of the effective user running <code class=\"command\">initdb</code>. It is really not important what the superuser's name is, but one might choose to keep the customary name <span class=\"systemitem\">postgres</span>, even if the operating system user's name is different.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-W</code><br></span><span class=\"term\"><code class=\"option\">--pwprompt</code></span></dt>\n<dd>\n<p>Makes <code class=\"command\">initdb</code> prompt for a password to give the database 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.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-X <em class=\"replaceable\"><code>directory</code></em></code><br></span><span class=\"term\"><code class=\"option\">--waldir=<em class=\"replaceable\"><code>directory</code></em></code></span></dt>\n<dd>\n<p>This option specifies the directory where the write-ahead log should be stored.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--wal-segsize=<em class=\"replaceable\"><code>size</code></em></code></span></dt>\n<dd>\n<p>Set the <em class=\"firstterm\">WAL segment size</em>, 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.</p>\n<p>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.</p>\n</dd>\n</dl>\n</div>\n<p>Other, less commonly used, options are also available:</p>\n<div class=\"variablelist\">\n<dl class=\"variablelist\">\n<dt><span class=\"term\"><code class=\"option\">-d</code><br></span><span class=\"term\"><code class=\"option\">--debug</code></span></dt>\n<dd>\n<p>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 <code class=\"command\">initdb</code> uses to create the catalog tables. This option generates a tremendous amount of extremely boring output.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--discard-caches</code></span></dt>\n<dd>\n<p>Run the bootstrap backend with the <code class=\"literal\">debug_discard_caches=1</code> option. This takes a very long time and is only of use for deep debugging.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-L <em class=\"replaceable\"><code>directory</code></em></code></span></dt>\n<dd>\n<p>Specifies where <code class=\"command\">initdb</code> 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.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-n</code><br></span><span class=\"term\"><code class=\"option\">--no-clean</code></span></dt>\n<dd>\n<p>By default, when <code class=\"command\">initdb</code> 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.</p>\n</dd>\n</dl>\n</div>\n<p>Other options:</p>\n<div class=\"variablelist\">\n<dl class=\"variablelist\">\n<dt><span class=\"term\"><code class=\"option\">-V</code><br></span><span class=\"term\"><code class=\"option\">--version</code></span></dt>\n<dd>\n<p>Print the <span class=\"application\">initdb</span> version and exit.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-?</code><br></span><span class=\"term\"><code class=\"option\">--help</code></span></dt>\n<dd>\n<p>Show help about <span class=\"application\">initdb</span> command line arguments, and exit.</p>\n</dd>\n</dl>\n</div>\n</div>\n<div class=\"refsect1\" id=\"id-1.9.5.3.7\">\n<h2>Environment</h2>\n<div class=\"variablelist\">\n<dl class=\"variablelist\">\n<dt><span class=\"term\"><code class=\"envar\">PGDATA</code></span></dt>\n<dd>\n<p>Specifies the directory where the database cluster is to be stored; can be overridden using the <code class=\"option\">-D</code> option.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"envar\">PG_COLOR</code></span></dt>\n<dd>\n<p>Specifies whether to use color in diagnostic messages. Possible values are <code class=\"literal\">always</code>, <code class=\"literal\">auto</code> and <code class=\"literal\">never</code>.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"envar\">TZ</code></span></dt>\n<dd>\n<p>Specifies the default time zone of the created database cluster. The value should be a full time zone name (see <a class=\"xref\" href=\"/docs/15/datatype-datetime.html#DATATYPE-TIMEZONES\" title=\"8.5.3.\u00a0Time Zones\">Section\u00a08.5.3</a>).</p>\n</dd>\n</dl>\n</div>\n</div>\n<div class=\"refsect1\" id=\"id-1.9.5.3.8\">\n<h2>Notes</h2>\n<p><code class=\"command\">initdb</code> can also be invoked via <code class=\"command\">pg_ctl initdb</code>.</p>\n</div>\n<div class=\"refsect1\" id=\"id-1.9.5.3.9\">\n<h2>See Also</h2><span class=\"simplelist\"><a class=\"xref\" href=\"/docs/15/app-pg-ctl.html\" title=\"pg_ctl\"><span class=\"refentrytitle\"><span class=\"application\">pg_ctl</span></span></a>, <a class=\"xref\" href=\"/docs/15/app-postgres.html\" title=\"postgres\"><span class=\"refentrytitle\"><span class=\"application\">postgres</span></span></a>, <a class=\"xref\" href=\"/docs/15/auth-pg-hba-conf.html\" title=\"21.1.\u00a0The pg_hba.conf File\">Section\u00a021.1</a></span>\n</div>\n</div></div>", "manual_path": "app-initdb.html", "comparison_data": {"options": [{"names": ["-A authmethod", "--auth= authmethod"], "signature": "-A authmethod --auth= authmethod", "description": "This option specifies the default authentication method for local users used in pg_hba.conf ( host and local lines). See Section 21.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": ["--auth-host= authmethod"], "signature": "--auth-host= authmethod", "description": "This option specifies the authentication method for local users via TCP/IP connections used in pg_hba.conf ( host lines)."}, {"names": ["--auth-local= authmethod"], "signature": "--auth-local= authmethod", "description": "This option specifies the authentication method for local users via Unix-domain socket connections used in pg_hba.conf ( local lines)."}, {"names": ["-D directory", "--pgdata= directory"], "signature": "-D directory --pgdata= directory", "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 database directory later by the same variable."}, {"names": ["-E encoding", "--encoding= encoding"], "signature": "-E encoding --encoding= encoding", "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 default is derived from the locale, if the libc locale provider is used, or UTF8 if the ICU locale provider is used. The character sets supported by the PostgreSQL server are described in Section 24.3.1 ."}, {"names": ["-g", "--allow-group-access"], "signature": "-g --allow-group-access", "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": ["--icu-locale= locale"], "signature": "--icu-locale= locale", "description": "Specifies the ICU locale ID, if the ICU locale provider is used."}, {"names": ["-k", "--data-checksums"], "signature": "-k --data-checksums", "description": "Use checksums on data pages to help detect corruption by the I/O system that would otherwise be silent. Enabling checksums may incur a noticeable 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 30.2 for details."}, {"names": ["--locale= locale"], "signature": "--locale= locale", "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 24.1 ."}, {"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": "Like --locale , but only sets the locale in the specified category."}, {"names": ["--no-locale"], "signature": "--no-locale", "description": "Equivalent to --locale=C ."}, {"names": ["--locale-provider={ libc | icu }"], "signature": "--locale-provider={ libc | icu }", "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 ."}, {"names": ["-N", "--no-sync"], "signature": "-N --no-sync", "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": ["--no-instructions"], "signature": "--no-instructions", "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": ["--pwfile= filename"], "signature": "--pwfile= filename", "description": "Makes initdb read the database superuser's password from a file. The first line of the file is taken as the password."}, {"names": ["-S", "--sync-only"], "signature": "-S --sync-only", "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": ["-T config", "--text-search-config= config"], "signature": "-T config --text-search-config= config", "description": "Sets the default text search configuration. See default_text_search_config for further information."}, {"names": ["-U username", "--username= username"], "signature": "-U username --username= username", "description": "Selects the user name of the database superuser. This defaults to the name of the effective user running initdb . It is really not important what the superuser's name is, but one might choose to keep the customary name postgres , even if the operating system user's name is different."}, {"names": ["-W", "--pwprompt"], "signature": "-W --pwprompt", "description": "Makes initdb prompt for a password to give the database 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": ["-X directory", "--waldir= directory"], "signature": "-X directory --waldir= directory", "description": "This option specifies the directory where the write-ahead log should be stored."}, {"names": ["--wal-segsize= size"], "signature": "--wal-segsize= size", "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": ["-d", "--debug"], "signature": "-d --debug", "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": ["--discard-caches"], "signature": "--discard-caches", "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": ["-L directory"], "signature": "-L directory", "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": ["-n", "--no-clean"], "signature": "-n --no-clean", "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": ["-V", "--version"], "signature": "-V --version", "description": "Print the initdb version and exit."}, {"names": ["-?", "--help"], "signature": "-? --help", "description": "Show help about initdb command line arguments, and exit."}], "synopsis": ["initdb [ option ...] [ --pgdata | -D ] directory"], "environment": [{"name": "PGDATA", "description": "Specifies the directory where the database cluster is to be stored; can be overridden using the -D option."}, {"name": "PG_COLOR", "description": "Specifies whether to use color in diagnostic messages. Possible values are always , auto and never ."}, {"name": "TZ", "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 )."}]}, "comparison_hash": "a0d9432f68f13c60f2890c3e3ff070996fa435f0267042bf281ca14e375da099"}, "16": {"facts": [{"label": "Documented executable", "value": "initdb"}, {"label": "Executable version", "value": "16.15"}, {"label": "Reference inventory", "value": "Server applications"}, {"label": "Option definition groups", "value": "29"}], "tables": [{"key": "options", "rows": [{"summary": "This option specifies the default authentication method for local users used in pg_hba.conf ( host and local lines). See Section 21.1 for an overview of valid values.", "signature": {"url": "/docs/16/app-initdb.html#APP-INITDB-OPTION-AUTH", "text": "-A authmethod --auth= authmethod"}}, {"summary": "This option specifies the authentication method for local users via TCP/IP connections used in pg_hba.conf ( host lines).", "signature": {"url": "/docs/16/app-initdb.html#APP-INITDB-OPTION-AUTH-HOST", "text": "--auth-host= authmethod"}}, {"summary": "This option specifies the authentication method for local users via Unix-domain socket connections used in pg_hba.conf ( local lines).", "signature": {"url": "/docs/16/app-initdb.html#APP-INITDB-OPTION-AUTH-LOCAL", "text": "--auth-local= authmethod"}}, {"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": {"url": "/docs/16/app-initdb.html#APP-INITDB-OPTION-PGDATA", "text": "-D directory --pgdata= directory"}}, {"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 24.3.1 .", "signature": {"url": "/docs/16/app-initdb.html#APP-INITDB-OPTION-ENCODING", "text": "-E encoding --encoding= encoding"}}, {"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": {"url": "/docs/16/app-initdb.html#APP-INITDB-ALLOW-GROUP-ACCESS", "text": "-g --allow-group-access"}}, {"summary": "Specifies the ICU locale when the ICU provider is used. Locale support is described in Section 24.1 .", "signature": {"url": "/docs/16/app-initdb.html#APP-INITDB-ICU-LOCALE", "text": "--icu-locale= locale"}}, {"summary": "Specifies additional collation rules to customize the behavior of the default collation. This is supported for ICU only.", "signature": {"url": "/docs/16/app-initdb.html#APP-INITDB-ICU-RULES", "text": "--icu-rules= rules"}}, {"summary": "Use checksums on data pages to help detect corruption by the I/O system that would otherwise be silent. Enabling checksums may incur a noticeable 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 30.2 for details.", "signature": {"url": "/docs/16/app-initdb.html#APP-INITDB-DATA-CHECKSUMS", "text": "-k --data-checksums"}}, {"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 24.1 .", "signature": {"url": "/docs/16/app-initdb.html#APP-INITDB-OPTION-LOCALE", "text": "--locale= locale"}}, {"summary": "Like --locale , but only sets the locale in the specified category.", "signature": {"url": "/docs/16/app-initdb.html#APP-INITDB-OPTION-LC-COLLATE", "text": "--lc-collate= locale --lc-ctype= locale --lc-messages= locale --lc-monetary= locale --lc-numeric= locale --lc-time= locale"}}, {"summary": "Equivalent to --locale=C .", "signature": {"url": "/docs/16/app-initdb.html#APP-INITDB-OPTION-NO-LOCALE", "text": "--no-locale"}}, {"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 24.1.4 ).", "signature": {"url": "/docs/16/app-initdb.html#APP-INITDB-OPTION-LOCALE-PROVIDER", "text": "--locale-provider={ libc | icu }"}}, {"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": {"url": "/docs/16/app-initdb.html#APP-INITDB-OPTION-NO-SYNC", "text": "-N --no-sync"}}, {"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": {"url": "/docs/16/app-initdb.html#APP-INITDB-OPTION-NO-INSTRUCTIONS", "text": "--no-instructions"}}, {"summary": "Makes initdb read the bootstrap superuser's password from a file. The first line of the file is taken as the password.", "signature": {"url": "/docs/16/app-initdb.html#APP-INITDB-OPTION-PWFILE", "text": "--pwfile= filename"}}, {"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": {"url": "/docs/16/app-initdb.html#APP-INITDB-OPTION-SYNC-ONLY", "text": "-S --sync-only"}}, {"summary": "Sets the default text search configuration. See default_text_search_config for further information.", "signature": {"url": "/docs/16/app-initdb.html#APP-INITDB-OPTION-TEXT-SEARCH-CONFIG", "text": "-T config --text-search-config= config"}}, {"summary": "Sets the user name of the bootstrap superuser . This defaults to the name of the operating-system user running initdb .", "signature": {"url": "/docs/16/app-initdb.html#APP-INITDB-OPTION-USERNAME", "text": "-U username --username= username"}}, {"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": {"url": "/docs/16/app-initdb.html#APP-INITDB-OPTION-PWPROMPT", "text": "-W --pwprompt"}}, {"summary": "This option specifies the directory where the write-ahead log should be stored.", "signature": {"url": "/docs/16/app-initdb.html#APP-INITDB-OPTION-WALDIR", "text": "-X directory --waldir= directory"}}, {"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": {"url": "/docs/16/app-initdb.html#APP-INITDB-OPTION-WAL-SEGSIZE", "text": "--wal-segsize= size"}}, {"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": {"url": "/docs/16/app-initdb.html#APP-INITDB-OPTION-SET", "text": "-c name = value --set name = value"}}, {"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": {"url": "/docs/16/app-initdb.html#APP-INITDB-OPTION-DEBUG", "text": "-d --debug"}}, {"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": {"url": "/docs/16/app-initdb.html#APP-INITDB-OPTION-DISCARD-CACHES", "text": "--discard-caches"}}, {"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": {"url": "/docs/16/app-initdb.html#APP-INITDB-OPTION-L", "text": "-L directory"}}, {"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": {"url": "/docs/16/app-initdb.html#APP-INITDB-OPTION-NO-CLEAN", "text": "-n --no-clean"}}, {"summary": "Print the initdb version and exit.", "signature": {"url": "/docs/16/app-initdb.html#APP-INITDB-OPTION-VERSION", "text": "-V --version"}}, {"summary": "Show help about initdb command line arguments, and exit.", "signature": {"url": "/docs/16/app-initdb.html#APP-INITDB-OPTION-HELP", "text": "-? --help"}}], "title": "Documented options", "columns": [{"key": "signature", "label": "Option and arguments"}, {"key": "summary", "label": "Description"}]}, {"key": "environment", "rows": [{"name": "PGDATA", "description": "Specifies the directory where the database cluster is to be stored; can be overridden using the -D option."}, {"name": "PG_COLOR", "description": "Specifies whether to use color in diagnostic messages. Possible values are always , auto and never ."}, {"name": "TZ", "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 )."}], "title": "Environment variables", "columns": [{"key": "name", "label": "Variable"}, {"key": "description", "label": "Meaning"}]}], "options": [{"names": ["-A authmethod", "--auth= authmethod"], "summary": "This option specifies the default authentication method for local users used in pg_hba.conf ( host and local lines). See Section 21.1 for an overview of valid values.", "signature": "-A authmethod --auth= authmethod", "source_url": "/docs/16/app-initdb.html#APP-INITDB-OPTION-AUTH", "description": "This option specifies the default authentication method for local users used in pg_hba.conf ( host and local lines). See Section 21.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": ["--auth-host= authmethod"], "summary": "This option specifies the authentication method for local users via TCP/IP connections used in pg_hba.conf ( host lines).", "signature": "--auth-host= authmethod", "source_url": "/docs/16/app-initdb.html#APP-INITDB-OPTION-AUTH-HOST", "description": "This option specifies the authentication method for local users via TCP/IP connections used in pg_hba.conf ( host lines)."}, {"names": ["--auth-local= authmethod"], "summary": "This option specifies the authentication method for local users via Unix-domain socket connections used in pg_hba.conf ( local lines).", "signature": "--auth-local= authmethod", "source_url": "/docs/16/app-initdb.html#APP-INITDB-OPTION-AUTH-LOCAL", "description": "This option specifies the authentication method for local users via Unix-domain socket connections used in pg_hba.conf ( local lines)."}, {"names": ["-D directory", "--pgdata= directory"], "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": "-D directory --pgdata= directory", "source_url": "/docs/16/app-initdb.html#APP-INITDB-OPTION-PGDATA", "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": ["-E encoding", "--encoding= 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 24.3.1 .", "signature": "-E encoding --encoding= encoding", "source_url": "/docs/16/app-initdb.html#APP-INITDB-OPTION-ENCODING", "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 24.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": ["-g", "--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": "-g --allow-group-access", "source_url": "/docs/16/app-initdb.html#APP-INITDB-ALLOW-GROUP-ACCESS", "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": ["--icu-locale= locale"], "summary": "Specifies the ICU locale when the ICU provider is used. Locale support is described in Section 24.1 .", "signature": "--icu-locale= locale", "source_url": "/docs/16/app-initdb.html#APP-INITDB-ICU-LOCALE", "description": "Specifies the ICU locale when the ICU provider is used. Locale support is described in Section 24.1 ."}, {"names": ["--icu-rules= rules"], "summary": "Specifies additional collation rules to customize the behavior of the default collation. This is supported for ICU only.", "signature": "--icu-rules= rules", "source_url": "/docs/16/app-initdb.html#APP-INITDB-ICU-RULES", "description": "Specifies additional collation rules to customize the behavior of the default collation. This is supported for ICU only."}, {"names": ["-k", "--data-checksums"], "summary": "Use checksums on data pages to help detect corruption by the I/O system that would otherwise be silent. Enabling checksums may incur a noticeable 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 30.2 for details.", "signature": "-k --data-checksums", "source_url": "/docs/16/app-initdb.html#APP-INITDB-DATA-CHECKSUMS", "description": "Use checksums on data pages to help detect corruption by the I/O system that would otherwise be silent. Enabling checksums may incur a noticeable 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 30.2 for details."}, {"names": ["--locale= 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 24.1 .", "signature": "--locale= locale", "source_url": "/docs/16/app-initdb.html#APP-INITDB-OPTION-LOCALE", "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 24.1 ."}, {"names": ["--lc-collate= locale", "--lc-ctype= locale", "--lc-messages= locale", "--lc-monetary= locale", "--lc-numeric= locale", "--lc-time= locale"], "summary": "Like --locale , but only sets the locale in the specified category.", "signature": "--lc-collate= locale --lc-ctype= locale --lc-messages= locale --lc-monetary= locale --lc-numeric= locale --lc-time= locale", "source_url": "/docs/16/app-initdb.html#APP-INITDB-OPTION-LC-COLLATE", "description": "Like --locale , but only sets the locale in the specified category."}, {"names": ["--no-locale"], "summary": "Equivalent to --locale=C .", "signature": "--no-locale", "source_url": "/docs/16/app-initdb.html#APP-INITDB-OPTION-NO-LOCALE", "description": "Equivalent to --locale=C ."}, {"names": ["--locale-provider={ libc | icu }"], "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 24.1.4 ).", "signature": "--locale-provider={ libc | icu }", "source_url": "/docs/16/app-initdb.html#APP-INITDB-OPTION-LOCALE-PROVIDER", "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 24.1.4 )."}, {"names": ["-N", "--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": "-N --no-sync", "source_url": "/docs/16/app-initdb.html#APP-INITDB-OPTION-NO-SYNC", "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": ["--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": "--no-instructions", "source_url": "/docs/16/app-initdb.html#APP-INITDB-OPTION-NO-INSTRUCTIONS", "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": ["--pwfile= filename"], "summary": "Makes initdb read the bootstrap superuser's password from a file. The first line of the file is taken as the password.", "signature": "--pwfile= filename", "source_url": "/docs/16/app-initdb.html#APP-INITDB-OPTION-PWFILE", "description": "Makes initdb read the bootstrap superuser's password from a file. The first line of the file is taken as the password."}, {"names": ["-S", "--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": "-S --sync-only", "source_url": "/docs/16/app-initdb.html#APP-INITDB-OPTION-SYNC-ONLY", "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": ["-T config", "--text-search-config= config"], "summary": "Sets the default text search configuration. See default_text_search_config for further information.", "signature": "-T config --text-search-config= config", "source_url": "/docs/16/app-initdb.html#APP-INITDB-OPTION-TEXT-SEARCH-CONFIG", "description": "Sets the default text search configuration. See default_text_search_config for further information."}, {"names": ["-U username", "--username= username"], "summary": "Sets the user name of the bootstrap superuser . This defaults to the name of the operating-system user running initdb .", "signature": "-U username --username= username", "source_url": "/docs/16/app-initdb.html#APP-INITDB-OPTION-USERNAME", "description": "Sets the user name of the bootstrap superuser . This defaults to the name of the operating-system user running initdb ."}, {"names": ["-W", "--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": "-W --pwprompt", "source_url": "/docs/16/app-initdb.html#APP-INITDB-OPTION-PWPROMPT", "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": ["-X directory", "--waldir= directory"], "summary": "This option specifies the directory where the write-ahead log should be stored.", "signature": "-X directory --waldir= directory", "source_url": "/docs/16/app-initdb.html#APP-INITDB-OPTION-WALDIR", "description": "This option specifies the directory where the write-ahead log should be stored."}, {"names": ["--wal-segsize= size"], "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": "--wal-segsize= size", "source_url": "/docs/16/app-initdb.html#APP-INITDB-OPTION-WAL-SEGSIZE", "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": ["-c name = value", "--set name = value"], "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": "-c name = value --set name = value", "source_url": "/docs/16/app-initdb.html#APP-INITDB-OPTION-SET", "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": ["-d", "--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": "-d --debug", "source_url": "/docs/16/app-initdb.html#APP-INITDB-OPTION-DEBUG", "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": ["--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": "--discard-caches", "source_url": "/docs/16/app-initdb.html#APP-INITDB-OPTION-DISCARD-CACHES", "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": ["-L directory"], "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": "-L directory", "source_url": "/docs/16/app-initdb.html#APP-INITDB-OPTION-L", "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": ["-n", "--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": "-n --no-clean", "source_url": "/docs/16/app-initdb.html#APP-INITDB-OPTION-NO-CLEAN", "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": ["-V", "--version"], "summary": "Print the initdb version and exit.", "signature": "-V --version", "source_url": "/docs/16/app-initdb.html#APP-INITDB-OPTION-VERSION", "description": "Print the initdb version and exit."}, {"names": ["-?", "--help"], "summary": "Show help about initdb command line arguments, and exit.", "signature": "-? --help", "source_url": "/docs/16/app-initdb.html#APP-INITDB-OPTION-HELP", "description": "Show help about initdb command line arguments, and exit."}], "related": [], "release": {"ref": "https://ftp.postgresql.org/pub/source/v16.15/postgresql-16.15.tar.bz2", "label": "16.15", "major": "16", "channel": "stable", "manifest": {"pdf": {"A4": {"url": "/files/documentation/pdf/16/postgresql-16-A4.pdf", "bytes": 15282337, "pages": 3055, "sha256": "4bb6c1f63deedac98736d8c4c7bc0fad0ac24e85b07e21ee10411872f06afd06", "built_at": "2026-09-26"}, "US": {"url": "/files/documentation/pdf/16/postgresql-16-US.pdf", "bytes": 15164148, "pages": 3220, "sha256": "5b6b6166c89991199e144bb0ae34c17a5f29826251dbf19db1abc0df3a3e771b", "built_at": "2026-09-26"}}, "tree": "16", "index": "index.html", "major": "16", "pages": 1169, "release": "16.15", "source_url": "https://ftp.postgresql.org/pub/source/v16.15/postgresql-16.15.tar.bz2", "svg_assets": 3, "source_mode": "en HTML verified against the pinned official archive", "source_sha256": "c1575341fa7bd40f5274ea465b34390f4dc64cdd0770af327005caaeb9f6b7ed"}, "revision": "3c21e58b35318021716440e67bb8bafd392b6a2b965a244d90e9e33c99e0bdef", "evidence_kind": "English manual and source declarations", "source_sha256": "c1575341fa7bd40f5274ea465b34390f4dc64cdd0770af327005caaeb9f6b7ed"}, "sources": [{"url": "/docs/16/app-initdb.html", "file": "app-initdb.html", "label": "16.15 English manual \u00b7 app-initdb.html", "anchor": "", "sha256": "7ac7c692002c8e409f240ae0233ee4d9c3dc0dd4fb155738b983aa8c1429e07d"}, {"url": "/docs/16/reference-server.html", "file": "reference-server.html", "label": "Server applications inventory", "anchor": "", "sha256": "8aaa4422eece8f26d84715f855d9d0f7f87b200f8b82898c73c865ee42c2c70f"}], "sections": [], "synopsis": ["initdb [ option ...] [ --pgdata | -D ] directory"], "signature": "initdb [ option ...] [ --pgdata | -D ] directory", "description": ["initdb \u2014 create a new PostgreSQL database cluster"], "environment": [{"name": "PGDATA", "description": "Specifies the directory where the database cluster is to be stored; can be overridden using the -D option."}, {"name": "PG_COLOR", "description": "Specifies whether to use color in diagnostic messages. Possible values are always , auto and never ."}, {"name": "TZ", "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 )."}], "manual_html": "<div><div class=\"refentry\" id=\"APP-INITDB\">\n<div class=\"titlepage\"></div>\n<div class=\"refnamediv\">\n<h2><span class=\"refentrytitle\"><span class=\"application\">initdb</span></span></h2>\n<p>initdb \u2014 create a new <span class=\"productname\">PostgreSQL</span> database cluster</p>\n</div>\n<div class=\"refsynopsisdiv\">\n<h2>Synopsis</h2>\n<div class=\"cmdsynopsis\">\n<p id=\"id-1.9.5.3.4.1\"><code class=\"command\">initdb</code> [<em class=\"replaceable\"><code>option</code></em>...] [ <code class=\"option\">--pgdata</code> | <code class=\"option\">-D</code> ] <em class=\"replaceable\"><code>directory</code></em></p>\n</div>\n</div>\n<div class=\"refsect1\" id=\"R1-APP-INITDB-1\">\n<h2>Description</h2>\n<p><code class=\"command\">initdb</code> creates a new <span class=\"productname\">PostgreSQL</span> <a class=\"glossterm\" href=\"/docs/16/glossary.html#GLOSSARY-DB-CLUSTER\"></a><a class=\"glossterm\" href=\"/docs/16/glossary.html#GLOSSARY-DB-CLUSTER\" title=\"Database cluster\">database cluster</a>.</p>\n<p>Creating a database cluster consists of creating the <a class=\"glossterm\" href=\"/docs/16/glossary.html#GLOSSARY-DATA-DIRECTORY\"></a><a class=\"glossterm\" href=\"/docs/16/glossary.html#GLOSSARY-DATA-DIRECTORY\" title=\"Data directory\">directories</a> 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 <code class=\"literal\">postgres</code>, <code class=\"literal\">template1</code>, and <code class=\"literal\">template0</code> databases. The <code class=\"literal\">postgres</code> database is a default database meant for use by users, utilities and third party applications. <code class=\"literal\">template1</code> and <code class=\"literal\">template0</code> are meant as source databases to be copied by later <code class=\"command\">CREATE DATABASE</code> commands. <code class=\"literal\">template0</code> should never be modified, but you can add objects to <code class=\"literal\">template1</code>, which by default will be copied into databases created later. See <a class=\"xref\" href=\"/docs/16/manage-ag-templatedbs.html\" title=\"23.3.\u00a0Template Databases\">Section\u00a023.3</a> for more details.</p>\n<p>Although <code class=\"command\">initdb</code> 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 <code class=\"command\">chown</code> to assign ownership of that directory to the database user account, then <code class=\"command\">su</code> to become the database user to run <code class=\"command\">initdb</code>.</p>\n<p><code class=\"command\">initdb</code> 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 <code class=\"command\">initdb</code> creates. Since the server cannot be run as root, you must not run <code class=\"command\">initdb</code> as root either. (It will in fact refuse to do so.)</p>\n<p>For security reasons the new cluster created by <code class=\"command\">initdb</code> will only be accessible by the cluster owner by default. The <code class=\"option\">--allow-group-access</code> 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.</p>\n<p><code class=\"command\">initdb</code> initializes the database cluster's default locale and character set encoding. These can also be set separately for each database when it is created. <code class=\"command\">initdb</code> determines those settings for the template databases, which will serve as the default for all other databases.</p>\n<p>By default, <code class=\"command\">initdb</code> uses the locale provider <code class=\"literal\">libc</code> (see <a class=\"xref\" href=\"/docs/16/locale.html#LOCALE-PROVIDERS\" title=\"24.1.4.\u00a0Locale Providers\">Section\u00a024.1.4</a>). The <code class=\"literal\">libc</code> locale provider takes the locale settings from the environment, and determines the encoding from the locale settings.</p>\n<p>To choose a different locale for the cluster, use the option <code class=\"option\">--locale</code>. There are also individual options <code class=\"option\">--lc-*</code> and <code class=\"option\">--icu-locale</code> (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.</p>\n<p>Alternatively, <code class=\"command\">initdb</code> can use the ICU library to provide locale services by specifying <code class=\"literal\">--locale-provider=icu</code>. The server must be built with ICU support. To choose the specific ICU locale ID to apply, use the option <code class=\"option\">--icu-locale</code>. Note that for implementation reasons and to support legacy code, <code class=\"command\">initdb</code> will still select and initialize libc locale settings when the ICU locale provider is used.</p>\n<p>When <code class=\"command\">initdb</code> 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.</p>\n<p>More details about locale settings can be found in <a class=\"xref\" href=\"/docs/16/locale.html\" title=\"24.1.\u00a0Locale Support\">Section\u00a024.1</a>.</p>\n<p>To alter the default encoding, use the <code class=\"option\">--encoding</code>. More details can be found in <a class=\"xref\" href=\"/docs/16/multibyte.html\" title=\"24.3.\u00a0Character Set Support\">Section\u00a024.3</a>.</p>\n</div>\n<div class=\"refsect1\" id=\"id-1.9.5.3.6\">\n<h2>Options</h2>\n<div class=\"variablelist\">\n<dl class=\"variablelist\">\n<dt id=\"APP-INITDB-OPTION-AUTH\"><span class=\"term\"><code class=\"option\">-A <em class=\"replaceable\"><code>authmethod</code></em></code><br></span><span class=\"term\"><code class=\"option\">--auth=<em class=\"replaceable\"><code>authmethod</code></em></code></span> </dt>\n<dd>\n<p>This option specifies the default authentication method for local users used in <code class=\"filename\">pg_hba.conf</code> (<code class=\"literal\">host</code> and <code class=\"literal\">local</code> lines). See <a class=\"xref\" href=\"/docs/16/auth-pg-hba-conf.html\" title=\"21.1.\u00a0The pg_hba.conf File\">Section\u00a021.1</a> for an overview of valid values.</p>\n<p><code class=\"command\">initdb</code> will prepopulate <code class=\"filename\">pg_hba.conf</code> entries using the specified authentication method for non-replication as well as replication connections.</p>\n<p>Do not use <code class=\"literal\">trust</code> unless you trust all local users on your system. <code class=\"literal\">trust</code> is the default for ease of installation.</p>\n</dd>\n<dt id=\"APP-INITDB-OPTION-AUTH-HOST\"><span class=\"term\"><code class=\"option\">--auth-host=<em class=\"replaceable\"><code>authmethod</code></em></code></span> </dt>\n<dd>\n<p>This option specifies the authentication method for local users via TCP/IP connections used in <code class=\"filename\">pg_hba.conf</code> (<code class=\"literal\">host</code> lines).</p>\n</dd>\n<dt id=\"APP-INITDB-OPTION-AUTH-LOCAL\"><span class=\"term\"><code class=\"option\">--auth-local=<em class=\"replaceable\"><code>authmethod</code></em></code></span> </dt>\n<dd>\n<p>This option specifies the authentication method for local users via Unix-domain socket connections used in <code class=\"filename\">pg_hba.conf</code> (<code class=\"literal\">local</code> lines).</p>\n</dd>\n<dt id=\"APP-INITDB-OPTION-PGDATA\"><span class=\"term\"><code class=\"option\">-D <em class=\"replaceable\"><code>directory</code></em></code><br></span><span class=\"term\"><code class=\"option\">--pgdata=<em class=\"replaceable\"><code>directory</code></em></code></span> </dt>\n<dd>\n<p>This option specifies the directory where the database cluster should be stored. This is the only information required by <code class=\"command\">initdb</code>, but you can avoid writing it by setting the <code class=\"envar\">PGDATA</code> environment variable, which can be convenient since the database server (<code class=\"command\">postgres</code>) can find the data directory later by the same variable.</p>\n</dd>\n<dt id=\"APP-INITDB-OPTION-ENCODING\"><span class=\"term\"><code class=\"option\">-E <em class=\"replaceable\"><code>encoding</code></em></code><br></span><span class=\"term\"><code class=\"option\">--encoding=<em class=\"replaceable\"><code>encoding</code></em></code></span> </dt>\n<dd>\n<p>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 <span class=\"productname\">PostgreSQL</span> server are described in <a class=\"xref\" href=\"/docs/16/multibyte.html#MULTIBYTE-CHARSET-SUPPORTED\" title=\"24.3.1.\u00a0Supported Character Sets\">Section\u00a024.3.1</a>.</p>\n<p>By default, the template database encoding is derived from the locale. If <a class=\"xref\" href=\"/docs/16/app-initdb.html#APP-INITDB-OPTION-NO-LOCALE\"><code class=\"option\">--no-locale</code></a> is specified (or equivalently, if the locale is <code class=\"literal\">C</code> or <code class=\"literal\">POSIX</code>), then the default is <code class=\"literal\">UTF8</code> for the ICU provider and <code class=\"literal\">SQL_ASCII</code> for the <code class=\"literal\">libc</code> provider.</p>\n</dd>\n<dt id=\"APP-INITDB-ALLOW-GROUP-ACCESS\"><span class=\"term\"><code class=\"option\">-g</code><br></span><span class=\"term\"><code class=\"option\">--allow-group-access</code></span> </dt>\n<dd>\n<p>Allows users in the same group as the cluster owner to read all cluster files created by <code class=\"command\">initdb</code>. This option is ignored on <span class=\"productname\">Windows</span> as it does not support POSIX-style group permissions.</p>\n</dd>\n<dt id=\"APP-INITDB-ICU-LOCALE\"><span class=\"term\"><code class=\"option\">--icu-locale=<em class=\"replaceable\"><code>locale</code></em></code></span> </dt>\n<dd>\n<p>Specifies the ICU locale when the ICU provider is used. Locale support is described in <a class=\"xref\" href=\"/docs/16/locale.html\" title=\"24.1.\u00a0Locale Support\">Section\u00a024.1</a>.</p>\n</dd>\n<dt id=\"APP-INITDB-ICU-RULES\"><span class=\"term\"><code class=\"option\">--icu-rules=<em class=\"replaceable\"><code>rules</code></em></code></span> </dt>\n<dd>\n<p>Specifies additional collation rules to customize the behavior of the default collation. This is supported for ICU only.</p>\n</dd>\n<dt id=\"APP-INITDB-DATA-CHECKSUMS\"><span class=\"term\"><code class=\"option\">-k</code><br></span><span class=\"term\"><code class=\"option\">--data-checksums</code></span> </dt>\n<dd>\n<p>Use checksums on data pages to help detect corruption by the I/O system that would otherwise be silent. Enabling checksums may incur a noticeable performance penalty. If set, checksums are calculated for all objects, in all databases. All checksum failures will be reported in the <a class=\"link\" href=\"/docs/16/monitoring-stats.html#MONITORING-PG-STAT-DATABASE-VIEW\" title=\"28.2.16.\u00a0pg_stat_database\"><code class=\"structname\">pg_stat_database</code></a> view. See <a class=\"xref\" href=\"/docs/16/checksums.html\" title=\"30.2.\u00a0Data Checksums\">Section\u00a030.2</a> for details.</p>\n</dd>\n<dt id=\"APP-INITDB-OPTION-LOCALE\"><span class=\"term\"><code class=\"option\">--locale=<em class=\"replaceable\"><code>locale</code></em></code></span> </dt>\n<dd>\n<p>Sets the default locale for the database cluster. If this option is not specified, the locale is inherited from the environment that <code class=\"command\">initdb</code> runs in. Locale support is described in <a class=\"xref\" href=\"/docs/16/locale.html\" title=\"24.1.\u00a0Locale Support\">Section\u00a024.1</a>.</p>\n</dd>\n<dt id=\"APP-INITDB-OPTION-LC-COLLATE\"><span class=\"term\"><code class=\"option\">--lc-collate=<em class=\"replaceable\"><code>locale</code></em></code><br></span><span class=\"term\"><code class=\"option\">--lc-ctype=<em class=\"replaceable\"><code>locale</code></em></code><br></span><span class=\"term\"><code class=\"option\">--lc-messages=<em class=\"replaceable\"><code>locale</code></em></code><br></span><span class=\"term\"><code class=\"option\">--lc-monetary=<em class=\"replaceable\"><code>locale</code></em></code><br></span><span class=\"term\"><code class=\"option\">--lc-numeric=<em class=\"replaceable\"><code>locale</code></em></code><br></span><span class=\"term\"><code class=\"option\">--lc-time=<em class=\"replaceable\"><code>locale</code></em></code></span> </dt>\n<dd>\n<p>Like <code class=\"option\">--locale</code>, but only sets the locale in the specified category.</p>\n</dd>\n<dt id=\"APP-INITDB-OPTION-NO-LOCALE\"><span class=\"term\"><code class=\"option\">--no-locale</code></span> </dt>\n<dd>\n<p>Equivalent to <code class=\"option\">--locale=C</code>.</p>\n</dd>\n<dt id=\"APP-INITDB-OPTION-LOCALE-PROVIDER\"><span class=\"term\"><code class=\"option\">--locale-provider={<code class=\"literal\">libc</code>|<code class=\"literal\">icu</code>}</code></span> </dt>\n<dd>\n<p>This option sets the locale provider for databases created in the new cluster. It can be overridden in the <code class=\"command\">CREATE DATABASE</code> command when new databases are subsequently created. The default is <code class=\"literal\">libc</code> (see <a class=\"xref\" href=\"/docs/16/locale.html#LOCALE-PROVIDERS\" title=\"24.1.4.\u00a0Locale Providers\">Section\u00a024.1.4</a>).</p>\n</dd>\n<dt id=\"APP-INITDB-OPTION-NO-SYNC\"><span class=\"term\"><code class=\"option\">-N</code><br></span><span class=\"term\"><code class=\"option\">--no-sync</code></span> </dt>\n<dd>\n<p>By default, <code class=\"command\">initdb</code> will wait for all files to be written safely to disk. This option causes <code class=\"command\">initdb</code> 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.</p>\n</dd>\n<dt id=\"APP-INITDB-OPTION-NO-INSTRUCTIONS\"><span class=\"term\"><code class=\"option\">--no-instructions</code></span> </dt>\n<dd>\n<p>By default, <code class=\"command\">initdb</code> 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 <code class=\"command\">initdb</code> in platform-specific behavior, where those instructions are likely to be incorrect.</p>\n</dd>\n<dt id=\"APP-INITDB-OPTION-PWFILE\"><span class=\"term\"><code class=\"option\">--pwfile=<em class=\"replaceable\"><code>filename</code></em></code></span> </dt>\n<dd>\n<p>Makes <code class=\"command\">initdb</code> read the bootstrap superuser's password from a file. The first line of the file is taken as the password.</p>\n</dd>\n<dt id=\"APP-INITDB-OPTION-SYNC-ONLY\"><span class=\"term\"><code class=\"option\">-S</code><br></span><span class=\"term\"><code class=\"option\">--sync-only</code></span> </dt>\n<dd>\n<p>Safely write all database files to disk and exit. This does not perform any of the normal <span class=\"application\">initdb</span> operations. Generally, this option is useful for ensuring reliable recovery after changing <a class=\"xref\" href=\"/docs/16/runtime-config-wal.html#GUC-FSYNC\">fsync</a> from <code class=\"literal\">off</code> to <code class=\"literal\">on</code>.</p>\n</dd>\n<dt id=\"APP-INITDB-OPTION-TEXT-SEARCH-CONFIG\"><span class=\"term\"><code class=\"option\">-T <em class=\"replaceable\"><code>config</code></em></code><br></span><span class=\"term\"><code class=\"option\">--text-search-config=<em class=\"replaceable\"><code>config</code></em></code></span> </dt>\n<dd>\n<p>Sets the default text search configuration. See <a class=\"xref\" href=\"/docs/16/runtime-config-client.html#GUC-DEFAULT-TEXT-SEARCH-CONFIG\">default_text_search_config</a> for further information.</p>\n</dd>\n<dt id=\"APP-INITDB-OPTION-USERNAME\"><span class=\"term\"><code class=\"option\">-U <em class=\"replaceable\"><code>username</code></em></code><br></span><span class=\"term\"><code class=\"option\">--username=<em class=\"replaceable\"><code>username</code></em></code></span> </dt>\n<dd>\n<p>Sets the user name of the <a class=\"glossterm\" href=\"/docs/16/glossary.html#GLOSSARY-BOOTSTRAP-SUPERUSER\"></a><a class=\"glossterm\" href=\"/docs/16/glossary.html#GLOSSARY-BOOTSTRAP-SUPERUSER\" title=\"Bootstrap superuser\">bootstrap superuser</a>. This defaults to the name of the operating-system user running <code class=\"command\">initdb</code>.</p>\n</dd>\n<dt id=\"APP-INITDB-OPTION-PWPROMPT\"><span class=\"term\"><code class=\"option\">-W</code><br></span><span class=\"term\"><code class=\"option\">--pwprompt</code></span> </dt>\n<dd>\n<p>Makes <code class=\"command\">initdb</code> 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.</p>\n</dd>\n<dt id=\"APP-INITDB-OPTION-WALDIR\"><span class=\"term\"><code class=\"option\">-X <em class=\"replaceable\"><code>directory</code></em></code><br></span><span class=\"term\"><code class=\"option\">--waldir=<em class=\"replaceable\"><code>directory</code></em></code></span> </dt>\n<dd>\n<p>This option specifies the directory where the write-ahead log should be stored.</p>\n</dd>\n<dt id=\"APP-INITDB-OPTION-WAL-SEGSIZE\"><span class=\"term\"><code class=\"option\">--wal-segsize=<em class=\"replaceable\"><code>size</code></em></code></span> </dt>\n<dd>\n<p>Set the <em class=\"firstterm\">WAL segment size</em>, 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.</p>\n<p>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.</p>\n</dd>\n</dl>\n</div>\n<p>Other, less commonly used, options are also available:</p>\n<div class=\"variablelist\">\n<dl class=\"variablelist\">\n<dt id=\"APP-INITDB-OPTION-SET\"><span class=\"term\"><code class=\"option\">-c <em class=\"replaceable\"><code>name</code></em>=<em class=\"replaceable\"><code>value</code></em></code><br></span><span class=\"term\"><code class=\"option\">--set <em class=\"replaceable\"><code>name</code></em>=<em class=\"replaceable\"><code>value</code></em></code></span> </dt>\n<dd>\n<p>Forcibly set the server parameter <em class=\"replaceable\"><code>name</code></em> to <em class=\"replaceable\"><code>value</code></em> during <code class=\"command\">initdb</code>, and also install that setting in the generated <code class=\"filename\">postgresql.conf</code> 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.</p>\n</dd>\n<dt id=\"APP-INITDB-OPTION-DEBUG\"><span class=\"term\"><code class=\"option\">-d</code><br></span><span class=\"term\"><code class=\"option\">--debug</code></span> </dt>\n<dd>\n<p>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 <code class=\"command\">initdb</code> uses to create the catalog tables. This option generates a tremendous amount of extremely boring output.</p>\n</dd>\n<dt id=\"APP-INITDB-OPTION-DISCARD-CACHES\"><span class=\"term\"><code class=\"option\">--discard-caches</code></span> </dt>\n<dd>\n<p>Run the bootstrap backend with the <code class=\"literal\">debug_discard_caches=1</code> option. This takes a very long time and is only of use for deep debugging.</p>\n</dd>\n<dt id=\"APP-INITDB-OPTION-L\"><span class=\"term\"><code class=\"option\">-L <em class=\"replaceable\"><code>directory</code></em></code></span> </dt>\n<dd>\n<p>Specifies where <code class=\"command\">initdb</code> 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.</p>\n</dd>\n<dt id=\"APP-INITDB-OPTION-NO-CLEAN\"><span class=\"term\"><code class=\"option\">-n</code><br></span><span class=\"term\"><code class=\"option\">--no-clean</code></span> </dt>\n<dd>\n<p>By default, when <code class=\"command\">initdb</code> 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.</p>\n</dd>\n</dl>\n</div>\n<p>Other options:</p>\n<div class=\"variablelist\">\n<dl class=\"variablelist\">\n<dt id=\"APP-INITDB-OPTION-VERSION\"><span class=\"term\"><code class=\"option\">-V</code><br></span><span class=\"term\"><code class=\"option\">--version</code></span> </dt>\n<dd>\n<p>Print the <span class=\"application\">initdb</span> version and exit.</p>\n</dd>\n<dt id=\"APP-INITDB-OPTION-HELP\"><span class=\"term\"><code class=\"option\">-?</code><br></span><span class=\"term\"><code class=\"option\">--help</code></span> </dt>\n<dd>\n<p>Show help about <span class=\"application\">initdb</span> command line arguments, and exit.</p>\n</dd>\n</dl>\n</div>\n</div>\n<div class=\"refsect1\" id=\"id-1.9.5.3.7\">\n<h2>Environment</h2>\n<div class=\"variablelist\">\n<dl class=\"variablelist\">\n<dt id=\"APP-INITDB-ENVIRONMENT-PGDATA\"><span class=\"term\"><code class=\"envar\">PGDATA</code></span> </dt>\n<dd>\n<p>Specifies the directory where the database cluster is to be stored; can be overridden using the <code class=\"option\">-D</code> option.</p>\n</dd>\n<dt id=\"APP-INITDB-ENVIRONMENT-PG-COLOR\"><span class=\"term\"><code class=\"envar\">PG_COLOR</code></span> </dt>\n<dd>\n<p>Specifies whether to use color in diagnostic messages. Possible values are <code class=\"literal\">always</code>, <code class=\"literal\">auto</code> and <code class=\"literal\">never</code>.</p>\n</dd>\n<dt id=\"APP-INITDB-ENVIRONMENT-TZ\"><span class=\"term\"><code class=\"envar\">TZ</code></span> </dt>\n<dd>\n<p>Specifies the default time zone of the created database cluster. The value should be a full time zone name (see <a class=\"xref\" href=\"/docs/16/datatype-datetime.html#DATATYPE-TIMEZONES\" title=\"8.5.3.\u00a0Time Zones\">Section\u00a08.5.3</a>).</p>\n</dd>\n</dl>\n</div>\n</div>\n<div class=\"refsect1\" id=\"id-1.9.5.3.8\">\n<h2>Notes</h2>\n<p><code class=\"command\">initdb</code> can also be invoked via <code class=\"command\">pg_ctl initdb</code>.</p>\n</div>\n<div class=\"refsect1\" id=\"id-1.9.5.3.9\">\n<h2>See Also</h2><span class=\"simplelist\"><a class=\"xref\" href=\"/docs/16/app-pg-ctl.html\" title=\"pg_ctl\"><span class=\"refentrytitle\"><span class=\"application\">pg_ctl</span></span></a>, <a class=\"xref\" href=\"/docs/16/app-postgres.html\" title=\"postgres\"><span class=\"refentrytitle\"><span class=\"application\">postgres</span></span></a>, <a class=\"xref\" href=\"/docs/16/auth-pg-hba-conf.html\" title=\"21.1.\u00a0The pg_hba.conf File\">Section\u00a021.1</a></span>\n</div>\n</div></div>", "manual_path": "app-initdb.html", "comparison_data": {"options": [{"names": ["-A authmethod", "--auth= authmethod"], "signature": "-A authmethod --auth= authmethod", "description": "This option specifies the default authentication method for local users used in pg_hba.conf ( host and local lines). See Section 21.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": ["--auth-host= authmethod"], "signature": "--auth-host= authmethod", "description": "This option specifies the authentication method for local users via TCP/IP connections used in pg_hba.conf ( host lines)."}, {"names": ["--auth-local= authmethod"], "signature": "--auth-local= authmethod", "description": "This option specifies the authentication method for local users via Unix-domain socket connections used in pg_hba.conf ( local lines)."}, {"names": ["-D directory", "--pgdata= directory"], "signature": "-D directory --pgdata= directory", "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": ["-E encoding", "--encoding= encoding"], "signature": "-E encoding --encoding= encoding", "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 24.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": ["-g", "--allow-group-access"], "signature": "-g --allow-group-access", "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": ["--icu-locale= locale"], "signature": "--icu-locale= locale", "description": "Specifies the ICU locale when the ICU provider is used. Locale support is described in Section 24.1 ."}, {"names": ["--icu-rules= rules"], "signature": "--icu-rules= rules", "description": "Specifies additional collation rules to customize the behavior of the default collation. This is supported for ICU only."}, {"names": ["-k", "--data-checksums"], "signature": "-k --data-checksums", "description": "Use checksums on data pages to help detect corruption by the I/O system that would otherwise be silent. Enabling checksums may incur a noticeable 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 30.2 for details."}, {"names": ["--locale= locale"], "signature": "--locale= locale", "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 24.1 ."}, {"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": "Like --locale , but only sets the locale in the specified category."}, {"names": ["--no-locale"], "signature": "--no-locale", "description": "Equivalent to --locale=C ."}, {"names": ["--locale-provider={ libc | icu }"], "signature": "--locale-provider={ libc | icu }", "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 24.1.4 )."}, {"names": ["-N", "--no-sync"], "signature": "-N --no-sync", "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": ["--no-instructions"], "signature": "--no-instructions", "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": ["--pwfile= filename"], "signature": "--pwfile= filename", "description": "Makes initdb read the bootstrap superuser's password from a file. The first line of the file is taken as the password."}, {"names": ["-S", "--sync-only"], "signature": "-S --sync-only", "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": ["-T config", "--text-search-config= config"], "signature": "-T config --text-search-config= config", "description": "Sets the default text search configuration. See default_text_search_config for further information."}, {"names": ["-U username", "--username= username"], "signature": "-U username --username= username", "description": "Sets the user name of the bootstrap superuser . This defaults to the name of the operating-system user running initdb ."}, {"names": ["-W", "--pwprompt"], "signature": "-W --pwprompt", "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": ["-X directory", "--waldir= directory"], "signature": "-X directory --waldir= directory", "description": "This option specifies the directory where the write-ahead log should be stored."}, {"names": ["--wal-segsize= size"], "signature": "--wal-segsize= size", "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": ["-c name = value", "--set name = value"], "signature": "-c name = value --set name = value", "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": ["-d", "--debug"], "signature": "-d --debug", "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": ["--discard-caches"], "signature": "--discard-caches", "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": ["-L directory"], "signature": "-L directory", "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": ["-n", "--no-clean"], "signature": "-n --no-clean", "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": ["-V", "--version"], "signature": "-V --version", "description": "Print the initdb version and exit."}, {"names": ["-?", "--help"], "signature": "-? --help", "description": "Show help about initdb command line arguments, and exit."}], "synopsis": ["initdb [ option ...] [ --pgdata | -D ] directory"], "environment": [{"name": "PGDATA", "description": "Specifies the directory where the database cluster is to be stored; can be overridden using the -D option."}, {"name": "PG_COLOR", "description": "Specifies whether to use color in diagnostic messages. Possible values are always , auto and never ."}, {"name": "TZ", "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 )."}]}, "comparison_hash": "41c841d53768f6e998073c944b6ce35aada6357ed0aece6b15d07297a7d25faf"}, "17": {"facts": [{"label": "Documented executable", "value": "initdb"}, {"label": "Executable version", "value": "17.11"}, {"label": "Reference inventory", "value": "Server applications"}, {"label": "Option definition groups", "value": "32"}], "tables": [{"key": "options", "rows": [{"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": {"url": "/docs/17/app-initdb.html#APP-INITDB-OPTION-AUTH", "text": "-A authmethod --auth= authmethod"}}, {"summary": "This option specifies the authentication method for local users via TCP/IP connections used in pg_hba.conf ( host lines).", "signature": {"url": "/docs/17/app-initdb.html#APP-INITDB-OPTION-AUTH-HOST", "text": "--auth-host= authmethod"}}, {"summary": "This option specifies the authentication method for local users via Unix-domain socket connections used in pg_hba.conf ( local lines).", "signature": {"url": "/docs/17/app-initdb.html#APP-INITDB-OPTION-AUTH-LOCAL", "text": "--auth-local= authmethod"}}, {"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": {"url": "/docs/17/app-initdb.html#APP-INITDB-OPTION-PGDATA", "text": "-D directory --pgdata= directory"}}, {"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": {"url": "/docs/17/app-initdb.html#APP-INITDB-OPTION-ENCODING", "text": "-E encoding --encoding= encoding"}}, {"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": {"url": "/docs/17/app-initdb.html#APP-INITDB-ALLOW-GROUP-ACCESS", "text": "-g --allow-group-access"}}, {"summary": "Specifies the ICU locale when the ICU provider is used. Locale support is described in Section 23.1 .", "signature": {"url": "/docs/17/app-initdb.html#APP-INITDB-ICU-LOCALE", "text": "--icu-locale= locale"}}, {"summary": "Specifies additional collation rules to customize the behavior of the default collation. This is supported for ICU only.", "signature": {"url": "/docs/17/app-initdb.html#APP-INITDB-ICU-RULES", "text": "--icu-rules= rules"}}, {"summary": "Use checksums on data pages to help detect corruption by the I/O system that would otherwise be silent. Enabling checksums may incur a noticeable 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.", "signature": {"url": "/docs/17/app-initdb.html#APP-INITDB-DATA-CHECKSUMS", "text": "-k --data-checksums"}}, {"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": {"url": "/docs/17/app-initdb.html#APP-INITDB-OPTION-LOCALE", "text": "--locale= locale"}}, {"summary": "Like --locale , but only sets the locale in the specified category.", "signature": {"url": "/docs/17/app-initdb.html#APP-INITDB-OPTION-LC-COLLATE", "text": "--lc-collate= locale --lc-ctype= locale --lc-messages= locale --lc-monetary= locale --lc-numeric= locale --lc-time= locale"}}, {"summary": "Equivalent to --locale=C .", "signature": {"url": "/docs/17/app-initdb.html#APP-INITDB-OPTION-NO-LOCALE", "text": "--no-locale"}}, {"summary": "Specifies the locale name when the builtin provider is used. Locale support is described in Section 23.1 .", "signature": {"url": "/docs/17/app-initdb.html#APP-INITDB-BUILTIN-LOCALE", "text": "--builtin-locale= locale"}}, {"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": {"url": "/docs/17/app-initdb.html#APP-INITDB-OPTION-LOCALE-PROVIDER", "text": "--locale-provider={ builtin | libc | icu }"}}, {"summary": "Makes initdb read the bootstrap superuser's password from a file. The first line of the file is taken as the password.", "signature": {"url": "/docs/17/app-initdb.html#APP-INITDB-OPTION-PWFILE", "text": "--pwfile= filename"}}, {"summary": "Sets the default text search configuration. See default_text_search_config for further information.", "signature": {"url": "/docs/17/app-initdb.html#APP-INITDB-OPTION-TEXT-SEARCH-CONFIG", "text": "-T config --text-search-config= config"}}, {"summary": "Sets the user name of the bootstrap superuser . This defaults to the name of the operating-system user running initdb .", "signature": {"url": "/docs/17/app-initdb.html#APP-INITDB-OPTION-USERNAME", "text": "-U username --username= username"}}, {"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": {"url": "/docs/17/app-initdb.html#APP-INITDB-OPTION-PWPROMPT", "text": "-W --pwprompt"}}, {"summary": "This option specifies the directory where the write-ahead log should be stored.", "signature": {"url": "/docs/17/app-initdb.html#APP-INITDB-OPTION-WALDIR", "text": "-X directory --waldir= directory"}}, {"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": {"url": "/docs/17/app-initdb.html#APP-INITDB-OPTION-WAL-SEGSIZE", "text": "--wal-segsize= size"}}, {"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": {"url": "/docs/17/app-initdb.html#APP-INITDB-OPTION-SET", "text": "-c name = value --set name = value"}}, {"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": {"url": "/docs/17/app-initdb.html#APP-INITDB-OPTION-DEBUG", "text": "-d --debug"}}, {"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": {"url": "/docs/17/app-initdb.html#APP-INITDB-OPTION-DISCARD-CACHES", "text": "--discard-caches"}}, {"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": {"url": "/docs/17/app-initdb.html#APP-INITDB-OPTION-L", "text": "-L directory"}}, {"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": {"url": "/docs/17/app-initdb.html#APP-INITDB-OPTION-NO-CLEAN", "text": "-n --no-clean"}}, {"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": {"url": "/docs/17/app-initdb.html#APP-INITDB-OPTION-NO-SYNC", "text": "-N --no-sync"}}, {"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": {"url": "/docs/17/app-initdb.html#APP-INITDB-OPTION-NO-INSTRUCTIONS", "text": "--no-instructions"}}, {"summary": "Show internal settings and exit, without doing anything else. This can be used to debug the initdb installation.", "signature": {"url": "/docs/17/app-initdb.html#APP-INITDB-OPTION-SHOW", "text": "-s --show"}}, {"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": {"url": "/docs/17/app-initdb.html#APP-INITDB-OPTION-SYNC-METHOD", "text": "--sync-method= method"}}, {"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": {"url": "/docs/17/app-initdb.html#APP-INITDB-OPTION-SYNC-ONLY", "text": "-S --sync-only"}}, {"summary": "Print the initdb version and exit.", "signature": {"url": "/docs/17/app-initdb.html#APP-INITDB-OPTION-VERSION", "text": "-V --version"}}, {"summary": "Show help about initdb command line arguments, and exit.", "signature": {"url": "/docs/17/app-initdb.html#APP-INITDB-OPTION-HELP", "text": "-? --help"}}], "title": "Documented options", "columns": [{"key": "signature", "label": "Option and arguments"}, {"key": "summary", "label": "Description"}]}, {"key": "environment", "rows": [{"name": "PGDATA", "description": "Specifies the directory where the database cluster is to be stored; can be overridden using the -D option."}, {"name": "PG_COLOR", "description": "Specifies whether to use color in diagnostic messages. Possible values are always , auto and never ."}, {"name": "TZ", "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 )."}], "title": "Environment variables", "columns": [{"key": "name", "label": "Variable"}, {"key": "description", "label": "Meaning"}]}], "options": [{"names": ["-A authmethod", "--auth= authmethod"], "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": "-A authmethod --auth= authmethod", "source_url": "/docs/17/app-initdb.html#APP-INITDB-OPTION-AUTH", "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": ["--auth-host= authmethod"], "summary": "This option specifies the authentication method for local users via TCP/IP connections used in pg_hba.conf ( host lines).", "signature": "--auth-host= authmethod", "source_url": "/docs/17/app-initdb.html#APP-INITDB-OPTION-AUTH-HOST", "description": "This option specifies the authentication method for local users via TCP/IP connections used in pg_hba.conf ( host lines)."}, {"names": ["--auth-local= authmethod"], "summary": "This option specifies the authentication method for local users via Unix-domain socket connections used in pg_hba.conf ( local lines).", "signature": "--auth-local= authmethod", "source_url": "/docs/17/app-initdb.html#APP-INITDB-OPTION-AUTH-LOCAL", "description": "This option specifies the authentication method for local users via Unix-domain socket connections used in pg_hba.conf ( local lines)."}, {"names": ["-D directory", "--pgdata= directory"], "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": "-D directory --pgdata= directory", "source_url": "/docs/17/app-initdb.html#APP-INITDB-OPTION-PGDATA", "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": ["-E encoding", "--encoding= 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": "-E encoding --encoding= encoding", "source_url": "/docs/17/app-initdb.html#APP-INITDB-OPTION-ENCODING", "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": ["-g", "--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": "-g --allow-group-access", "source_url": "/docs/17/app-initdb.html#APP-INITDB-ALLOW-GROUP-ACCESS", "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": ["--icu-locale= locale"], "summary": "Specifies the ICU locale when the ICU provider is used. Locale support is described in Section 23.1 .", "signature": "--icu-locale= locale", "source_url": "/docs/17/app-initdb.html#APP-INITDB-ICU-LOCALE", "description": "Specifies the ICU locale when the ICU provider is used. Locale support is described in Section 23.1 ."}, {"names": ["--icu-rules= rules"], "summary": "Specifies additional collation rules to customize the behavior of the default collation. This is supported for ICU only.", "signature": "--icu-rules= rules", "source_url": "/docs/17/app-initdb.html#APP-INITDB-ICU-RULES", "description": "Specifies additional collation rules to customize the behavior of the default collation. This is supported for ICU only."}, {"names": ["-k", "--data-checksums"], "summary": "Use checksums on data pages to help detect corruption by the I/O system that would otherwise be silent. Enabling checksums may incur a noticeable 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.", "signature": "-k --data-checksums", "source_url": "/docs/17/app-initdb.html#APP-INITDB-DATA-CHECKSUMS", "description": "Use checksums on data pages to help detect corruption by the I/O system that would otherwise be silent. Enabling checksums may incur a noticeable 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": ["--locale= 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": "--locale= locale", "source_url": "/docs/17/app-initdb.html#APP-INITDB-OPTION-LOCALE", "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 or C.UTF-8 ."}, {"names": ["--lc-collate= locale", "--lc-ctype= locale", "--lc-messages= locale", "--lc-monetary= locale", "--lc-numeric= locale", "--lc-time= locale"], "summary": "Like --locale , but only sets the locale in the specified category.", "signature": "--lc-collate= locale --lc-ctype= locale --lc-messages= locale --lc-monetary= locale --lc-numeric= locale --lc-time= locale", "source_url": "/docs/17/app-initdb.html#APP-INITDB-OPTION-LC-COLLATE", "description": "Like --locale , but only sets the locale in the specified category."}, {"names": ["--no-locale"], "summary": "Equivalent to --locale=C .", "signature": "--no-locale", "source_url": "/docs/17/app-initdb.html#APP-INITDB-OPTION-NO-LOCALE", "description": "Equivalent to --locale=C ."}, {"names": ["--builtin-locale= locale"], "summary": "Specifies the locale name when the builtin provider is used. Locale support is described in Section 23.1 .", "signature": "--builtin-locale= locale", "source_url": "/docs/17/app-initdb.html#APP-INITDB-BUILTIN-LOCALE", "description": "Specifies the locale name when the builtin provider is used. Locale support is described in Section 23.1 ."}, {"names": ["--locale-provider={ builtin | libc | icu }"], "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": "--locale-provider={ builtin | libc | icu }", "source_url": "/docs/17/app-initdb.html#APP-INITDB-OPTION-LOCALE-PROVIDER", "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": ["--pwfile= filename"], "summary": "Makes initdb read the bootstrap superuser's password from a file. The first line of the file is taken as the password.", "signature": "--pwfile= filename", "source_url": "/docs/17/app-initdb.html#APP-INITDB-OPTION-PWFILE", "description": "Makes initdb read the bootstrap superuser's password from a file. The first line of the file is taken as the password."}, {"names": ["-T config", "--text-search-config= config"], "summary": "Sets the default text search configuration. See default_text_search_config for further information.", "signature": "-T config --text-search-config= config", "source_url": "/docs/17/app-initdb.html#APP-INITDB-OPTION-TEXT-SEARCH-CONFIG", "description": "Sets the default text search configuration. See default_text_search_config for further information."}, {"names": ["-U username", "--username= username"], "summary": "Sets the user name of the bootstrap superuser . This defaults to the name of the operating-system user running initdb .", "signature": "-U username --username= username", "source_url": "/docs/17/app-initdb.html#APP-INITDB-OPTION-USERNAME", "description": "Sets the user name of the bootstrap superuser . This defaults to the name of the operating-system user running initdb ."}, {"names": ["-W", "--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": "-W --pwprompt", "source_url": "/docs/17/app-initdb.html#APP-INITDB-OPTION-PWPROMPT", "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": ["-X directory", "--waldir= directory"], "summary": "This option specifies the directory where the write-ahead log should be stored.", "signature": "-X directory --waldir= directory", "source_url": "/docs/17/app-initdb.html#APP-INITDB-OPTION-WALDIR", "description": "This option specifies the directory where the write-ahead log should be stored."}, {"names": ["--wal-segsize= size"], "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": "--wal-segsize= size", "source_url": "/docs/17/app-initdb.html#APP-INITDB-OPTION-WAL-SEGSIZE", "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": ["-c name = value", "--set name = value"], "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": "-c name = value --set name = value", "source_url": "/docs/17/app-initdb.html#APP-INITDB-OPTION-SET", "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": ["-d", "--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": "-d --debug", "source_url": "/docs/17/app-initdb.html#APP-INITDB-OPTION-DEBUG", "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": ["--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": "--discard-caches", "source_url": "/docs/17/app-initdb.html#APP-INITDB-OPTION-DISCARD-CACHES", "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": ["-L directory"], "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": "-L directory", "source_url": "/docs/17/app-initdb.html#APP-INITDB-OPTION-L", "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": ["-n", "--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": "-n --no-clean", "source_url": "/docs/17/app-initdb.html#APP-INITDB-OPTION-NO-CLEAN", "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-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": "-N --no-sync", "source_url": "/docs/17/app-initdb.html#APP-INITDB-OPTION-NO-SYNC", "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": ["--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": "--no-instructions", "source_url": "/docs/17/app-initdb.html#APP-INITDB-OPTION-NO-INSTRUCTIONS", "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": ["-s", "--show"], "summary": "Show internal settings and exit, without doing anything else. This can be used to debug the initdb installation.", "signature": "-s --show", "source_url": "/docs/17/app-initdb.html#APP-INITDB-OPTION-SHOW", "description": "Show internal settings and exit, without doing anything else. This can be used to debug the initdb installation."}, {"names": ["--sync-method= 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": "--sync-method= method", "source_url": "/docs/17/app-initdb.html#APP-INITDB-OPTION-SYNC-METHOD", "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": ["-S", "--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": "-S --sync-only", "source_url": "/docs/17/app-initdb.html#APP-INITDB-OPTION-SYNC-ONLY", "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": ["-V", "--version"], "summary": "Print the initdb version and exit.", "signature": "-V --version", "source_url": "/docs/17/app-initdb.html#APP-INITDB-OPTION-VERSION", "description": "Print the initdb version and exit."}, {"names": ["-?", "--help"], "summary": "Show help about initdb command line arguments, and exit.", "signature": "-? --help", "source_url": "/docs/17/app-initdb.html#APP-INITDB-OPTION-HELP", "description": "Show help about initdb command line arguments, and exit."}], "related": [], "release": {"ref": "https://ftp.postgresql.org/pub/source/v17.11/postgresql-17.11.tar.bz2", "label": "17.11", "major": "17", "channel": "stable", "manifest": {"pdf": {"A4": {"url": "/files/documentation/pdf/17/postgresql-17-A4.pdf", "bytes": 15521293, "pages": 3099, "sha256": "1991354df0dc89e70ec39328c28988ef8b19c6a93671dab3893650b63e9f4e36", "built_at": "2026-09-26"}, "US": {"url": "/files/documentation/pdf/17/postgresql-17-US.pdf", "bytes": 15398150, "pages": 3270, "sha256": "07696c8f38abf31babf22d2db337093936e7c472d2af36d050b000c49bbcf52c", "built_at": "2026-09-26"}}, "tree": "17", "index": "index.html", "major": "17", "pages": 1143, "release": "17.11", "source_url": "https://ftp.postgresql.org/pub/source/v17.11/postgresql-17.11.tar.bz2", "svg_assets": 3, "source_mode": "en SGML built with pinned official archive", "source_sha256": "dd27f2b3c59e73ed14aa3324901242bf69a032a6347805f274e6260322d42979"}, "revision": "58419c9b0dd42cb34c8d53695bb025a7e582edf55ccd4c5bcb1c2c7c71a37487", "evidence_kind": "English manual and source declarations", "source_sha256": "dd27f2b3c59e73ed14aa3324901242bf69a032a6347805f274e6260322d42979"}, "sources": [{"url": "/docs/17/app-initdb.html", "file": "app-initdb.html", "label": "17.11 English manual \u00b7 app-initdb.html", "anchor": "", "sha256": "26c920120a4b5aa7feb0fe2c0055c8137da185fda8df17f52483dff750bf0b28"}, {"url": "/docs/17/reference-server.html", "file": "reference-server.html", "label": "Server applications inventory", "anchor": "", "sha256": "01f07993ff020684f4c290d17cdafa26fb17ea5c1d476bc3a5efc68bf8ddd9b9"}], "sections": [], "synopsis": ["initdb [ option ...] [ --pgdata | -D ] directory"], "signature": "initdb [ option ...] [ --pgdata | -D ] directory", "description": ["initdb \u2014 create a new PostgreSQL database cluster"], "environment": [{"name": "PGDATA", "description": "Specifies the directory where the database cluster is to be stored; can be overridden using the -D option."}, {"name": "PG_COLOR", "description": "Specifies whether to use color in diagnostic messages. Possible values are always , auto and never ."}, {"name": "TZ", "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 )."}], "manual_html": "<div><div class=\"refentry\" id=\"APP-INITDB\">\n<div class=\"titlepage\"></div>\n<div class=\"refnamediv\">\n<h2><span class=\"refentrytitle\"><span class=\"application\">initdb</span></span></h2>\n<p>initdb \u2014 create a new <span class=\"productname\">PostgreSQL</span> database cluster</p>\n</div>\n<div class=\"refsynopsisdiv\">\n<h2>Synopsis</h2>\n<div class=\"cmdsynopsis\">\n<p id=\"id-1.9.5.3.4.1\"><code class=\"command\">initdb</code> [<em class=\"replaceable\"><code>option</code></em>...] [ <code class=\"option\">--pgdata</code> | <code class=\"option\">-D</code> ] <em class=\"replaceable\"><code>directory</code></em></p>\n</div>\n</div>\n<div class=\"refsect1\" id=\"R1-APP-INITDB-1\">\n<h2>Description</h2>\n<p><code class=\"command\">initdb</code> creates a new <span class=\"productname\">PostgreSQL</span> <a class=\"glossterm\" href=\"/docs/17/glossary.html#GLOSSARY-DB-CLUSTER\"></a><a class=\"glossterm\" href=\"/docs/17/glossary.html#GLOSSARY-DB-CLUSTER\" title=\"Database cluster\">database cluster</a>.</p>\n<p>Creating a database cluster consists of creating the <a class=\"glossterm\" href=\"/docs/17/glossary.html#GLOSSARY-DATA-DIRECTORY\"></a><a class=\"glossterm\" href=\"/docs/17/glossary.html#GLOSSARY-DATA-DIRECTORY\" title=\"Data directory\">directories</a> 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 <code class=\"literal\">postgres</code>, <code class=\"literal\">template1</code>, and <code class=\"literal\">template0</code> databases. The <code class=\"literal\">postgres</code> database is a default database meant for use by users, utilities and third party applications. <code class=\"literal\">template1</code> and <code class=\"literal\">template0</code> are meant as source databases to be copied by later <code class=\"command\">CREATE DATABASE</code> commands. <code class=\"literal\">template0</code> should never be modified, but you can add objects to <code class=\"literal\">template1</code>, which by default will be copied into databases created later. See <a class=\"xref\" href=\"/docs/17/manage-ag-templatedbs.html\" title=\"22.3.\u00a0Template Databases\">Section\u00a022.3</a> for more details.</p>\n<p>Although <code class=\"command\">initdb</code> 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 <code class=\"command\">chown</code> to assign ownership of that directory to the database user account, then <code class=\"command\">su</code> to become the database user to run <code class=\"command\">initdb</code>.</p>\n<p><code class=\"command\">initdb</code> 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 <code class=\"command\">initdb</code> creates. Since the server cannot be run as root, you must not run <code class=\"command\">initdb</code> as root either. (It will in fact refuse to do so.)</p>\n<p>For security reasons the new cluster created by <code class=\"command\">initdb</code> will only be accessible by the cluster owner by default. The <code class=\"option\">--allow-group-access</code> 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.</p>\n<p><code class=\"command\">initdb</code> initializes the database cluster's default locale and character set encoding. These can also be set separately for each database when it is created. <code class=\"command\">initdb</code> determines those settings for the template databases, which will serve as the default for all other databases.</p>\n<p>By default, <code class=\"command\">initdb</code> uses the locale provider <code class=\"literal\">libc</code> (see <a class=\"xref\" href=\"/docs/17/locale.html#LOCALE-PROVIDERS\" title=\"23.1.4.\u00a0Locale Providers\">Section\u00a023.1.4</a>). The <code class=\"literal\">libc</code> locale provider takes the locale settings from the environment, and determines the encoding from the locale settings.</p>\n<p>To choose a different locale for the cluster, use the option <code class=\"option\">--locale</code>. There are also individual options <code class=\"option\">--lc-*</code> and <code class=\"option\">--icu-locale</code> (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.</p>\n<p>Alternatively, <code class=\"command\">initdb</code> can use the ICU library to provide locale services by specifying <code class=\"literal\">--locale-provider=icu</code>. The server must be built with ICU support. To choose the specific ICU locale ID to apply, use the option <code class=\"option\">--icu-locale</code>. Note that for implementation reasons and to support legacy code, <code class=\"command\">initdb</code> will still select and initialize libc locale settings when the ICU locale provider is used.</p>\n<p>When <code class=\"command\">initdb</code> 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.</p>\n<p>More details about locale settings can be found in <a class=\"xref\" href=\"/docs/17/locale.html\" title=\"23.1.\u00a0Locale Support\">Section\u00a023.1</a>.</p>\n<p>To alter the default encoding, use the <code class=\"option\">--encoding</code>. More details can be found in <a class=\"xref\" href=\"/docs/17/multibyte.html\" title=\"23.3.\u00a0Character Set Support\">Section\u00a023.3</a>.</p>\n</div>\n<div class=\"refsect1\" id=\"id-1.9.5.3.6\">\n<h2>Options</h2>\n<div class=\"variablelist\">\n<dl class=\"variablelist\">\n<dt id=\"APP-INITDB-OPTION-AUTH\"><span class=\"term\"><code class=\"option\">-A <em class=\"replaceable\"><code>authmethod</code></em></code><br></span><span class=\"term\"><code class=\"option\">--auth=<em class=\"replaceable\"><code>authmethod</code></em></code></span> </dt>\n<dd>\n<p>This option specifies the default authentication method for local users used in <code class=\"filename\">pg_hba.conf</code> (<code class=\"literal\">host</code> and <code class=\"literal\">local</code> lines). See <a class=\"xref\" href=\"/docs/17/auth-pg-hba-conf.html\" title=\"20.1.\u00a0The pg_hba.conf File\">Section\u00a020.1</a> for an overview of valid values.</p>\n<p><code class=\"command\">initdb</code> will prepopulate <code class=\"filename\">pg_hba.conf</code> entries using the specified authentication method for non-replication as well as replication connections.</p>\n<p>Do not use <code class=\"literal\">trust</code> unless you trust all local users on your system. <code class=\"literal\">trust</code> is the default for ease of installation.</p>\n</dd>\n<dt id=\"APP-INITDB-OPTION-AUTH-HOST\"><span class=\"term\"><code class=\"option\">--auth-host=<em class=\"replaceable\"><code>authmethod</code></em></code></span> </dt>\n<dd>\n<p>This option specifies the authentication method for local users via TCP/IP connections used in <code class=\"filename\">pg_hba.conf</code> (<code class=\"literal\">host</code> lines).</p>\n</dd>\n<dt id=\"APP-INITDB-OPTION-AUTH-LOCAL\"><span class=\"term\"><code class=\"option\">--auth-local=<em class=\"replaceable\"><code>authmethod</code></em></code></span> </dt>\n<dd>\n<p>This option specifies the authentication method for local users via Unix-domain socket connections used in <code class=\"filename\">pg_hba.conf</code> (<code class=\"literal\">local</code> lines).</p>\n</dd>\n<dt id=\"APP-INITDB-OPTION-PGDATA\"><span class=\"term\"><code class=\"option\">-D <em class=\"replaceable\"><code>directory</code></em></code><br></span><span class=\"term\"><code class=\"option\">--pgdata=<em class=\"replaceable\"><code>directory</code></em></code></span> </dt>\n<dd>\n<p>This option specifies the directory where the database cluster should be stored. This is the only information required by <code class=\"command\">initdb</code>, but you can avoid writing it by setting the <code class=\"envar\">PGDATA</code> environment variable, which can be convenient since the database server (<code class=\"command\">postgres</code>) can find the data directory later by the same variable.</p>\n</dd>\n<dt id=\"APP-INITDB-OPTION-ENCODING\"><span class=\"term\"><code class=\"option\">-E <em class=\"replaceable\"><code>encoding</code></em></code><br></span><span class=\"term\"><code class=\"option\">--encoding=<em class=\"replaceable\"><code>encoding</code></em></code></span> </dt>\n<dd>\n<p>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 <span class=\"productname\">PostgreSQL</span> server are described in <a class=\"xref\" href=\"/docs/17/multibyte.html#MULTIBYTE-CHARSET-SUPPORTED\" title=\"23.3.1.\u00a0Supported Character Sets\">Section\u00a023.3.1</a>.</p>\n<p>By default, the template database encoding is derived from the locale. If <a class=\"xref\" href=\"/docs/17/app-initdb.html#APP-INITDB-OPTION-NO-LOCALE\"><code class=\"option\">--no-locale</code></a> is specified (or equivalently, if the locale is <code class=\"literal\">C</code> or <code class=\"literal\">POSIX</code>), then the default is <code class=\"literal\">UTF8</code> for the ICU provider and <code class=\"literal\">SQL_ASCII</code> for the <code class=\"literal\">libc</code> provider.</p>\n</dd>\n<dt id=\"APP-INITDB-ALLOW-GROUP-ACCESS\"><span class=\"term\"><code class=\"option\">-g</code><br></span><span class=\"term\"><code class=\"option\">--allow-group-access</code></span> </dt>\n<dd>\n<p>Allows users in the same group as the cluster owner to read all cluster files created by <code class=\"command\">initdb</code>. This option is ignored on <span class=\"productname\">Windows</span> as it does not support POSIX-style group permissions.</p>\n</dd>\n<dt id=\"APP-INITDB-ICU-LOCALE\"><span class=\"term\"><code class=\"option\">--icu-locale=<em class=\"replaceable\"><code>locale</code></em></code></span> </dt>\n<dd>\n<p>Specifies the ICU locale when the ICU provider is used. Locale support is described in <a class=\"xref\" href=\"/docs/17/locale.html\" title=\"23.1.\u00a0Locale Support\">Section\u00a023.1</a>.</p>\n</dd>\n<dt id=\"APP-INITDB-ICU-RULES\"><span class=\"term\"><code class=\"option\">--icu-rules=<em class=\"replaceable\"><code>rules</code></em></code></span> </dt>\n<dd>\n<p>Specifies additional collation rules to customize the behavior of the default collation. This is supported for ICU only.</p>\n</dd>\n<dt id=\"APP-INITDB-DATA-CHECKSUMS\"><span class=\"term\"><code class=\"option\">-k</code><br></span><span class=\"term\"><code class=\"option\">--data-checksums</code></span> </dt>\n<dd>\n<p>Use checksums on data pages to help detect corruption by the I/O system that would otherwise be silent. Enabling checksums may incur a noticeable performance penalty. If set, checksums are calculated for all objects, in all databases. All checksum failures will be reported in the <a class=\"link\" href=\"/docs/17/monitoring-stats.html#MONITORING-PG-STAT-DATABASE-VIEW\" title=\"27.2.17.\u00a0pg_stat_database\"><code class=\"structname\">pg_stat_database</code></a> view. See <a class=\"xref\" href=\"/docs/17/checksums.html\" title=\"28.2.\u00a0Data Checksums\">Section\u00a028.2</a> for details.</p>\n</dd>\n<dt id=\"APP-INITDB-OPTION-LOCALE\"><span class=\"term\"><code class=\"option\">--locale=<em class=\"replaceable\"><code>locale</code></em></code></span> </dt>\n<dd>\n<p>Sets the default locale for the database cluster. If this option is not specified, the locale is inherited from the environment that <code class=\"command\">initdb</code> runs in. Locale support is described in <a class=\"xref\" href=\"/docs/17/locale.html\" title=\"23.1.\u00a0Locale Support\">Section\u00a023.1</a>.</p>\n<p>If <code class=\"option\">--locale-provider</code> is <code class=\"literal\">builtin</code>, <code class=\"option\">--locale</code> or <code class=\"option\">--builtin-locale</code> must be specified and set to <code class=\"literal\">C</code> or <code class=\"literal\">C.UTF-8</code>.</p>\n</dd>\n<dt id=\"APP-INITDB-OPTION-LC-COLLATE\"><span class=\"term\"><code class=\"option\">--lc-collate=<em class=\"replaceable\"><code>locale</code></em></code><br></span><span class=\"term\"><code class=\"option\">--lc-ctype=<em class=\"replaceable\"><code>locale</code></em></code><br></span><span class=\"term\"><code class=\"option\">--lc-messages=<em class=\"replaceable\"><code>locale</code></em></code><br></span><span class=\"term\"><code class=\"option\">--lc-monetary=<em class=\"replaceable\"><code>locale</code></em></code><br></span><span class=\"term\"><code class=\"option\">--lc-numeric=<em class=\"replaceable\"><code>locale</code></em></code><br></span><span class=\"term\"><code class=\"option\">--lc-time=<em class=\"replaceable\"><code>locale</code></em></code></span> </dt>\n<dd>\n<p>Like <code class=\"option\">--locale</code>, but only sets the locale in the specified category.</p>\n</dd>\n<dt id=\"APP-INITDB-OPTION-NO-LOCALE\"><span class=\"term\"><code class=\"option\">--no-locale</code></span> </dt>\n<dd>\n<p>Equivalent to <code class=\"option\">--locale=C</code>.</p>\n</dd>\n<dt id=\"APP-INITDB-BUILTIN-LOCALE\"><span class=\"term\"><code class=\"option\">--builtin-locale=<em class=\"replaceable\"><code>locale</code></em></code></span> </dt>\n<dd>\n<p>Specifies the locale name when the builtin provider is used. Locale support is described in <a class=\"xref\" href=\"/docs/17/locale.html\" title=\"23.1.\u00a0Locale Support\">Section\u00a023.1</a>.</p>\n</dd>\n<dt id=\"APP-INITDB-OPTION-LOCALE-PROVIDER\"><span class=\"term\"><code class=\"option\">--locale-provider={<code class=\"literal\">builtin</code>|<code class=\"literal\">libc</code>|<code class=\"literal\">icu</code>}</code></span> </dt>\n<dd>\n<p>This option sets the locale provider for databases created in the new cluster. It can be overridden in the <code class=\"command\">CREATE DATABASE</code> command when new databases are subsequently created. The default is <code class=\"literal\">libc</code> (see <a class=\"xref\" href=\"/docs/17/locale.html#LOCALE-PROVIDERS\" title=\"23.1.4.\u00a0Locale Providers\">Section\u00a023.1.4</a>).</p>\n</dd>\n<dt id=\"APP-INITDB-OPTION-PWFILE\"><span class=\"term\"><code class=\"option\">--pwfile=<em class=\"replaceable\"><code>filename</code></em></code></span> </dt>\n<dd>\n<p>Makes <code class=\"command\">initdb</code> read the bootstrap superuser's password from a file. The first line of the file is taken as the password.</p>\n</dd>\n<dt id=\"APP-INITDB-OPTION-TEXT-SEARCH-CONFIG\"><span class=\"term\"><code class=\"option\">-T <em class=\"replaceable\"><code>config</code></em></code><br></span><span class=\"term\"><code class=\"option\">--text-search-config=<em class=\"replaceable\"><code>config</code></em></code></span> </dt>\n<dd>\n<p>Sets the default text search configuration. See <a class=\"xref\" href=\"/docs/17/runtime-config-client.html#GUC-DEFAULT-TEXT-SEARCH-CONFIG\">default_text_search_config</a> for further information.</p>\n</dd>\n<dt id=\"APP-INITDB-OPTION-USERNAME\"><span class=\"term\"><code class=\"option\">-U <em class=\"replaceable\"><code>username</code></em></code><br></span><span class=\"term\"><code class=\"option\">--username=<em class=\"replaceable\"><code>username</code></em></code></span> </dt>\n<dd>\n<p>Sets the user name of the <a class=\"glossterm\" href=\"/docs/17/glossary.html#GLOSSARY-BOOTSTRAP-SUPERUSER\"></a><a class=\"glossterm\" href=\"/docs/17/glossary.html#GLOSSARY-BOOTSTRAP-SUPERUSER\" title=\"Bootstrap superuser\">bootstrap superuser</a>. This defaults to the name of the operating-system user running <code class=\"command\">initdb</code>.</p>\n</dd>\n<dt id=\"APP-INITDB-OPTION-PWPROMPT\"><span class=\"term\"><code class=\"option\">-W</code><br></span><span class=\"term\"><code class=\"option\">--pwprompt</code></span> </dt>\n<dd>\n<p>Makes <code class=\"command\">initdb</code> 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.</p>\n</dd>\n<dt id=\"APP-INITDB-OPTION-WALDIR\"><span class=\"term\"><code class=\"option\">-X <em class=\"replaceable\"><code>directory</code></em></code><br></span><span class=\"term\"><code class=\"option\">--waldir=<em class=\"replaceable\"><code>directory</code></em></code></span> </dt>\n<dd>\n<p>This option specifies the directory where the write-ahead log should be stored.</p>\n</dd>\n<dt id=\"APP-INITDB-OPTION-WAL-SEGSIZE\"><span class=\"term\"><code class=\"option\">--wal-segsize=<em class=\"replaceable\"><code>size</code></em></code></span> </dt>\n<dd>\n<p>Set the <em class=\"firstterm\">WAL segment size</em>, 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.</p>\n<p>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.</p>\n</dd>\n</dl>\n</div>\n<p>Other, less commonly used, options are also available:</p>\n<div class=\"variablelist\">\n<dl class=\"variablelist\">\n<dt id=\"APP-INITDB-OPTION-SET\"><span class=\"term\"><code class=\"option\">-c <em class=\"replaceable\"><code>name</code></em>=<em class=\"replaceable\"><code>value</code></em></code><br></span><span class=\"term\"><code class=\"option\">--set <em class=\"replaceable\"><code>name</code></em>=<em class=\"replaceable\"><code>value</code></em></code></span> </dt>\n<dd>\n<p>Forcibly set the server parameter <em class=\"replaceable\"><code>name</code></em> to <em class=\"replaceable\"><code>value</code></em> during <code class=\"command\">initdb</code>, and also install that setting in the generated <code class=\"filename\">postgresql.conf</code> 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.</p>\n</dd>\n<dt id=\"APP-INITDB-OPTION-DEBUG\"><span class=\"term\"><code class=\"option\">-d</code><br></span><span class=\"term\"><code class=\"option\">--debug</code></span> </dt>\n<dd>\n<p>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 <code class=\"command\">initdb</code> uses to create the catalog tables. This option generates a tremendous amount of extremely boring output.</p>\n</dd>\n<dt id=\"APP-INITDB-OPTION-DISCARD-CACHES\"><span class=\"term\"><code class=\"option\">--discard-caches</code></span> </dt>\n<dd>\n<p>Run the bootstrap backend with the <code class=\"literal\">debug_discard_caches=1</code> option. This takes a very long time and is only of use for deep debugging.</p>\n</dd>\n<dt id=\"APP-INITDB-OPTION-L\"><span class=\"term\"><code class=\"option\">-L <em class=\"replaceable\"><code>directory</code></em></code></span> </dt>\n<dd>\n<p>Specifies where <code class=\"command\">initdb</code> 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.</p>\n</dd>\n<dt id=\"APP-INITDB-OPTION-NO-CLEAN\"><span class=\"term\"><code class=\"option\">-n</code><br></span><span class=\"term\"><code class=\"option\">--no-clean</code></span> </dt>\n<dd>\n<p>By default, when <code class=\"command\">initdb</code> 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.</p>\n</dd>\n<dt id=\"APP-INITDB-OPTION-NO-SYNC\"><span class=\"term\"><code class=\"option\">-N</code><br></span><span class=\"term\"><code class=\"option\">--no-sync</code></span> </dt>\n<dd>\n<p>By default, <code class=\"command\">initdb</code> will wait for all files to be written safely to disk. This option causes <code class=\"command\">initdb</code> 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.</p>\n</dd>\n<dt id=\"APP-INITDB-OPTION-NO-INSTRUCTIONS\"><span class=\"term\"><code class=\"option\">--no-instructions</code></span> </dt>\n<dd>\n<p>By default, <code class=\"command\">initdb</code> 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 <code class=\"command\">initdb</code> in platform-specific behavior, where those instructions are likely to be incorrect.</p>\n</dd>\n<dt id=\"APP-INITDB-OPTION-SHOW\"><span class=\"term\"><code class=\"option\">-s</code><br></span><span class=\"term\"><code class=\"option\">--show</code></span> </dt>\n<dd>\n<p>Show internal settings and exit, without doing anything else. This can be used to debug the <span class=\"application\">initdb</span> installation.</p>\n</dd>\n<dt id=\"APP-INITDB-OPTION-SYNC-METHOD\"><span class=\"term\"><code class=\"option\">--sync-method=<em class=\"replaceable\"><code>method</code></em></code></span> </dt>\n<dd>\n<p>When set to <code class=\"literal\">fsync</code>, which is the default, <code class=\"command\">initdb</code> 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.</p>\n<p>On Linux, <code class=\"literal\">syncfs</code> 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 <a class=\"xref\" href=\"/docs/17/runtime-config-error-handling.html#GUC-RECOVERY-INIT-SYNC-METHOD\">recovery_init_sync_method</a> for information about the caveats to be aware of when using <code class=\"literal\">syncfs</code>.</p>\n<p>This option has no effect when <code class=\"option\">--no-sync</code> is used.</p>\n</dd>\n<dt id=\"APP-INITDB-OPTION-SYNC-ONLY\"><span class=\"term\"><code class=\"option\">-S</code><br></span><span class=\"term\"><code class=\"option\">--sync-only</code></span> </dt>\n<dd>\n<p>Safely write all database files to disk and exit. This does not perform any of the normal <span class=\"application\">initdb</span> operations. Generally, this option is useful for ensuring reliable recovery after changing <a class=\"xref\" href=\"/docs/17/runtime-config-wal.html#GUC-FSYNC\">fsync</a> from <code class=\"literal\">off</code> to <code class=\"literal\">on</code>.</p>\n</dd>\n</dl>\n</div>\n<p>Other options:</p>\n<div class=\"variablelist\">\n<dl class=\"variablelist\">\n<dt id=\"APP-INITDB-OPTION-VERSION\"><span class=\"term\"><code class=\"option\">-V</code><br></span><span class=\"term\"><code class=\"option\">--version</code></span> </dt>\n<dd>\n<p>Print the <span class=\"application\">initdb</span> version and exit.</p>\n</dd>\n<dt id=\"APP-INITDB-OPTION-HELP\"><span class=\"term\"><code class=\"option\">-?</code><br></span><span class=\"term\"><code class=\"option\">--help</code></span> </dt>\n<dd>\n<p>Show help about <span class=\"application\">initdb</span> command line arguments, and exit.</p>\n</dd>\n</dl>\n</div>\n</div>\n<div class=\"refsect1\" id=\"id-1.9.5.3.7\">\n<h2>Environment</h2>\n<div class=\"variablelist\">\n<dl class=\"variablelist\">\n<dt id=\"APP-INITDB-ENVIRONMENT-PGDATA\"><span class=\"term\"><code class=\"envar\">PGDATA</code></span> </dt>\n<dd>\n<p>Specifies the directory where the database cluster is to be stored; can be overridden using the <code class=\"option\">-D</code> option.</p>\n</dd>\n<dt id=\"APP-INITDB-ENVIRONMENT-PG-COLOR\"><span class=\"term\"><code class=\"envar\">PG_COLOR</code></span> </dt>\n<dd>\n<p>Specifies whether to use color in diagnostic messages. Possible values are <code class=\"literal\">always</code>, <code class=\"literal\">auto</code> and <code class=\"literal\">never</code>.</p>\n</dd>\n<dt id=\"APP-INITDB-ENVIRONMENT-TZ\"><span class=\"term\"><code class=\"envar\">TZ</code></span> </dt>\n<dd>\n<p>Specifies the default time zone of the created database cluster. The value should be a full time zone name (see <a class=\"xref\" href=\"/docs/17/datatype-datetime.html#DATATYPE-TIMEZONES\" title=\"8.5.3.\u00a0Time Zones\">Section\u00a08.5.3</a>).</p>\n</dd>\n</dl>\n</div>\n</div>\n<div class=\"refsect1\" id=\"id-1.9.5.3.8\">\n<h2>Notes</h2>\n<p><code class=\"command\">initdb</code> can also be invoked via <code class=\"command\">pg_ctl initdb</code>.</p>\n</div>\n<div class=\"refsect1\" id=\"id-1.9.5.3.9\">\n<h2>See Also</h2><span class=\"simplelist\"><a class=\"xref\" href=\"/docs/17/app-pg-ctl.html\" title=\"pg_ctl\"><span class=\"refentrytitle\"><span class=\"application\">pg_ctl</span></span></a>, <a class=\"xref\" href=\"/docs/17/app-postgres.html\" title=\"postgres\"><span class=\"refentrytitle\"><span class=\"application\">postgres</span></span></a>, <a class=\"xref\" href=\"/docs/17/auth-pg-hba-conf.html\" title=\"20.1.\u00a0The pg_hba.conf File\">Section\u00a020.1</a></span>\n</div>\n</div></div>", "manual_path": "app-initdb.html", "comparison_data": {"options": [{"names": ["-A authmethod", "--auth= authmethod"], "signature": "-A authmethod --auth= authmethod", "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": ["--auth-host= authmethod"], "signature": "--auth-host= authmethod", "description": "This option specifies the authentication method for local users via TCP/IP connections used in pg_hba.conf ( host lines)."}, {"names": ["--auth-local= authmethod"], "signature": "--auth-local= authmethod", "description": "This option specifies the authentication method for local users via Unix-domain socket connections used in pg_hba.conf ( local lines)."}, {"names": ["-D directory", "--pgdata= directory"], "signature": "-D directory --pgdata= directory", "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": ["-E encoding", "--encoding= encoding"], "signature": "-E encoding --encoding= encoding", "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": ["-g", "--allow-group-access"], "signature": "-g --allow-group-access", "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": ["--icu-locale= locale"], "signature": "--icu-locale= locale", "description": "Specifies the ICU locale when the ICU provider is used. Locale support is described in Section 23.1 ."}, {"names": ["--icu-rules= rules"], "signature": "--icu-rules= rules", "description": "Specifies additional collation rules to customize the behavior of the default collation. This is supported for ICU only."}, {"names": ["-k", "--data-checksums"], "signature": "-k --data-checksums", "description": "Use checksums on data pages to help detect corruption by the I/O system that would otherwise be silent. Enabling checksums may incur a noticeable 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": ["--locale= locale"], "signature": "--locale= locale", "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 or C.UTF-8 ."}, {"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": "Like --locale , but only sets the locale in the specified category."}, {"names": ["--no-locale"], "signature": "--no-locale", "description": "Equivalent to --locale=C ."}, {"names": ["--builtin-locale= locale"], "signature": "--builtin-locale= locale", "description": "Specifies the locale name when the builtin provider is used. Locale support is described in Section 23.1 ."}, {"names": ["--locale-provider={ builtin | libc | icu }"], "signature": "--locale-provider={ builtin | libc | icu }", "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": ["--pwfile= filename"], "signature": "--pwfile= filename", "description": "Makes initdb read the bootstrap superuser's password from a file. The first line of the file is taken as the password."}, {"names": ["-T config", "--text-search-config= config"], "signature": "-T config --text-search-config= config", "description": "Sets the default text search configuration. See default_text_search_config for further information."}, {"names": ["-U username", "--username= username"], "signature": "-U username --username= username", "description": "Sets the user name of the bootstrap superuser . This defaults to the name of the operating-system user running initdb ."}, {"names": ["-W", "--pwprompt"], "signature": "-W --pwprompt", "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": ["-X directory", "--waldir= directory"], "signature": "-X directory --waldir= directory", "description": "This option specifies the directory where the write-ahead log should be stored."}, {"names": ["--wal-segsize= size"], "signature": "--wal-segsize= size", "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": ["-c name = value", "--set name = value"], "signature": "-c name = value --set name = value", "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": ["-d", "--debug"], "signature": "-d --debug", "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": ["--discard-caches"], "signature": "--discard-caches", "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": ["-L directory"], "signature": "-L directory", "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": ["-n", "--no-clean"], "signature": "-n --no-clean", "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-sync"], "signature": "-N --no-sync", "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": ["--no-instructions"], "signature": "--no-instructions", "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": ["-s", "--show"], "signature": "-s --show", "description": "Show internal settings and exit, without doing anything else. This can be used to debug the initdb installation."}, {"names": ["--sync-method= method"], "signature": "--sync-method= method", "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": ["-S", "--sync-only"], "signature": "-S --sync-only", "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": ["-V", "--version"], "signature": "-V --version", "description": "Print the initdb version and exit."}, {"names": ["-?", "--help"], "signature": "-? --help", "description": "Show help about initdb command line arguments, and exit."}], "synopsis": ["initdb [ option ...] [ --pgdata | -D ] directory"], "environment": [{"name": "PGDATA", "description": "Specifies the directory where the database cluster is to be stored; can be overridden using the -D option."}, {"name": "PG_COLOR", "description": "Specifies whether to use color in diagnostic messages. Possible values are always , auto and never ."}, {"name": "TZ", "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 )."}]}, "comparison_hash": "4d8c6b2d4e2b1f1ad2ef2995e7c0538df9d3c24b3c110b7ab5f1eba13a54c61e"}, "18": {"facts": [{"label": "Documented executable", "value": "initdb"}, {"label": "Executable version", "value": "18.6"}, {"label": "Reference inventory", "value": "Server applications"}, {"label": "Option definition groups", "value": "34"}], "tables": [{"key": "options", "rows": [{"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": {"url": "/docs/18/app-initdb.html#APP-INITDB-OPTION-AUTH", "text": "-A authmethod --auth= authmethod"}}, {"summary": "This option specifies the authentication method for local users via TCP/IP connections used in pg_hba.conf ( host lines).", "signature": {"url": "/docs/18/app-initdb.html#APP-INITDB-OPTION-AUTH-HOST", "text": "--auth-host= authmethod"}}, {"summary": "This option specifies the authentication method for local users via Unix-domain socket connections used in pg_hba.conf ( local lines).", "signature": {"url": "/docs/18/app-initdb.html#APP-INITDB-OPTION-AUTH-LOCAL", "text": "--auth-local= authmethod"}}, {"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": {"url": "/docs/18/app-initdb.html#APP-INITDB-OPTION-PGDATA", "text": "-D directory --pgdata= directory"}}, {"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": {"url": "/docs/18/app-initdb.html#APP-INITDB-OPTION-ENCODING", "text": "-E encoding --encoding= encoding"}}, {"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": {"url": "/docs/18/app-initdb.html#APP-INITDB-ALLOW-GROUP-ACCESS", "text": "-g --allow-group-access"}}, {"summary": "Specifies the ICU locale when the ICU provider is used. Locale support is described in Section 23.1 .", "signature": {"url": "/docs/18/app-initdb.html#APP-INITDB-ICU-LOCALE", "text": "--icu-locale= locale"}}, {"summary": "Specifies additional collation rules to customize the behavior of the default collation. This is supported for ICU only.", "signature": {"url": "/docs/18/app-initdb.html#APP-INITDB-ICU-RULES", "text": "--icu-rules= rules"}}, {"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": {"url": "/docs/18/app-initdb.html#APP-INITDB-DATA-CHECKSUMS", "text": "-k --data-checksums"}}, {"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": {"url": "/docs/18/app-initdb.html#APP-INITDB-OPTION-LOCALE", "text": "--locale= locale"}}, {"summary": "Like --locale , but only sets the locale in the specified category.", "signature": {"url": "/docs/18/app-initdb.html#APP-INITDB-OPTION-LC-COLLATE", "text": "--lc-collate= locale --lc-ctype= locale --lc-messages= locale --lc-monetary= locale --lc-numeric= locale --lc-time= locale"}}, {"summary": "Equivalent to --locale=C .", "signature": {"url": "/docs/18/app-initdb.html#APP-INITDB-OPTION-NO-LOCALE", "text": "--no-locale"}}, {"summary": "Specifies the locale name when the builtin provider is used. Locale support is described in Section 23.1 .", "signature": {"url": "/docs/18/app-initdb.html#APP-INITDB-BUILTIN-LOCALE", "text": "--builtin-locale= locale"}}, {"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": {"url": "/docs/18/app-initdb.html#APP-INITDB-OPTION-LOCALE-PROVIDER", "text": "--locale-provider={ builtin | libc | icu }"}}, {"summary": "Do not enable data checksums.", "signature": {"url": "/docs/18/app-initdb.html#APP-INITDB-NO-DATA-CHECKSUMS", "text": "--no-data-checksums"}}, {"summary": "Makes initdb read the bootstrap superuser's password from a file. The first line of the file is taken as the password.", "signature": {"url": "/docs/18/app-initdb.html#APP-INITDB-OPTION-PWFILE", "text": "--pwfile= filename"}}, {"summary": "Sets the default text search configuration. See default_text_search_config for further information.", "signature": {"url": "/docs/18/app-initdb.html#APP-INITDB-OPTION-TEXT-SEARCH-CONFIG", "text": "-T config --text-search-config= config"}}, {"summary": "Sets the user name of the bootstrap superuser . This defaults to the name of the operating-system user running initdb .", "signature": {"url": "/docs/18/app-initdb.html#APP-INITDB-OPTION-USERNAME", "text": "-U username --username= username"}}, {"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": {"url": "/docs/18/app-initdb.html#APP-INITDB-OPTION-PWPROMPT", "text": "-W --pwprompt"}}, {"summary": "This option specifies the directory where the write-ahead log should be stored.", "signature": {"url": "/docs/18/app-initdb.html#APP-INITDB-OPTION-WALDIR", "text": "-X directory --waldir= directory"}}, {"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": {"url": "/docs/18/app-initdb.html#APP-INITDB-OPTION-WAL-SEGSIZE", "text": "--wal-segsize= size"}}, {"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": {"url": "/docs/18/app-initdb.html#APP-INITDB-OPTION-SET", "text": "-c name = value --set name = value"}}, {"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": {"url": "/docs/18/app-initdb.html#APP-INITDB-OPTION-DEBUG", "text": "-d --debug"}}, {"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": {"url": "/docs/18/app-initdb.html#APP-INITDB-OPTION-DISCARD-CACHES", "text": "--discard-caches"}}, {"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": {"url": "/docs/18/app-initdb.html#APP-INITDB-OPTION-L", "text": "-L directory"}}, {"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": {"url": "/docs/18/app-initdb.html#APP-INITDB-OPTION-NO-CLEAN", "text": "-n --no-clean"}}, {"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": {"url": "/docs/18/app-initdb.html#APP-INITDB-OPTION-NO-SYNC", "text": "-N --no-sync"}}, {"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": {"url": "/docs/18/app-initdb.html#APP-INITDB-OPTION-NO-SYNC-DATA-FILES", "text": "--no-sync-data-files"}}, {"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": {"url": "/docs/18/app-initdb.html#APP-INITDB-OPTION-NO-INSTRUCTIONS", "text": "--no-instructions"}}, {"summary": "Show internal settings and exit, without doing anything else. This can be used to debug the initdb installation.", "signature": {"url": "/docs/18/app-initdb.html#APP-INITDB-OPTION-SHOW", "text": "-s --show"}}, {"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": {"url": "/docs/18/app-initdb.html#APP-INITDB-OPTION-SYNC-METHOD", "text": "--sync-method= method"}}, {"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": {"url": "/docs/18/app-initdb.html#APP-INITDB-OPTION-SYNC-ONLY", "text": "-S --sync-only"}}, {"summary": "Print the initdb version and exit.", "signature": {"url": "/docs/18/app-initdb.html#APP-INITDB-OPTION-VERSION", "text": "-V --version"}}, {"summary": "Show help about initdb command line arguments, and exit.", "signature": {"url": "/docs/18/app-initdb.html#APP-INITDB-OPTION-HELP", "text": "-? --help"}}], "title": "Documented options", "columns": [{"key": "signature", "label": "Option and arguments"}, {"key": "summary", "label": "Description"}]}, {"key": "environment", "rows": [{"name": "PGDATA", "description": "Specifies the directory where the database cluster is to be stored; can be overridden using the -D option."}, {"name": "PG_COLOR", "description": "Specifies whether to use color in diagnostic messages. Possible values are always , auto and never ."}, {"name": "TZ", "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 )."}], "title": "Environment variables", "columns": [{"key": "name", "label": "Variable"}, {"key": "description", "label": "Meaning"}]}], "options": [{"names": ["-A authmethod", "--auth= authmethod"], "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": "-A authmethod --auth= authmethod", "source_url": "/docs/18/app-initdb.html#APP-INITDB-OPTION-AUTH", "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": ["--auth-host= authmethod"], "summary": "This option specifies the authentication method for local users via TCP/IP connections used in pg_hba.conf ( host lines).", "signature": "--auth-host= authmethod", "source_url": "/docs/18/app-initdb.html#APP-INITDB-OPTION-AUTH-HOST", "description": "This option specifies the authentication method for local users via TCP/IP connections used in pg_hba.conf ( host lines)."}, {"names": ["--auth-local= authmethod"], "summary": "This option specifies the authentication method for local users via Unix-domain socket connections used in pg_hba.conf ( local lines).", "signature": "--auth-local= authmethod", "source_url": "/docs/18/app-initdb.html#APP-INITDB-OPTION-AUTH-LOCAL", "description": "This option specifies the authentication method for local users via Unix-domain socket connections used in pg_hba.conf ( local lines)."}, {"names": ["-D directory", "--pgdata= directory"], "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": "-D directory --pgdata= directory", "source_url": "/docs/18/app-initdb.html#APP-INITDB-OPTION-PGDATA", "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": ["-E encoding", "--encoding= 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": "-E encoding --encoding= encoding", "source_url": "/docs/18/app-initdb.html#APP-INITDB-OPTION-ENCODING", "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": ["-g", "--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": "-g --allow-group-access", "source_url": "/docs/18/app-initdb.html#APP-INITDB-ALLOW-GROUP-ACCESS", "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": ["--icu-locale= locale"], "summary": "Specifies the ICU locale when the ICU provider is used. Locale support is described in Section 23.1 .", "signature": "--icu-locale= locale", "source_url": "/docs/18/app-initdb.html#APP-INITDB-ICU-LOCALE", "description": "Specifies the ICU locale when the ICU provider is used. Locale support is described in Section 23.1 ."}, {"names": ["--icu-rules= rules"], "summary": "Specifies additional collation rules to customize the behavior of the default collation. This is supported for ICU only.", "signature": "--icu-rules= rules", "source_url": "/docs/18/app-initdb.html#APP-INITDB-ICU-RULES", "description": "Specifies additional collation rules to customize the behavior of the default collation. This is supported for ICU only."}, {"names": ["-k", "--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": "-k --data-checksums", "source_url": "/docs/18/app-initdb.html#APP-INITDB-DATA-CHECKSUMS", "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": ["--locale= 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": "--locale= locale", "source_url": "/docs/18/app-initdb.html#APP-INITDB-OPTION-LOCALE", "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": ["--lc-collate= locale", "--lc-ctype= locale", "--lc-messages= locale", "--lc-monetary= locale", "--lc-numeric= locale", "--lc-time= locale"], "summary": "Like --locale , but only sets the locale in the specified category.", "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", "description": "Like --locale , but only sets the locale in the specified category."}, {"names": ["--no-locale"], "summary": "Equivalent to --locale=C .", "signature": "--no-locale", "source_url": "/docs/18/app-initdb.html#APP-INITDB-OPTION-NO-LOCALE", "description": "Equivalent to --locale=C ."}, {"names": ["--builtin-locale= locale"], "summary": "Specifies the locale name when the builtin provider is used. Locale support is described in Section 23.1 .", "signature": "--builtin-locale= locale", "source_url": "/docs/18/app-initdb.html#APP-INITDB-BUILTIN-LOCALE", "description": "Specifies the locale name when the builtin provider is used. Locale support is described in Section 23.1 ."}, {"names": ["--locale-provider={ builtin | libc | icu }"], "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": "--locale-provider={ builtin | libc | icu }", "source_url": "/docs/18/app-initdb.html#APP-INITDB-OPTION-LOCALE-PROVIDER", "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": ["--no-data-checksums"], "summary": "Do not enable data checksums.", "signature": "--no-data-checksums", "source_url": "/docs/18/app-initdb.html#APP-INITDB-NO-DATA-CHECKSUMS", "description": "Do not enable data checksums."}, {"names": ["--pwfile= filename"], "summary": "Makes initdb read the bootstrap superuser's password from a file. The first line of the file is taken as the password.", "signature": "--pwfile= filename", "source_url": "/docs/18/app-initdb.html#APP-INITDB-OPTION-PWFILE", "description": "Makes initdb read the bootstrap superuser's password from a file. The first line of the file is taken as the password."}, {"names": ["-T config", "--text-search-config= config"], "summary": "Sets the default text search configuration. See default_text_search_config for further information.", "signature": "-T config --text-search-config= config", "source_url": "/docs/18/app-initdb.html#APP-INITDB-OPTION-TEXT-SEARCH-CONFIG", "description": "Sets the default text search configuration. See default_text_search_config for further information."}, {"names": ["-U username", "--username= username"], "summary": "Sets the user name of the bootstrap superuser . This defaults to the name of the operating-system user running initdb .", "signature": "-U username --username= username", "source_url": "/docs/18/app-initdb.html#APP-INITDB-OPTION-USERNAME", "description": "Sets the user name of the bootstrap superuser . This defaults to the name of the operating-system user running initdb ."}, {"names": ["-W", "--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": "-W --pwprompt", "source_url": "/docs/18/app-initdb.html#APP-INITDB-OPTION-PWPROMPT", "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": ["-X directory", "--waldir= directory"], "summary": "This option specifies the directory where the write-ahead log should be stored.", "signature": "-X directory --waldir= directory", "source_url": "/docs/18/app-initdb.html#APP-INITDB-OPTION-WALDIR", "description": "This option specifies the directory where the write-ahead log should be stored."}, {"names": ["--wal-segsize= size"], "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": "--wal-segsize= size", "source_url": "/docs/18/app-initdb.html#APP-INITDB-OPTION-WAL-SEGSIZE", "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": ["-c name = value", "--set name = value"], "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": "-c name = value --set name = value", "source_url": "/docs/18/app-initdb.html#APP-INITDB-OPTION-SET", "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": ["-d", "--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": "-d --debug", "source_url": "/docs/18/app-initdb.html#APP-INITDB-OPTION-DEBUG", "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": ["--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": "--discard-caches", "source_url": "/docs/18/app-initdb.html#APP-INITDB-OPTION-DISCARD-CACHES", "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": ["-L directory"], "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": "-L directory", "source_url": "/docs/18/app-initdb.html#APP-INITDB-OPTION-L", "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": ["-n", "--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": "-n --no-clean", "source_url": "/docs/18/app-initdb.html#APP-INITDB-OPTION-NO-CLEAN", "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-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": "-N --no-sync", "source_url": "/docs/18/app-initdb.html#APP-INITDB-OPTION-NO-SYNC", "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": ["--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": "--no-sync-data-files", "source_url": "/docs/18/app-initdb.html#APP-INITDB-OPTION-NO-SYNC-DATA-FILES", "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-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": "--no-instructions", "source_url": "/docs/18/app-initdb.html#APP-INITDB-OPTION-NO-INSTRUCTIONS", "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": ["-s", "--show"], "summary": "Show internal settings and exit, without doing anything else. This can be used to debug the initdb installation.", "signature": "-s --show", "source_url": "/docs/18/app-initdb.html#APP-INITDB-OPTION-SHOW", "description": "Show internal settings and exit, without doing anything else. This can be used to debug the initdb installation."}, {"names": ["--sync-method= 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": "--sync-method= method", "source_url": "/docs/18/app-initdb.html#APP-INITDB-OPTION-SYNC-METHOD", "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": ["-S", "--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": "-S --sync-only", "source_url": "/docs/18/app-initdb.html#APP-INITDB-OPTION-SYNC-ONLY", "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": ["-V", "--version"], "summary": "Print the initdb version and exit.", "signature": "-V --version", "source_url": "/docs/18/app-initdb.html#APP-INITDB-OPTION-VERSION", "description": "Print the initdb version and exit."}, {"names": ["-?", "--help"], "summary": "Show help about initdb command line arguments, and exit.", "signature": "-? --help", "source_url": "/docs/18/app-initdb.html#APP-INITDB-OPTION-HELP", "description": "Show help about initdb command line arguments, and exit."}], "related": [], "release": {"ref": "https://ftp.postgresql.org/pub/source/v18.6/postgresql-18.6.tar.bz2", "label": "18.6", "major": "18", "channel": "stable", "manifest": {"pdf": {"A4": {"url": "/files/documentation/pdf/18/postgresql-18-A4.pdf", "bytes": 15865106, "pages": 3154, "sha256": "19512c405da53f9f7fcf0abba359223aa65f021be025bf3411381918f92e3190", "built_at": "2026-09-26"}, "US": {"url": "/files/documentation/pdf/18/postgresql-18-US.pdf", "bytes": 15748059, "pages": 3328, "sha256": "facbe6c229e598b872d3d98bef53308f46e06746006fa4590de9a7de9dd46319", "built_at": "2026-09-26"}}, "tree": "18", "index": "index.html", "major": "18", "pages": 1148, "release": "18.6", "source_url": "https://ftp.postgresql.org/pub/source/v18.6/postgresql-18.6.tar.bz2", "svg_assets": 3, "source_mode": "en SGML built with pinned official archive", "source_sha256": "555610c24d53e4316da5b7d3fc25c279d96856d5e0e23ee308c328c5fa881d9f"}, "revision": "ee8d1a3612338fd9adf250730cb640fcc5233b5491337cc00a316a44e3a0b9f8", "evidence_kind": "English manual and source declarations", "source_sha256": "555610c24d53e4316da5b7d3fc25c279d96856d5e0e23ee308c328c5fa881d9f"}, "sources": [{"url": "/docs/18/app-initdb.html", "file": "app-initdb.html", "label": "18.6 English manual \u00b7 app-initdb.html", "anchor": "", "sha256": "ca8245d2c61740de3b11df2b81993b18e311705e2c23bebfa7cafda1bcd15321"}, {"url": "/docs/18/reference-server.html", "file": "reference-server.html", "label": "Server applications inventory", "anchor": "", "sha256": "e9f8bbcc8e3641fadd1d20991e8aad6b532155b786ba5a1b7b364ec4f1a5bef3"}], "sections": [], "synopsis": ["initdb [ option ...] [ --pgdata | -D ] directory"], "signature": "initdb [ option ...] [ --pgdata | -D ] directory", "description": ["initdb \u2014 create a new PostgreSQL database cluster"], "environment": [{"name": "PGDATA", "description": "Specifies the directory where the database cluster is to be stored; can be overridden using the -D option."}, {"name": "PG_COLOR", "description": "Specifies whether to use color in diagnostic messages. Possible values are always , auto and never ."}, {"name": "TZ", "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 )."}], "manual_html": "<div><div class=\"refentry\" id=\"APP-INITDB\">\n<div class=\"titlepage\"></div>\n<div class=\"refnamediv\">\n<h2><span class=\"refentrytitle\"><span class=\"application\">initdb</span></span></h2>\n<p>initdb \u2014 create a new <span class=\"productname\">PostgreSQL</span> database cluster</p>\n</div>\n<div class=\"refsynopsisdiv\">\n<h2>Synopsis</h2>\n<div class=\"cmdsynopsis\">\n<p id=\"id-1.9.5.3.4.1\"><code class=\"command\">initdb</code> [<em class=\"replaceable\"><code>option</code></em>...] [ <code class=\"option\">--pgdata</code> | <code class=\"option\">-D</code> ] <em class=\"replaceable\"><code>directory</code></em></p>\n</div>\n</div>\n<div class=\"refsect1\" id=\"R1-APP-INITDB-1\">\n<h2>Description</h2>\n<p><code class=\"command\">initdb</code> creates a new <span class=\"productname\">PostgreSQL</span> <a class=\"glossterm\" href=\"/docs/18/glossary.html#GLOSSARY-DB-CLUSTER\"></a><a class=\"glossterm\" href=\"/docs/18/glossary.html#GLOSSARY-DB-CLUSTER\" title=\"Database cluster\">database cluster</a>.</p>\n<p>Creating a database cluster consists of creating the <a class=\"glossterm\" href=\"/docs/18/glossary.html#GLOSSARY-DATA-DIRECTORY\"></a><a class=\"glossterm\" href=\"/docs/18/glossary.html#GLOSSARY-DATA-DIRECTORY\" title=\"Data directory\">directories</a> 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 <code class=\"literal\">postgres</code>, <code class=\"literal\">template1</code>, and <code class=\"literal\">template0</code> databases. The <code class=\"literal\">postgres</code> database is a default database meant for use by users, utilities and third party applications. <code class=\"literal\">template1</code> and <code class=\"literal\">template0</code> are meant as source databases to be copied by later <code class=\"command\">CREATE DATABASE</code> commands. <code class=\"literal\">template0</code> should never be modified, but you can add objects to <code class=\"literal\">template1</code>, which by default will be copied into databases created later. See <a class=\"xref\" href=\"/docs/18/manage-ag-templatedbs.html\" title=\"22.3.\u00a0Template Databases\">Section\u00a022.3</a> for more details.</p>\n<p>Although <code class=\"command\">initdb</code> 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 <code class=\"command\">chown</code> to assign ownership of that directory to the database user account, then <code class=\"command\">su</code> to become the database user to run <code class=\"command\">initdb</code>.</p>\n<p><code class=\"command\">initdb</code> 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 <code class=\"command\">initdb</code> creates. Since the server cannot be run as root, you must not run <code class=\"command\">initdb</code> as root either. (It will in fact refuse to do so.)</p>\n<p>For security reasons the new cluster created by <code class=\"command\">initdb</code> will only be accessible by the cluster owner by default. The <code class=\"option\">--allow-group-access</code> 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.</p>\n<p><code class=\"command\">initdb</code> initializes the database cluster's default locale and character set encoding. These can also be set separately for each database when it is created. <code class=\"command\">initdb</code> determines those settings for the template databases, which will serve as the default for all other databases.</p>\n<p>By default, <code class=\"command\">initdb</code> uses the locale provider <code class=\"literal\">libc</code> (see <a class=\"xref\" href=\"/docs/18/locale.html#LOCALE-PROVIDERS\" title=\"23.1.4.\u00a0Locale Providers\">Section\u00a023.1.4</a>). The <code class=\"literal\">libc</code> locale provider takes the locale settings from the environment, and determines the encoding from the locale settings.</p>\n<p>To choose a different locale for the cluster, use the option <code class=\"option\">--locale</code>. There are also individual options <code class=\"option\">--lc-*</code> and <code class=\"option\">--icu-locale</code> (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.</p>\n<p>Alternatively, <code class=\"command\">initdb</code> can use the ICU library to provide locale services by specifying <code class=\"literal\">--locale-provider=icu</code>. The server must be built with ICU support. To choose the specific ICU locale ID to apply, use the option <code class=\"option\">--icu-locale</code>. Note that for implementation reasons and to support legacy code, <code class=\"command\">initdb</code> will still select and initialize libc locale settings when the ICU locale provider is used.</p>\n<p>When <code class=\"command\">initdb</code> 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.</p>\n<p>More details about locale settings can be found in <a class=\"xref\" href=\"/docs/18/locale.html\" title=\"23.1.\u00a0Locale Support\">Section\u00a023.1</a>.</p>\n<p>To alter the default encoding, use the <code class=\"option\">--encoding</code>. More details can be found in <a class=\"xref\" href=\"/docs/18/multibyte.html\" title=\"23.3.\u00a0Character Set Support\">Section\u00a023.3</a>.</p>\n</div>\n<div class=\"refsect1\" id=\"id-1.9.5.3.6\">\n<h2>Options</h2>\n<div class=\"variablelist\">\n<dl class=\"variablelist\">\n<dt id=\"APP-INITDB-OPTION-AUTH\"><span class=\"term\"><code class=\"option\">-A <em class=\"replaceable\"><code>authmethod</code></em></code><br></span><span class=\"term\"><code class=\"option\">--auth=<em class=\"replaceable\"><code>authmethod</code></em></code></span> </dt>\n<dd>\n<p>This option specifies the default authentication method for local users used in <code class=\"filename\">pg_hba.conf</code> (<code class=\"literal\">host</code> and <code class=\"literal\">local</code> lines). See <a class=\"xref\" href=\"/docs/18/auth-pg-hba-conf.html\" title=\"20.1.\u00a0The pg_hba.conf File\">Section\u00a020.1</a> for an overview of valid values.</p>\n<p><code class=\"command\">initdb</code> will prepopulate <code class=\"filename\">pg_hba.conf</code> entries using the specified authentication method for non-replication as well as replication connections.</p>\n<p>Do not use <code class=\"literal\">trust</code> unless you trust all local users on your system. <code class=\"literal\">trust</code> is the default for ease of installation.</p>\n</dd>\n<dt id=\"APP-INITDB-OPTION-AUTH-HOST\"><span class=\"term\"><code class=\"option\">--auth-host=<em class=\"replaceable\"><code>authmethod</code></em></code></span> </dt>\n<dd>\n<p>This option specifies the authentication method for local users via TCP/IP connections used in <code class=\"filename\">pg_hba.conf</code> (<code class=\"literal\">host</code> lines).</p>\n</dd>\n<dt id=\"APP-INITDB-OPTION-AUTH-LOCAL\"><span class=\"term\"><code class=\"option\">--auth-local=<em class=\"replaceable\"><code>authmethod</code></em></code></span> </dt>\n<dd>\n<p>This option specifies the authentication method for local users via Unix-domain socket connections used in <code class=\"filename\">pg_hba.conf</code> (<code class=\"literal\">local</code> lines).</p>\n</dd>\n<dt id=\"APP-INITDB-OPTION-PGDATA\"><span class=\"term\"><code class=\"option\">-D <em class=\"replaceable\"><code>directory</code></em></code><br></span><span class=\"term\"><code class=\"option\">--pgdata=<em class=\"replaceable\"><code>directory</code></em></code></span> </dt>\n<dd>\n<p>This option specifies the directory where the database cluster should be stored. This is the only information required by <code class=\"command\">initdb</code>, but you can avoid writing it by setting the <code class=\"envar\">PGDATA</code> environment variable, which can be convenient since the database server (<code class=\"command\">postgres</code>) can find the data directory later by the same variable.</p>\n</dd>\n<dt id=\"APP-INITDB-OPTION-ENCODING\"><span class=\"term\"><code class=\"option\">-E <em class=\"replaceable\"><code>encoding</code></em></code><br></span><span class=\"term\"><code class=\"option\">--encoding=<em class=\"replaceable\"><code>encoding</code></em></code></span> </dt>\n<dd>\n<p>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 <span class=\"productname\">PostgreSQL</span> server are described in <a class=\"xref\" href=\"/docs/18/multibyte.html#MULTIBYTE-CHARSET-SUPPORTED\" title=\"23.3.1.\u00a0Supported Character Sets\">Section\u00a023.3.1</a>.</p>\n<p>By default, the template database encoding is derived from the locale. If <a class=\"xref\" href=\"/docs/18/app-initdb.html#APP-INITDB-OPTION-NO-LOCALE\"><code class=\"option\">--no-locale</code></a> is specified (or equivalently, if the locale is <code class=\"literal\">C</code> or <code class=\"literal\">POSIX</code>), then the default is <code class=\"literal\">UTF8</code> for the ICU provider and <code class=\"literal\">SQL_ASCII</code> for the <code class=\"literal\">libc</code> provider.</p>\n</dd>\n<dt id=\"APP-INITDB-ALLOW-GROUP-ACCESS\"><span class=\"term\"><code class=\"option\">-g</code><br></span><span class=\"term\"><code class=\"option\">--allow-group-access</code></span> </dt>\n<dd>\n<p>Allows users in the same group as the cluster owner to read all cluster files created by <code class=\"command\">initdb</code>. This option is ignored on <span class=\"productname\">Windows</span> as it does not support POSIX-style group permissions.</p>\n</dd>\n<dt id=\"APP-INITDB-ICU-LOCALE\"><span class=\"term\"><code class=\"option\">--icu-locale=<em class=\"replaceable\"><code>locale</code></em></code></span> </dt>\n<dd>\n<p>Specifies the ICU locale when the ICU provider is used. Locale support is described in <a class=\"xref\" href=\"/docs/18/locale.html\" title=\"23.1.\u00a0Locale Support\">Section\u00a023.1</a>.</p>\n</dd>\n<dt id=\"APP-INITDB-ICU-RULES\"><span class=\"term\"><code class=\"option\">--icu-rules=<em class=\"replaceable\"><code>rules</code></em></code></span> </dt>\n<dd>\n<p>Specifies additional collation rules to customize the behavior of the default collation. This is supported for ICU only.</p>\n</dd>\n<dt id=\"APP-INITDB-DATA-CHECKSUMS\"><span class=\"term\"><code class=\"option\">-k</code><br></span><span class=\"term\"><code class=\"option\">--data-checksums</code></span> </dt>\n<dd>\n<p>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 <a class=\"xref\" href=\"/docs/18/app-initdb.html#APP-INITDB-NO-DATA-CHECKSUMS\"><code class=\"option\">--no-data-checksums</code></a> to disable checksums.</p>\n<p>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 <a class=\"link\" href=\"/docs/18/monitoring-stats.html#MONITORING-PG-STAT-DATABASE-VIEW\" title=\"27.2.17.\u00a0pg_stat_database\"><code class=\"structname\">pg_stat_database</code></a> view. See <a class=\"xref\" href=\"/docs/18/checksums.html\" title=\"28.2.\u00a0Data Checksums\">Section\u00a028.2</a> for details.</p>\n</dd>\n<dt id=\"APP-INITDB-OPTION-LOCALE\"><span class=\"term\"><code class=\"option\">--locale=<em class=\"replaceable\"><code>locale</code></em></code></span> </dt>\n<dd>\n<p>Sets the default locale for the database cluster. If this option is not specified, the locale is inherited from the environment that <code class=\"command\">initdb</code> runs in. Locale support is described in <a class=\"xref\" href=\"/docs/18/locale.html\" title=\"23.1.\u00a0Locale Support\">Section\u00a023.1</a>.</p>\n<p>If <code class=\"option\">--locale-provider</code> is <code class=\"literal\">builtin</code>, <code class=\"option\">--locale</code> or <code class=\"option\">--builtin-locale</code> must be specified and set to <code class=\"literal\">C</code>, <code class=\"literal\">C.UTF-8</code> or <code class=\"literal\">PG_UNICODE_FAST</code>.</p>\n</dd>\n<dt id=\"APP-INITDB-OPTION-LC-COLLATE\"><span class=\"term\"><code class=\"option\">--lc-collate=<em class=\"replaceable\"><code>locale</code></em></code><br></span><span class=\"term\"><code class=\"option\">--lc-ctype=<em class=\"replaceable\"><code>locale</code></em></code><br></span><span class=\"term\"><code class=\"option\">--lc-messages=<em class=\"replaceable\"><code>locale</code></em></code><br></span><span class=\"term\"><code class=\"option\">--lc-monetary=<em class=\"replaceable\"><code>locale</code></em></code><br></span><span class=\"term\"><code class=\"option\">--lc-numeric=<em class=\"replaceable\"><code>locale</code></em></code><br></span><span class=\"term\"><code class=\"option\">--lc-time=<em class=\"replaceable\"><code>locale</code></em></code></span> </dt>\n<dd>\n<p>Like <code class=\"option\">--locale</code>, but only sets the locale in the specified category.</p>\n</dd>\n<dt id=\"APP-INITDB-OPTION-NO-LOCALE\"><span class=\"term\"><code class=\"option\">--no-locale</code></span> </dt>\n<dd>\n<p>Equivalent to <code class=\"option\">--locale=C</code>.</p>\n</dd>\n<dt id=\"APP-INITDB-BUILTIN-LOCALE\"><span class=\"term\"><code class=\"option\">--builtin-locale=<em class=\"replaceable\"><code>locale</code></em></code></span> </dt>\n<dd>\n<p>Specifies the locale name when the builtin provider is used. Locale support is described in <a class=\"xref\" href=\"/docs/18/locale.html\" title=\"23.1.\u00a0Locale Support\">Section\u00a023.1</a>.</p>\n</dd>\n<dt id=\"APP-INITDB-OPTION-LOCALE-PROVIDER\"><span class=\"term\"><code class=\"option\">--locale-provider={<code class=\"literal\">builtin</code>|<code class=\"literal\">libc</code>|<code class=\"literal\">icu</code>}</code></span> </dt>\n<dd>\n<p>This option sets the locale provider for databases created in the new cluster. It can be overridden in the <code class=\"command\">CREATE DATABASE</code> command when new databases are subsequently created. The default is <code class=\"literal\">libc</code> (see <a class=\"xref\" href=\"/docs/18/locale.html#LOCALE-PROVIDERS\" title=\"23.1.4.\u00a0Locale Providers\">Section\u00a023.1.4</a>).</p>\n</dd>\n<dt id=\"APP-INITDB-NO-DATA-CHECKSUMS\"><span class=\"term\"><code class=\"option\">--no-data-checksums</code></span> </dt>\n<dd>\n<p>Do not enable data checksums.</p>\n</dd>\n<dt id=\"APP-INITDB-OPTION-PWFILE\"><span class=\"term\"><code class=\"option\">--pwfile=<em class=\"replaceable\"><code>filename</code></em></code></span> </dt>\n<dd>\n<p>Makes <code class=\"command\">initdb</code> read the bootstrap superuser's password from a file. The first line of the file is taken as the password.</p>\n</dd>\n<dt id=\"APP-INITDB-OPTION-TEXT-SEARCH-CONFIG\"><span class=\"term\"><code class=\"option\">-T <em class=\"replaceable\"><code>config</code></em></code><br></span><span class=\"term\"><code class=\"option\">--text-search-config=<em class=\"replaceable\"><code>config</code></em></code></span> </dt>\n<dd>\n<p>Sets the default text search configuration. See <a class=\"xref\" href=\"/docs/18/runtime-config-client.html#GUC-DEFAULT-TEXT-SEARCH-CONFIG\">default_text_search_config</a> for further information.</p>\n</dd>\n<dt id=\"APP-INITDB-OPTION-USERNAME\"><span class=\"term\"><code class=\"option\">-U <em class=\"replaceable\"><code>username</code></em></code><br></span><span class=\"term\"><code class=\"option\">--username=<em class=\"replaceable\"><code>username</code></em></code></span> </dt>\n<dd>\n<p>Sets the user name of the <a class=\"glossterm\" href=\"/docs/18/glossary.html#GLOSSARY-BOOTSTRAP-SUPERUSER\"></a><a class=\"glossterm\" href=\"/docs/18/glossary.html#GLOSSARY-BOOTSTRAP-SUPERUSER\" title=\"Bootstrap superuser\">bootstrap superuser</a>. This defaults to the name of the operating-system user running <code class=\"command\">initdb</code>.</p>\n</dd>\n<dt id=\"APP-INITDB-OPTION-PWPROMPT\"><span class=\"term\"><code class=\"option\">-W</code><br></span><span class=\"term\"><code class=\"option\">--pwprompt</code></span> </dt>\n<dd>\n<p>Makes <code class=\"command\">initdb</code> 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.</p>\n</dd>\n<dt id=\"APP-INITDB-OPTION-WALDIR\"><span class=\"term\"><code class=\"option\">-X <em class=\"replaceable\"><code>directory</code></em></code><br></span><span class=\"term\"><code class=\"option\">--waldir=<em class=\"replaceable\"><code>directory</code></em></code></span> </dt>\n<dd>\n<p>This option specifies the directory where the write-ahead log should be stored.</p>\n</dd>\n<dt id=\"APP-INITDB-OPTION-WAL-SEGSIZE\"><span class=\"term\"><code class=\"option\">--wal-segsize=<em class=\"replaceable\"><code>size</code></em></code></span> </dt>\n<dd>\n<p>Set the <em class=\"firstterm\">WAL segment size</em>, 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.</p>\n<p>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.</p>\n</dd>\n</dl>\n</div>\n<p>Other, less commonly used, options are also available:</p>\n<div class=\"variablelist\">\n<dl class=\"variablelist\">\n<dt id=\"APP-INITDB-OPTION-SET\"><span class=\"term\"><code class=\"option\">-c <em class=\"replaceable\"><code>name</code></em>=<em class=\"replaceable\"><code>value</code></em></code><br></span><span class=\"term\"><code class=\"option\">--set <em class=\"replaceable\"><code>name</code></em>=<em class=\"replaceable\"><code>value</code></em></code></span> </dt>\n<dd>\n<p>Forcibly set the server parameter <em class=\"replaceable\"><code>name</code></em> to <em class=\"replaceable\"><code>value</code></em> during <code class=\"command\">initdb</code>, and also install that setting in the generated <code class=\"filename\">postgresql.conf</code> 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.</p>\n</dd>\n<dt id=\"APP-INITDB-OPTION-DEBUG\"><span class=\"term\"><code class=\"option\">-d</code><br></span><span class=\"term\"><code class=\"option\">--debug</code></span> </dt>\n<dd>\n<p>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 <code class=\"command\">initdb</code> uses to create the catalog tables. This option generates a tremendous amount of extremely boring output.</p>\n</dd>\n<dt id=\"APP-INITDB-OPTION-DISCARD-CACHES\"><span class=\"term\"><code class=\"option\">--discard-caches</code></span> </dt>\n<dd>\n<p>Run the bootstrap backend with the <code class=\"literal\">debug_discard_caches=1</code> option. This takes a very long time and is only of use for deep debugging.</p>\n</dd>\n<dt id=\"APP-INITDB-OPTION-L\"><span class=\"term\"><code class=\"option\">-L <em class=\"replaceable\"><code>directory</code></em></code></span> </dt>\n<dd>\n<p>Specifies where <code class=\"command\">initdb</code> 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.</p>\n</dd>\n<dt id=\"APP-INITDB-OPTION-NO-CLEAN\"><span class=\"term\"><code class=\"option\">-n</code><br></span><span class=\"term\"><code class=\"option\">--no-clean</code></span> </dt>\n<dd>\n<p>By default, when <code class=\"command\">initdb</code> 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.</p>\n</dd>\n<dt id=\"APP-INITDB-OPTION-NO-SYNC\"><span class=\"term\"><code class=\"option\">-N</code><br></span><span class=\"term\"><code class=\"option\">--no-sync</code></span> </dt>\n<dd>\n<p>By default, <code class=\"command\">initdb</code> will wait for all files to be written safely to disk. This option causes <code class=\"command\">initdb</code> 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.</p>\n</dd>\n<dt id=\"APP-INITDB-OPTION-NO-SYNC-DATA-FILES\"><span class=\"term\"><code class=\"option\">--no-sync-data-files</code></span> </dt>\n<dd>\n<p>By default, <code class=\"command\">initdb</code> safely writes all database files to disk. This option instructs <code class=\"command\">initdb</code> to skip synchronizing all files in the individual database directories, the database directories themselves, and the tablespace directories, i.e., everything in the <code class=\"filename\">base</code> subdirectory and any other tablespace directories. Other files, such as those in <code class=\"literal\">pg_wal</code> and <code class=\"literal\">pg_xact</code>, will still be synchronized unless the <code class=\"option\">--no-sync</code> option is also specified.</p>\n<p>Note that if <code class=\"option\">--no-sync-data-files</code> is used in conjunction with <code class=\"option\">--sync-method=syncfs</code>, some or all of the aforementioned files and directories will be synchronized because <code class=\"literal\">syncfs</code> processes entire file systems.</p>\n<p>This option is primarily intended for internal use by tools that separately ensure the skipped files are synchronized to disk.</p>\n</dd>\n<dt id=\"APP-INITDB-OPTION-NO-INSTRUCTIONS\"><span class=\"term\"><code class=\"option\">--no-instructions</code></span> </dt>\n<dd>\n<p>By default, <code class=\"command\">initdb</code> 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 <code class=\"command\">initdb</code> in platform-specific behavior, where those instructions are likely to be incorrect.</p>\n</dd>\n<dt id=\"APP-INITDB-OPTION-SHOW\"><span class=\"term\"><code class=\"option\">-s</code><br></span><span class=\"term\"><code class=\"option\">--show</code></span> </dt>\n<dd>\n<p>Show internal settings and exit, without doing anything else. This can be used to debug the <span class=\"application\">initdb</span> installation.</p>\n</dd>\n<dt id=\"APP-INITDB-OPTION-SYNC-METHOD\"><span class=\"term\"><code class=\"option\">--sync-method=<em class=\"replaceable\"><code>method</code></em></code></span> </dt>\n<dd>\n<p>When set to <code class=\"literal\">fsync</code>, which is the default, <code class=\"command\">initdb</code> 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.</p>\n<p>On Linux, <code class=\"literal\">syncfs</code> 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 <a class=\"xref\" href=\"/docs/18/runtime-config-error-handling.html#GUC-RECOVERY-INIT-SYNC-METHOD\">recovery_init_sync_method</a> for information about the caveats to be aware of when using <code class=\"literal\">syncfs</code>.</p>\n<p>This option has no effect when <code class=\"option\">--no-sync</code> is used.</p>\n</dd>\n<dt id=\"APP-INITDB-OPTION-SYNC-ONLY\"><span class=\"term\"><code class=\"option\">-S</code><br></span><span class=\"term\"><code class=\"option\">--sync-only</code></span> </dt>\n<dd>\n<p>Safely write all database files to disk and exit. This does not perform any of the normal <span class=\"application\">initdb</span> operations. Generally, this option is useful for ensuring reliable recovery after changing <a class=\"xref\" href=\"/docs/18/runtime-config-wal.html#GUC-FSYNC\">fsync</a> from <code class=\"literal\">off</code> to <code class=\"literal\">on</code>.</p>\n</dd>\n</dl>\n</div>\n<p>Other options:</p>\n<div class=\"variablelist\">\n<dl class=\"variablelist\">\n<dt id=\"APP-INITDB-OPTION-VERSION\"><span class=\"term\"><code class=\"option\">-V</code><br></span><span class=\"term\"><code class=\"option\">--version</code></span> </dt>\n<dd>\n<p>Print the <span class=\"application\">initdb</span> version and exit.</p>\n</dd>\n<dt id=\"APP-INITDB-OPTION-HELP\"><span class=\"term\"><code class=\"option\">-?</code><br></span><span class=\"term\"><code class=\"option\">--help</code></span> </dt>\n<dd>\n<p>Show help about <span class=\"application\">initdb</span> command line arguments, and exit.</p>\n</dd>\n</dl>\n</div>\n</div>\n<div class=\"refsect1\" id=\"id-1.9.5.3.7\">\n<h2>Environment</h2>\n<div class=\"variablelist\">\n<dl class=\"variablelist\">\n<dt id=\"APP-INITDB-ENVIRONMENT-PGDATA\"><span class=\"term\"><code class=\"envar\">PGDATA</code></span> </dt>\n<dd>\n<p>Specifies the directory where the database cluster is to be stored; can be overridden using the <code class=\"option\">-D</code> option.</p>\n</dd>\n<dt id=\"APP-INITDB-ENVIRONMENT-PG-COLOR\"><span class=\"term\"><code class=\"envar\">PG_COLOR</code></span> </dt>\n<dd>\n<p>Specifies whether to use color in diagnostic messages. Possible values are <code class=\"literal\">always</code>, <code class=\"literal\">auto</code> and <code class=\"literal\">never</code>.</p>\n</dd>\n<dt id=\"APP-INITDB-ENVIRONMENT-TZ\"><span class=\"term\"><code class=\"envar\">TZ</code></span> </dt>\n<dd>\n<p>Specifies the default time zone of the created database cluster. The value should be a full time zone name (see <a class=\"xref\" href=\"/docs/18/datatype-datetime.html#DATATYPE-TIMEZONES\" title=\"8.5.3.\u00a0Time Zones\">Section\u00a08.5.3</a>).</p>\n</dd>\n</dl>\n</div>\n</div>\n<div class=\"refsect1\" id=\"id-1.9.5.3.8\">\n<h2>Notes</h2>\n<p><code class=\"command\">initdb</code> can also be invoked via <code class=\"command\">pg_ctl initdb</code>.</p>\n</div>\n<div class=\"refsect1\" id=\"id-1.9.5.3.9\">\n<h2>See Also</h2><span class=\"simplelist\"><a class=\"xref\" href=\"/docs/18/app-pg-ctl.html\" title=\"pg_ctl\"><span class=\"refentrytitle\"><span class=\"application\">pg_ctl</span></span></a>, <a class=\"xref\" href=\"/docs/18/app-postgres.html\" title=\"postgres\"><span class=\"refentrytitle\"><span class=\"application\">postgres</span></span></a>, <a class=\"xref\" href=\"/docs/18/auth-pg-hba-conf.html\" title=\"20.1.\u00a0The pg_hba.conf File\">Section\u00a020.1</a></span>\n</div>\n</div></div>", "manual_path": "app-initdb.html", "comparison_data": {"options": [{"names": ["-A authmethod", "--auth= authmethod"], "signature": "-A authmethod --auth= authmethod", "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": ["--auth-host= authmethod"], "signature": "--auth-host= authmethod", "description": "This option specifies the authentication method for local users via TCP/IP connections used in pg_hba.conf ( host lines)."}, {"names": ["--auth-local= authmethod"], "signature": "--auth-local= authmethod", "description": "This option specifies the authentication method for local users via Unix-domain socket connections used in pg_hba.conf ( local lines)."}, {"names": ["-D directory", "--pgdata= directory"], "signature": "-D directory --pgdata= directory", "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": ["-E encoding", "--encoding= encoding"], "signature": "-E encoding --encoding= encoding", "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": ["-g", "--allow-group-access"], "signature": "-g --allow-group-access", "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": ["--icu-locale= locale"], "signature": "--icu-locale= locale", "description": "Specifies the ICU locale when the ICU provider is used. Locale support is described in Section 23.1 ."}, {"names": ["--icu-rules= rules"], "signature": "--icu-rules= rules", "description": "Specifies additional collation rules to customize the behavior of the default collation. This is supported for ICU only."}, {"names": ["-k", "--data-checksums"], "signature": "-k --data-checksums", "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": ["--locale= locale"], "signature": "--locale= locale", "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": ["--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": "Like --locale , but only sets the locale in the specified category."}, {"names": ["--no-locale"], "signature": "--no-locale", "description": "Equivalent to --locale=C ."}, {"names": ["--builtin-locale= locale"], "signature": "--builtin-locale= locale", "description": "Specifies the locale name when the builtin provider is used. Locale support is described in Section 23.1 ."}, {"names": ["--locale-provider={ builtin | libc | icu }"], "signature": "--locale-provider={ builtin | libc | icu }", "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": ["--no-data-checksums"], "signature": "--no-data-checksums", "description": "Do not enable data checksums."}, {"names": ["--pwfile= filename"], "signature": "--pwfile= filename", "description": "Makes initdb read the bootstrap superuser's password from a file. The first line of the file is taken as the password."}, {"names": ["-T config", "--text-search-config= config"], "signature": "-T config --text-search-config= config", "description": "Sets the default text search configuration. See default_text_search_config for further information."}, {"names": ["-U username", "--username= username"], "signature": "-U username --username= username", "description": "Sets the user name of the bootstrap superuser . This defaults to the name of the operating-system user running initdb ."}, {"names": ["-W", "--pwprompt"], "signature": "-W --pwprompt", "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": ["-X directory", "--waldir= directory"], "signature": "-X directory --waldir= directory", "description": "This option specifies the directory where the write-ahead log should be stored."}, {"names": ["--wal-segsize= size"], "signature": "--wal-segsize= size", "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": ["-c name = value", "--set name = value"], "signature": "-c name = value --set name = value", "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": ["-d", "--debug"], "signature": "-d --debug", "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": ["--discard-caches"], "signature": "--discard-caches", "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": ["-L directory"], "signature": "-L directory", "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": ["-n", "--no-clean"], "signature": "-n --no-clean", "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-sync"], "signature": "-N --no-sync", "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": ["--no-sync-data-files"], "signature": "--no-sync-data-files", "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-instructions"], "signature": "--no-instructions", "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": ["-s", "--show"], "signature": "-s --show", "description": "Show internal settings and exit, without doing anything else. This can be used to debug the initdb installation."}, {"names": ["--sync-method= method"], "signature": "--sync-method= method", "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": ["-S", "--sync-only"], "signature": "-S --sync-only", "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": ["-V", "--version"], "signature": "-V --version", "description": "Print the initdb version and exit."}, {"names": ["-?", "--help"], "signature": "-? --help", "description": "Show help about initdb command line arguments, and exit."}], "synopsis": ["initdb [ option ...] [ --pgdata | -D ] directory"], "environment": [{"name": "PGDATA", "description": "Specifies the directory where the database cluster is to be stored; can be overridden using the -D option."}, {"name": "PG_COLOR", "description": "Specifies whether to use color in diagnostic messages. Possible values are always , auto and never ."}, {"name": "TZ", "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 )."}]}, "comparison_hash": "9d023384fdab35b09900cd14ac90a5dbe44bace6659e36877cd11b68fb2bd76e"}, "19": {"facts": [{"label": "Documented executable", "value": "initdb"}, {"label": "Executable version", "value": "19beta4"}, {"label": "Reference inventory", "value": "Server applications"}, {"label": "Option definition groups", "value": "34"}], "tables": [{"key": "options", "rows": [{"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": {"url": "/docs/19/app-initdb.html#APP-INITDB-OPTION-AUTH", "text": "-A authmethod --auth= authmethod"}}, {"summary": "This option specifies the authentication method for local users via TCP/IP connections used in pg_hba.conf ( host lines).", "signature": {"url": "/docs/19/app-initdb.html#APP-INITDB-OPTION-AUTH-HOST", "text": "--auth-host= authmethod"}}, {"summary": "This option specifies the authentication method for local users via Unix-domain socket connections used in pg_hba.conf ( local lines).", "signature": {"url": "/docs/19/app-initdb.html#APP-INITDB-OPTION-AUTH-LOCAL", "text": "--auth-local= authmethod"}}, {"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": {"url": "/docs/19/app-initdb.html#APP-INITDB-OPTION-PGDATA", "text": "-D datadir --pgdata= datadir"}}, {"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": {"url": "/docs/19/app-initdb.html#APP-INITDB-OPTION-ENCODING", "text": "-E encoding --encoding= encoding"}}, {"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": {"url": "/docs/19/app-initdb.html#APP-INITDB-ALLOW-GROUP-ACCESS", "text": "-g --allow-group-access"}}, {"summary": "Specifies the ICU locale when the ICU provider is used. Locale support is described in Section 23.1 .", "signature": {"url": "/docs/19/app-initdb.html#APP-INITDB-ICU-LOCALE", "text": "--icu-locale= locale"}}, {"summary": "Specifies additional collation rules to customize the behavior of the default collation. This is supported for ICU only.", "signature": {"url": "/docs/19/app-initdb.html#APP-INITDB-ICU-RULES", "text": "--icu-rules= rules"}}, {"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": {"url": "/docs/19/app-initdb.html#APP-INITDB-DATA-CHECKSUMS", "text": "-k --data-checksums"}}, {"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": {"url": "/docs/19/app-initdb.html#APP-INITDB-OPTION-LOCALE", "text": "--locale= locale"}}, {"summary": "Like --locale , but only sets the locale in the specified category.", "signature": {"url": "/docs/19/app-initdb.html#APP-INITDB-OPTION-LC-COLLATE", "text": "--lc-collate= locale --lc-ctype= locale --lc-messages= locale --lc-monetary= locale --lc-numeric= locale --lc-time= locale"}}, {"summary": "Equivalent to --locale=C .", "signature": {"url": "/docs/19/app-initdb.html#APP-INITDB-OPTION-NO-LOCALE", "text": "--no-locale"}}, {"summary": "Specifies the locale name when the builtin provider is used. Locale support is described in Section 23.1 .", "signature": {"url": "/docs/19/app-initdb.html#APP-INITDB-BUILTIN-LOCALE", "text": "--builtin-locale= locale"}}, {"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": {"url": "/docs/19/app-initdb.html#APP-INITDB-OPTION-LOCALE-PROVIDER", "text": "--locale-provider={ builtin | libc | icu }"}}, {"summary": "Do not enable data checksums.", "signature": {"url": "/docs/19/app-initdb.html#APP-INITDB-NO-DATA-CHECKSUMS", "text": "--no-data-checksums"}}, {"summary": "Makes initdb read the bootstrap superuser's password from a file. The first line of the file is taken as the password.", "signature": {"url": "/docs/19/app-initdb.html#APP-INITDB-OPTION-PWFILE", "text": "--pwfile= filename"}}, {"summary": "Sets the default text search configuration. See default_text_search_config for further information.", "signature": {"url": "/docs/19/app-initdb.html#APP-INITDB-OPTION-TEXT-SEARCH-CONFIG", "text": "-T config --text-search-config= config"}}, {"summary": "Sets the user name of the bootstrap superuser . This defaults to the name of the operating-system user running initdb .", "signature": {"url": "/docs/19/app-initdb.html#APP-INITDB-OPTION-USERNAME", "text": "-U username --username= username"}}, {"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": {"url": "/docs/19/app-initdb.html#APP-INITDB-OPTION-PWPROMPT", "text": "-W --pwprompt"}}, {"summary": "This option specifies the directory where the write-ahead log should be stored.", "signature": {"url": "/docs/19/app-initdb.html#APP-INITDB-OPTION-WALDIR", "text": "-X directory --waldir= directory"}}, {"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": {"url": "/docs/19/app-initdb.html#APP-INITDB-OPTION-WAL-SEGSIZE", "text": "--wal-segsize= size"}}, {"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": {"url": "/docs/19/app-initdb.html#APP-INITDB-OPTION-SET", "text": "-c name = value --set name = value"}}, {"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": {"url": "/docs/19/app-initdb.html#APP-INITDB-OPTION-DEBUG", "text": "-d --debug"}}, {"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": {"url": "/docs/19/app-initdb.html#APP-INITDB-OPTION-DISCARD-CACHES", "text": "--discard-caches"}}, {"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": {"url": "/docs/19/app-initdb.html#APP-INITDB-OPTION-L", "text": "-L directory"}}, {"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": {"url": "/docs/19/app-initdb.html#APP-INITDB-OPTION-NO-CLEAN", "text": "-n --no-clean"}}, {"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": {"url": "/docs/19/app-initdb.html#APP-INITDB-OPTION-NO-SYNC", "text": "-N --no-sync"}}, {"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": {"url": "/docs/19/app-initdb.html#APP-INITDB-OPTION-NO-SYNC-DATA-FILES", "text": "--no-sync-data-files"}}, {"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": {"url": "/docs/19/app-initdb.html#APP-INITDB-OPTION-NO-INSTRUCTIONS", "text": "--no-instructions"}}, {"summary": "Show internal settings and exit, without doing anything else. This can be used to debug the initdb installation.", "signature": {"url": "/docs/19/app-initdb.html#APP-INITDB-OPTION-SHOW", "text": "-s --show"}}, {"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": {"url": "/docs/19/app-initdb.html#APP-INITDB-OPTION-SYNC-METHOD", "text": "--sync-method= method"}}, {"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": {"url": "/docs/19/app-initdb.html#APP-INITDB-OPTION-SYNC-ONLY", "text": "-S --sync-only"}}, {"summary": "Print the initdb version and exit.", "signature": {"url": "/docs/19/app-initdb.html#APP-INITDB-OPTION-VERSION", "text": "-V --version"}}, {"summary": "Show help about initdb command line arguments, and exit.", "signature": {"url": "/docs/19/app-initdb.html#APP-INITDB-OPTION-HELP", "text": "-? --help"}}], "title": "Documented options", "columns": [{"key": "signature", "label": "Option and arguments"}, {"key": "summary", "label": "Description"}]}, {"key": "environment", "rows": [{"name": "PGDATA", "description": "Specifies the directory where the database cluster is to be stored; can be overridden using the -D option."}, {"name": "PG_COLOR", "description": "Specifies whether to use color in diagnostic messages. Possible values are always , auto and never ."}, {"name": "TZ", "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 )."}], "title": "Environment variables", "columns": [{"key": "name", "label": "Variable"}, {"key": "description", "label": "Meaning"}]}], "options": [{"names": ["-A authmethod", "--auth= authmethod"], "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": "-A authmethod --auth= authmethod", "source_url": "/docs/19/app-initdb.html#APP-INITDB-OPTION-AUTH", "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": ["--auth-host= authmethod"], "summary": "This option specifies the authentication method for local users via TCP/IP connections used in pg_hba.conf ( host lines).", "signature": "--auth-host= authmethod", "source_url": "/docs/19/app-initdb.html#APP-INITDB-OPTION-AUTH-HOST", "description": "This option specifies the authentication method for local users via TCP/IP connections used in pg_hba.conf ( host lines)."}, {"names": ["--auth-local= authmethod"], "summary": "This option specifies the authentication method for local users via Unix-domain socket connections used in pg_hba.conf ( local lines).", "signature": "--auth-local= authmethod", "source_url": "/docs/19/app-initdb.html#APP-INITDB-OPTION-AUTH-LOCAL", "description": "This option specifies the authentication method for local users via Unix-domain socket connections used in pg_hba.conf ( local lines)."}, {"names": ["-D datadir", "--pgdata= datadir"], "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": "-D datadir --pgdata= datadir", "source_url": "/docs/19/app-initdb.html#APP-INITDB-OPTION-PGDATA", "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": ["-E encoding", "--encoding= 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": "-E encoding --encoding= encoding", "source_url": "/docs/19/app-initdb.html#APP-INITDB-OPTION-ENCODING", "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": ["-g", "--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": "-g --allow-group-access", "source_url": "/docs/19/app-initdb.html#APP-INITDB-ALLOW-GROUP-ACCESS", "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": ["--icu-locale= locale"], "summary": "Specifies the ICU locale when the ICU provider is used. Locale support is described in Section 23.1 .", "signature": "--icu-locale= locale", "source_url": "/docs/19/app-initdb.html#APP-INITDB-ICU-LOCALE", "description": "Specifies the ICU locale when the ICU provider is used. Locale support is described in Section 23.1 ."}, {"names": ["--icu-rules= rules"], "summary": "Specifies additional collation rules to customize the behavior of the default collation. This is supported for ICU only.", "signature": "--icu-rules= rules", "source_url": "/docs/19/app-initdb.html#APP-INITDB-ICU-RULES", "description": "Specifies additional collation rules to customize the behavior of the default collation. This is supported for ICU only."}, {"names": ["-k", "--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": "-k --data-checksums", "source_url": "/docs/19/app-initdb.html#APP-INITDB-DATA-CHECKSUMS", "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": ["--locale= 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": "--locale= locale", "source_url": "/docs/19/app-initdb.html#APP-INITDB-OPTION-LOCALE", "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": ["--lc-collate= locale", "--lc-ctype= locale", "--lc-messages= locale", "--lc-monetary= locale", "--lc-numeric= locale", "--lc-time= locale"], "summary": "Like --locale , but only sets the locale in the specified category.", "signature": "--lc-collate= locale --lc-ctype= locale --lc-messages= locale --lc-monetary= locale --lc-numeric= locale --lc-time= locale", "source_url": "/docs/19/app-initdb.html#APP-INITDB-OPTION-LC-COLLATE", "description": "Like --locale , but only sets the locale in the specified category."}, {"names": ["--no-locale"], "summary": "Equivalent to --locale=C .", "signature": "--no-locale", "source_url": "/docs/19/app-initdb.html#APP-INITDB-OPTION-NO-LOCALE", "description": "Equivalent to --locale=C ."}, {"names": ["--builtin-locale= locale"], "summary": "Specifies the locale name when the builtin provider is used. Locale support is described in Section 23.1 .", "signature": "--builtin-locale= locale", "source_url": "/docs/19/app-initdb.html#APP-INITDB-BUILTIN-LOCALE", "description": "Specifies the locale name when the builtin provider is used. Locale support is described in Section 23.1 ."}, {"names": ["--locale-provider={ builtin | libc | icu }"], "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": "--locale-provider={ builtin | libc | icu }", "source_url": "/docs/19/app-initdb.html#APP-INITDB-OPTION-LOCALE-PROVIDER", "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": ["--no-data-checksums"], "summary": "Do not enable data checksums.", "signature": "--no-data-checksums", "source_url": "/docs/19/app-initdb.html#APP-INITDB-NO-DATA-CHECKSUMS", "description": "Do not enable data checksums."}, {"names": ["--pwfile= filename"], "summary": "Makes initdb read the bootstrap superuser's password from a file. The first line of the file is taken as the password.", "signature": "--pwfile= filename", "source_url": "/docs/19/app-initdb.html#APP-INITDB-OPTION-PWFILE", "description": "Makes initdb read the bootstrap superuser's password from a file. The first line of the file is taken as the password."}, {"names": ["-T config", "--text-search-config= config"], "summary": "Sets the default text search configuration. See default_text_search_config for further information.", "signature": "-T config --text-search-config= config", "source_url": "/docs/19/app-initdb.html#APP-INITDB-OPTION-TEXT-SEARCH-CONFIG", "description": "Sets the default text search configuration. See default_text_search_config for further information."}, {"names": ["-U username", "--username= username"], "summary": "Sets the user name of the bootstrap superuser . This defaults to the name of the operating-system user running initdb .", "signature": "-U username --username= username", "source_url": "/docs/19/app-initdb.html#APP-INITDB-OPTION-USERNAME", "description": "Sets the user name of the bootstrap superuser . This defaults to the name of the operating-system user running initdb ."}, {"names": ["-W", "--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": "-W --pwprompt", "source_url": "/docs/19/app-initdb.html#APP-INITDB-OPTION-PWPROMPT", "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": ["-X directory", "--waldir= directory"], "summary": "This option specifies the directory where the write-ahead log should be stored.", "signature": "-X directory --waldir= directory", "source_url": "/docs/19/app-initdb.html#APP-INITDB-OPTION-WALDIR", "description": "This option specifies the directory where the write-ahead log should be stored."}, {"names": ["--wal-segsize= size"], "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": "--wal-segsize= size", "source_url": "/docs/19/app-initdb.html#APP-INITDB-OPTION-WAL-SEGSIZE", "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": ["-c name = value", "--set name = value"], "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": "-c name = value --set name = value", "source_url": "/docs/19/app-initdb.html#APP-INITDB-OPTION-SET", "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": ["-d", "--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": "-d --debug", "source_url": "/docs/19/app-initdb.html#APP-INITDB-OPTION-DEBUG", "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": ["--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": "--discard-caches", "source_url": "/docs/19/app-initdb.html#APP-INITDB-OPTION-DISCARD-CACHES", "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": ["-L directory"], "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": "-L directory", "source_url": "/docs/19/app-initdb.html#APP-INITDB-OPTION-L", "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": ["-n", "--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": "-n --no-clean", "source_url": "/docs/19/app-initdb.html#APP-INITDB-OPTION-NO-CLEAN", "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-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": "-N --no-sync", "source_url": "/docs/19/app-initdb.html#APP-INITDB-OPTION-NO-SYNC", "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": ["--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": "--no-sync-data-files", "source_url": "/docs/19/app-initdb.html#APP-INITDB-OPTION-NO-SYNC-DATA-FILES", "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-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": "--no-instructions", "source_url": "/docs/19/app-initdb.html#APP-INITDB-OPTION-NO-INSTRUCTIONS", "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": ["-s", "--show"], "summary": "Show internal settings and exit, without doing anything else. This can be used to debug the initdb installation.", "signature": "-s --show", "source_url": "/docs/19/app-initdb.html#APP-INITDB-OPTION-SHOW", "description": "Show internal settings and exit, without doing anything else. This can be used to debug the initdb installation."}, {"names": ["--sync-method= 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": "--sync-method= method", "source_url": "/docs/19/app-initdb.html#APP-INITDB-OPTION-SYNC-METHOD", "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": ["-S", "--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": "-S --sync-only", "source_url": "/docs/19/app-initdb.html#APP-INITDB-OPTION-SYNC-ONLY", "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": ["-V", "--version"], "summary": "Print the initdb version and exit.", "signature": "-V --version", "source_url": "/docs/19/app-initdb.html#APP-INITDB-OPTION-VERSION", "description": "Print the initdb version and exit."}, {"names": ["-?", "--help"], "summary": "Show help about initdb command line arguments, and exit.", "signature": "-? --help", "source_url": "/docs/19/app-initdb.html#APP-INITDB-OPTION-HELP", "description": "Show help about initdb command line arguments, and exit."}], "related": [], "release": {"ref": "https://ftp.postgresql.org/pub/source/v19beta4/postgresql-19beta4.tar.bz2", "label": "19beta4", "major": "19", "channel": "preview", "manifest": {"pdf": {"A4": {"url": "/files/documentation/pdf/19/postgresql-19-A4.pdf", "bytes": 16064841, "pages": 3052, "sha256": "4dd099e4125c591128fc5f3ebd02178dc24781f9e5ae629f96d67c4c8547427b", "built_at": "2026-09-26"}, "US": {"url": "/files/documentation/pdf/19/postgresql-19-US.pdf", "bytes": 15974616, "pages": 3225, "sha256": "61971fa857f0956d47341a0388fa6af9ae10acf691d4b2fc009007d384b0342b", "built_at": "2026-09-26"}}, "tree": "19", "index": "index.html", "major": "19", "pages": 1155, "release": "19beta4", "source_url": "https://ftp.postgresql.org/pub/source/v19beta4/postgresql-19beta4.tar.bz2", "svg_assets": 5, "source_mode": "en SGML built with pinned official archive", "source_sha256": "83157ee9c599d03b2f7a3d73ef3a56ec24e0e79cc2b3501a64d1364f56398c86"}, "revision": "1bbbbf4133d426f0e4304010688d2984c30fb67df0cc3a61b3e37eb3f6f37833", "evidence_kind": "English manual and source declarations", "source_sha256": "83157ee9c599d03b2f7a3d73ef3a56ec24e0e79cc2b3501a64d1364f56398c86"}, "sources": [{"url": "/docs/19/app-initdb.html", "file": "app-initdb.html", "label": "19beta4 English manual \u00b7 app-initdb.html", "anchor": "", "sha256": "652f26f048f167b477dd6b166872da548b8a95cec68490ef940d9bb7a95e1b46"}, {"url": "/docs/19/reference-server.html", "file": "reference-server.html", "label": "Server applications inventory", "anchor": "", "sha256": "425b070323b448b5516d2cb4e9e4ac77efb5d19dd4e8005d0ae1c61db9ec78e6"}], "sections": [], "synopsis": ["initdb [ option ...] [ --pgdata | -D ] datadir"], "signature": "initdb [ option ...] [ --pgdata | -D ] datadir", "description": ["initdb \u2014 create a new PostgreSQL database cluster"], "environment": [{"name": "PGDATA", "description": "Specifies the directory where the database cluster is to be stored; can be overridden using the -D option."}, {"name": "PG_COLOR", "description": "Specifies whether to use color in diagnostic messages. Possible values are always , auto and never ."}, {"name": "TZ", "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 )."}], "manual_html": "<div><div class=\"refentry\" id=\"APP-INITDB\">\n<div class=\"titlepage\"></div>\n<div class=\"refnamediv\">\n<h2><span class=\"refentrytitle\"><span class=\"application\">initdb</span></span></h2>\n<p>initdb \u2014 create a new <span class=\"productname\">PostgreSQL</span> database cluster</p>\n</div>\n<div class=\"refsynopsisdiv\">\n<h2>Synopsis</h2>\n<div class=\"cmdsynopsis\">\n<p id=\"id-1.9.5.3.4.1\"><code class=\"command\">initdb</code> [<em class=\"replaceable\"><code>option</code></em>...] [ <code class=\"option\">--pgdata</code> | <code class=\"option\">-D</code> ] <em class=\"replaceable\"><code>datadir</code></em></p>\n</div>\n</div>\n<div class=\"refsect1\" id=\"R1-APP-INITDB-1\">\n<h2>Description</h2>\n<p><code class=\"command\">initdb</code> creates a new <span class=\"productname\">PostgreSQL</span> <a class=\"glossterm\" href=\"/docs/19/glossary.html#GLOSSARY-DB-CLUSTER\"></a><a class=\"glossterm\" href=\"/docs/19/glossary.html#GLOSSARY-DB-CLUSTER\" title=\"Database cluster\">database cluster</a>.</p>\n<p>Creating a database cluster consists of creating the <a class=\"glossterm\" href=\"/docs/19/glossary.html#GLOSSARY-DATA-DIRECTORY\"></a><a class=\"glossterm\" href=\"/docs/19/glossary.html#GLOSSARY-DATA-DIRECTORY\" title=\"Data directory\">directories</a> 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 <code class=\"literal\">postgres</code>, <code class=\"literal\">template1</code>, and <code class=\"literal\">template0</code> databases. The <code class=\"literal\">postgres</code> database is a default database meant for use by users, utilities and third party applications. <code class=\"literal\">template1</code> and <code class=\"literal\">template0</code> are meant as source databases to be copied by later <code class=\"command\">CREATE DATABASE</code> commands. <code class=\"literal\">template0</code> should never be modified, but you can add objects to <code class=\"literal\">template1</code>, which by default will be copied into databases created later. See <a class=\"xref\" href=\"/docs/19/manage-ag-templatedbs.html\" title=\"22.3.\u00a0Template Databases\">Section\u00a022.3</a> for more details.</p>\n<p>Although <code class=\"command\">initdb</code> 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 <code class=\"command\">chown</code> to assign ownership of that directory to the database user account, then <code class=\"command\">su</code> to become the database user to run <code class=\"command\">initdb</code>.</p>\n<p><code class=\"command\">initdb</code> 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 <code class=\"command\">initdb</code> creates. Since the server cannot be run as root, you must not run <code class=\"command\">initdb</code> as root either. (It will in fact refuse to do so.)</p>\n<p>For security reasons the new cluster created by <code class=\"command\">initdb</code> will only be accessible by the cluster owner by default. The <code class=\"option\">--allow-group-access</code> 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.</p>\n<p><code class=\"command\">initdb</code> initializes the database cluster's default locale and character set encoding. These can also be set separately for each database when it is created. <code class=\"command\">initdb</code> determines those settings for the template databases, which will serve as the default for all other databases.</p>\n<p>By default, <code class=\"command\">initdb</code> uses the locale provider <code class=\"literal\">libc</code> (see <a class=\"xref\" href=\"/docs/19/locale.html#LOCALE-PROVIDERS\" title=\"23.1.4.\u00a0Locale Providers\">Section\u00a023.1.4</a>). The <code class=\"literal\">libc</code> locale provider takes the locale settings from the environment, and determines the encoding from the locale settings.</p>\n<p>To choose a different locale for the cluster, use the option <code class=\"option\">--locale</code>. There are also individual options <code class=\"option\">--lc-*</code> and <code class=\"option\">--icu-locale</code> (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.</p>\n<p>Alternatively, <code class=\"command\">initdb</code> can use the ICU library to provide locale services by specifying <code class=\"literal\">--locale-provider=icu</code>. The server must be built with ICU support. To choose the specific ICU locale ID to apply, use the option <code class=\"option\">--icu-locale</code>. Note that for implementation reasons and to support legacy code, <code class=\"command\">initdb</code> will still select and initialize libc locale settings when the ICU locale provider is used.</p>\n<p>When <code class=\"command\">initdb</code> 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.</p>\n<p>More details about locale settings can be found in <a class=\"xref\" href=\"/docs/19/locale.html\" title=\"23.1.\u00a0Locale Support\">Section\u00a023.1</a>.</p>\n<p>To alter the default encoding, use the <code class=\"option\">--encoding</code>. More details can be found in <a class=\"xref\" href=\"/docs/19/multibyte.html\" title=\"23.3.\u00a0Character Set Support\">Section\u00a023.3</a>.</p>\n</div>\n<div class=\"refsect1\" id=\"id-1.9.5.3.6\">\n<h2>Options</h2>\n<div class=\"variablelist\">\n<dl class=\"variablelist\">\n<dt id=\"APP-INITDB-OPTION-AUTH\"><span class=\"term\"><code class=\"option\">-A <em class=\"replaceable\"><code>authmethod</code></em></code><br></span><span class=\"term\"><code class=\"option\">--auth=<em class=\"replaceable\"><code>authmethod</code></em></code></span> </dt>\n<dd>\n<p>This option specifies the default authentication method for local users used in <code class=\"filename\">pg_hba.conf</code> (<code class=\"literal\">host</code> and <code class=\"literal\">local</code> lines). See <a class=\"xref\" href=\"/docs/19/auth-pg-hba-conf.html\" title=\"20.1.\u00a0The pg_hba.conf File\">Section\u00a020.1</a> for an overview of valid values.</p>\n<p><code class=\"command\">initdb</code> will prepopulate <code class=\"filename\">pg_hba.conf</code> entries using the specified authentication method for non-replication as well as replication connections.</p>\n<p>Do not use <code class=\"literal\">trust</code> unless you trust all local users on your system. <code class=\"literal\">trust</code> is the default for ease of installation.</p>\n</dd>\n<dt id=\"APP-INITDB-OPTION-AUTH-HOST\"><span class=\"term\"><code class=\"option\">--auth-host=<em class=\"replaceable\"><code>authmethod</code></em></code></span> </dt>\n<dd>\n<p>This option specifies the authentication method for local users via TCP/IP connections used in <code class=\"filename\">pg_hba.conf</code> (<code class=\"literal\">host</code> lines).</p>\n</dd>\n<dt id=\"APP-INITDB-OPTION-AUTH-LOCAL\"><span class=\"term\"><code class=\"option\">--auth-local=<em class=\"replaceable\"><code>authmethod</code></em></code></span> </dt>\n<dd>\n<p>This option specifies the authentication method for local users via Unix-domain socket connections used in <code class=\"filename\">pg_hba.conf</code> (<code class=\"literal\">local</code> lines).</p>\n</dd>\n<dt id=\"APP-INITDB-OPTION-PGDATA\"><span class=\"term\"><code class=\"option\">-D <em class=\"replaceable\"><code>datadir</code></em></code><br></span><span class=\"term\"><code class=\"option\">--pgdata=<em class=\"replaceable\"><code>datadir</code></em></code></span> </dt>\n<dd>\n<p>This option specifies the directory where the database cluster should be stored. This is the only information required by <code class=\"command\">initdb</code>, but you can avoid writing it by setting the <code class=\"envar\">PGDATA</code> environment variable, which can be convenient since the database server (<code class=\"command\">postgres</code>) can find the data directory later by the same variable.</p>\n</dd>\n<dt id=\"APP-INITDB-OPTION-ENCODING\"><span class=\"term\"><code class=\"option\">-E <em class=\"replaceable\"><code>encoding</code></em></code><br></span><span class=\"term\"><code class=\"option\">--encoding=<em class=\"replaceable\"><code>encoding</code></em></code></span> </dt>\n<dd>\n<p>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 <span class=\"productname\">PostgreSQL</span> server are described in <a class=\"xref\" href=\"/docs/19/multibyte.html#MULTIBYTE-CHARSET-SUPPORTED\" title=\"23.3.1.\u00a0Supported Character Sets\">Section\u00a023.3.1</a>.</p>\n<p>By default, the template database encoding is derived from the locale. If <a class=\"xref\" href=\"/docs/19/app-initdb.html#APP-INITDB-OPTION-NO-LOCALE\"><code class=\"option\">--no-locale</code></a> is specified (or equivalently, if the locale is <code class=\"literal\">C</code> or <code class=\"literal\">POSIX</code>), then the default is <code class=\"literal\">UTF8</code> for the ICU provider and <code class=\"literal\">SQL_ASCII</code> for the <code class=\"literal\">libc</code> provider.</p>\n</dd>\n<dt id=\"APP-INITDB-ALLOW-GROUP-ACCESS\"><span class=\"term\"><code class=\"option\">-g</code><br></span><span class=\"term\"><code class=\"option\">--allow-group-access</code></span> </dt>\n<dd>\n<p>Allows users in the same group as the cluster owner to read all cluster files created by <code class=\"command\">initdb</code>. This option is ignored on <span class=\"productname\">Windows</span> as it does not support POSIX-style group permissions.</p>\n</dd>\n<dt id=\"APP-INITDB-ICU-LOCALE\"><span class=\"term\"><code class=\"option\">--icu-locale=<em class=\"replaceable\"><code>locale</code></em></code></span> </dt>\n<dd>\n<p>Specifies the ICU locale when the ICU provider is used. Locale support is described in <a class=\"xref\" href=\"/docs/19/locale.html\" title=\"23.1.\u00a0Locale Support\">Section\u00a023.1</a>.</p>\n</dd>\n<dt id=\"APP-INITDB-ICU-RULES\"><span class=\"term\"><code class=\"option\">--icu-rules=<em class=\"replaceable\"><code>rules</code></em></code></span> </dt>\n<dd>\n<p>Specifies additional collation rules to customize the behavior of the default collation. This is supported for ICU only.</p>\n</dd>\n<dt id=\"APP-INITDB-DATA-CHECKSUMS\"><span class=\"term\"><code class=\"option\">-k</code><br></span><span class=\"term\"><code class=\"option\">--data-checksums</code></span> </dt>\n<dd>\n<p>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 <a class=\"xref\" href=\"/docs/19/app-initdb.html#APP-INITDB-NO-DATA-CHECKSUMS\"><code class=\"option\">--no-data-checksums</code></a> to disable checksums.</p>\n<p>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 <a class=\"link\" href=\"/docs/19/monitoring-stats.html#MONITORING-PG-STAT-DATABASE-VIEW\" title=\"27.2.19.\u00a0pg_stat_database\"><code class=\"structname\">pg_stat_database</code></a> view. See <a class=\"xref\" href=\"/docs/19/checksums.html\" title=\"28.2.\u00a0Data Checksums\">Section\u00a028.2</a> for details.</p>\n</dd>\n<dt id=\"APP-INITDB-OPTION-LOCALE\"><span class=\"term\"><code class=\"option\">--locale=<em class=\"replaceable\"><code>locale</code></em></code></span> </dt>\n<dd>\n<p>Sets the default locale for the database cluster. If this option is not specified, the locale is inherited from the environment that <code class=\"command\">initdb</code> runs in. Locale support is described in <a class=\"xref\" href=\"/docs/19/locale.html\" title=\"23.1.\u00a0Locale Support\">Section\u00a023.1</a>.</p>\n<p>If <code class=\"option\">--locale-provider</code> is <code class=\"literal\">builtin</code>, <code class=\"option\">--locale</code> or <code class=\"option\">--builtin-locale</code> must be specified and set to <code class=\"literal\">C</code>, <code class=\"literal\">C.UTF-8</code> or <code class=\"literal\">PG_UNICODE_FAST</code>.</p>\n</dd>\n<dt id=\"APP-INITDB-OPTION-LC-COLLATE\"><span class=\"term\"><code class=\"option\">--lc-collate=<em class=\"replaceable\"><code>locale</code></em></code><br></span><span class=\"term\"><code class=\"option\">--lc-ctype=<em class=\"replaceable\"><code>locale</code></em></code><br></span><span class=\"term\"><code class=\"option\">--lc-messages=<em class=\"replaceable\"><code>locale</code></em></code><br></span><span class=\"term\"><code class=\"option\">--lc-monetary=<em class=\"replaceable\"><code>locale</code></em></code><br></span><span class=\"term\"><code class=\"option\">--lc-numeric=<em class=\"replaceable\"><code>locale</code></em></code><br></span><span class=\"term\"><code class=\"option\">--lc-time=<em class=\"replaceable\"><code>locale</code></em></code></span> </dt>\n<dd>\n<p>Like <code class=\"option\">--locale</code>, but only sets the locale in the specified category.</p>\n</dd>\n<dt id=\"APP-INITDB-OPTION-NO-LOCALE\"><span class=\"term\"><code class=\"option\">--no-locale</code></span> </dt>\n<dd>\n<p>Equivalent to <code class=\"option\">--locale=C</code>.</p>\n</dd>\n<dt id=\"APP-INITDB-BUILTIN-LOCALE\"><span class=\"term\"><code class=\"option\">--builtin-locale=<em class=\"replaceable\"><code>locale</code></em></code></span> </dt>\n<dd>\n<p>Specifies the locale name when the builtin provider is used. Locale support is described in <a class=\"xref\" href=\"/docs/19/locale.html\" title=\"23.1.\u00a0Locale Support\">Section\u00a023.1</a>.</p>\n</dd>\n<dt id=\"APP-INITDB-OPTION-LOCALE-PROVIDER\"><span class=\"term\"><code class=\"option\">--locale-provider={<code class=\"literal\">builtin</code>|<code class=\"literal\">libc</code>|<code class=\"literal\">icu</code>}</code></span> </dt>\n<dd>\n<p>This option sets the locale provider for databases created in the new cluster. It can be overridden in the <code class=\"command\">CREATE DATABASE</code> command when new databases are subsequently created. The default is <code class=\"literal\">libc</code> (see <a class=\"xref\" href=\"/docs/19/locale.html#LOCALE-PROVIDERS\" title=\"23.1.4.\u00a0Locale Providers\">Section\u00a023.1.4</a>).</p>\n</dd>\n<dt id=\"APP-INITDB-NO-DATA-CHECKSUMS\"><span class=\"term\"><code class=\"option\">--no-data-checksums</code></span> </dt>\n<dd>\n<p>Do not enable data checksums.</p>\n</dd>\n<dt id=\"APP-INITDB-OPTION-PWFILE\"><span class=\"term\"><code class=\"option\">--pwfile=<em class=\"replaceable\"><code>filename</code></em></code></span> </dt>\n<dd>\n<p>Makes <code class=\"command\">initdb</code> read the bootstrap superuser's password from a file. The first line of the file is taken as the password.</p>\n</dd>\n<dt id=\"APP-INITDB-OPTION-TEXT-SEARCH-CONFIG\"><span class=\"term\"><code class=\"option\">-T <em class=\"replaceable\"><code>config</code></em></code><br></span><span class=\"term\"><code class=\"option\">--text-search-config=<em class=\"replaceable\"><code>config</code></em></code></span> </dt>\n<dd>\n<p>Sets the default text search configuration. See <a class=\"xref\" href=\"/docs/19/runtime-config-client.html#GUC-DEFAULT-TEXT-SEARCH-CONFIG\">default_text_search_config</a> for further information.</p>\n</dd>\n<dt id=\"APP-INITDB-OPTION-USERNAME\"><span class=\"term\"><code class=\"option\">-U <em class=\"replaceable\"><code>username</code></em></code><br></span><span class=\"term\"><code class=\"option\">--username=<em class=\"replaceable\"><code>username</code></em></code></span> </dt>\n<dd>\n<p>Sets the user name of the <a class=\"glossterm\" href=\"/docs/19/glossary.html#GLOSSARY-BOOTSTRAP-SUPERUSER\"></a><a class=\"glossterm\" href=\"/docs/19/glossary.html#GLOSSARY-BOOTSTRAP-SUPERUSER\" title=\"Bootstrap superuser\">bootstrap superuser</a>. This defaults to the name of the operating-system user running <code class=\"command\">initdb</code>.</p>\n</dd>\n<dt id=\"APP-INITDB-OPTION-PWPROMPT\"><span class=\"term\"><code class=\"option\">-W</code><br></span><span class=\"term\"><code class=\"option\">--pwprompt</code></span> </dt>\n<dd>\n<p>Makes <code class=\"command\">initdb</code> 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.</p>\n</dd>\n<dt id=\"APP-INITDB-OPTION-WALDIR\"><span class=\"term\"><code class=\"option\">-X <em class=\"replaceable\"><code>directory</code></em></code><br></span><span class=\"term\"><code class=\"option\">--waldir=<em class=\"replaceable\"><code>directory</code></em></code></span> </dt>\n<dd>\n<p>This option specifies the directory where the write-ahead log should be stored.</p>\n</dd>\n<dt id=\"APP-INITDB-OPTION-WAL-SEGSIZE\"><span class=\"term\"><code class=\"option\">--wal-segsize=<em class=\"replaceable\"><code>size</code></em></code></span> </dt>\n<dd>\n<p>Set the <em class=\"firstterm\">WAL segment size</em>, 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.</p>\n<p>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.</p>\n</dd>\n</dl>\n</div>\n<p>Other, less commonly used, options are also available:</p>\n<div class=\"variablelist\">\n<dl class=\"variablelist\">\n<dt id=\"APP-INITDB-OPTION-SET\"><span class=\"term\"><code class=\"option\">-c <em class=\"replaceable\"><code>name</code></em>=<em class=\"replaceable\"><code>value</code></em></code><br></span><span class=\"term\"><code class=\"option\">--set <em class=\"replaceable\"><code>name</code></em>=<em class=\"replaceable\"><code>value</code></em></code></span> </dt>\n<dd>\n<p>Forcibly set the server parameter <em class=\"replaceable\"><code>name</code></em> to <em class=\"replaceable\"><code>value</code></em> during <code class=\"command\">initdb</code>, and also install that setting in the generated <code class=\"filename\">postgresql.conf</code> 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.</p>\n</dd>\n<dt id=\"APP-INITDB-OPTION-DEBUG\"><span class=\"term\"><code class=\"option\">-d</code><br></span><span class=\"term\"><code class=\"option\">--debug</code></span> </dt>\n<dd>\n<p>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 <code class=\"command\">initdb</code> uses to create the catalog tables. This option generates a tremendous amount of extremely boring output.</p>\n</dd>\n<dt id=\"APP-INITDB-OPTION-DISCARD-CACHES\"><span class=\"term\"><code class=\"option\">--discard-caches</code></span> </dt>\n<dd>\n<p>Run the bootstrap backend with the <code class=\"literal\">debug_discard_caches=1</code> option. This takes a very long time and is only of use for deep debugging.</p>\n</dd>\n<dt id=\"APP-INITDB-OPTION-L\"><span class=\"term\"><code class=\"option\">-L <em class=\"replaceable\"><code>directory</code></em></code></span> </dt>\n<dd>\n<p>Specifies where <code class=\"command\">initdb</code> 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.</p>\n</dd>\n<dt id=\"APP-INITDB-OPTION-NO-CLEAN\"><span class=\"term\"><code class=\"option\">-n</code><br></span><span class=\"term\"><code class=\"option\">--no-clean</code></span> </dt>\n<dd>\n<p>By default, when <code class=\"command\">initdb</code> 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.</p>\n</dd>\n<dt id=\"APP-INITDB-OPTION-NO-SYNC\"><span class=\"term\"><code class=\"option\">-N</code><br></span><span class=\"term\"><code class=\"option\">--no-sync</code></span> </dt>\n<dd>\n<p>By default, <code class=\"command\">initdb</code> will wait for all files to be written safely to disk. This option causes <code class=\"command\">initdb</code> 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.</p>\n</dd>\n<dt id=\"APP-INITDB-OPTION-NO-SYNC-DATA-FILES\"><span class=\"term\"><code class=\"option\">--no-sync-data-files</code></span> </dt>\n<dd>\n<p>By default, <code class=\"command\">initdb</code> safely writes all database files to disk. This option instructs <code class=\"command\">initdb</code> to skip synchronizing all files in the individual database directories, the database directories themselves, and the tablespace directories, i.e., everything in the <code class=\"filename\">base</code> subdirectory and any other tablespace directories. Other files, such as those in <code class=\"literal\">pg_wal</code> and <code class=\"literal\">pg_xact</code>, will still be synchronized unless the <code class=\"option\">--no-sync</code> option is also specified.</p>\n<p>Note that if <code class=\"option\">--no-sync-data-files</code> is used in conjunction with <code class=\"option\">--sync-method=syncfs</code>, some or all of the aforementioned files and directories will be synchronized because <code class=\"literal\">syncfs</code> processes entire file systems.</p>\n<p>This option is primarily intended for internal use by tools that separately ensure the skipped files are synchronized to disk.</p>\n</dd>\n<dt id=\"APP-INITDB-OPTION-NO-INSTRUCTIONS\"><span class=\"term\"><code class=\"option\">--no-instructions</code></span> </dt>\n<dd>\n<p>By default, <code class=\"command\">initdb</code> 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 <code class=\"command\">initdb</code> in platform-specific behavior, where those instructions are likely to be incorrect.</p>\n</dd>\n<dt id=\"APP-INITDB-OPTION-SHOW\"><span class=\"term\"><code class=\"option\">-s</code><br></span><span class=\"term\"><code class=\"option\">--show</code></span> </dt>\n<dd>\n<p>Show internal settings and exit, without doing anything else. This can be used to debug the <span class=\"application\">initdb</span> installation.</p>\n</dd>\n<dt id=\"APP-INITDB-OPTION-SYNC-METHOD\"><span class=\"term\"><code class=\"option\">--sync-method=<em class=\"replaceable\"><code>method</code></em></code></span> </dt>\n<dd>\n<p>When set to <code class=\"literal\">fsync</code>, which is the default, <code class=\"command\">initdb</code> 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.</p>\n<p>On Linux, <code class=\"literal\">syncfs</code> 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 <a class=\"xref\" href=\"/docs/19/runtime-config-error-handling.html#GUC-RECOVERY-INIT-SYNC-METHOD\">recovery_init_sync_method</a> for information about the caveats to be aware of when using <code class=\"literal\">syncfs</code>.</p>\n<p>This option has no effect when <code class=\"option\">--no-sync</code> is used.</p>\n</dd>\n<dt id=\"APP-INITDB-OPTION-SYNC-ONLY\"><span class=\"term\"><code class=\"option\">-S</code><br></span><span class=\"term\"><code class=\"option\">--sync-only</code></span> </dt>\n<dd>\n<p>Safely write all database files to disk and exit. This does not perform any of the normal <span class=\"application\">initdb</span> operations. Generally, this option is useful for ensuring reliable recovery after changing <a class=\"xref\" href=\"/docs/19/runtime-config-wal.html#GUC-FSYNC\">fsync</a> from <code class=\"literal\">off</code> to <code class=\"literal\">on</code>.</p>\n</dd>\n</dl>\n</div>\n<p>Other options:</p>\n<div class=\"variablelist\">\n<dl class=\"variablelist\">\n<dt id=\"APP-INITDB-OPTION-VERSION\"><span class=\"term\"><code class=\"option\">-V</code><br></span><span class=\"term\"><code class=\"option\">--version</code></span> </dt>\n<dd>\n<p>Print the <span class=\"application\">initdb</span> version and exit.</p>\n</dd>\n<dt id=\"APP-INITDB-OPTION-HELP\"><span class=\"term\"><code class=\"option\">-?</code><br></span><span class=\"term\"><code class=\"option\">--help</code></span> </dt>\n<dd>\n<p>Show help about <span class=\"application\">initdb</span> command line arguments, and exit.</p>\n</dd>\n</dl>\n</div>\n</div>\n<div class=\"refsect1\" id=\"id-1.9.5.3.7\">\n<h2>Environment</h2>\n<div class=\"variablelist\">\n<dl class=\"variablelist\">\n<dt id=\"APP-INITDB-ENVIRONMENT-PGDATA\"><span class=\"term\"><code class=\"envar\">PGDATA</code></span> </dt>\n<dd>\n<p>Specifies the directory where the database cluster is to be stored; can be overridden using the <code class=\"option\">-D</code> option.</p>\n</dd>\n<dt id=\"APP-INITDB-ENVIRONMENT-PG-COLOR\"><span class=\"term\"><code class=\"envar\">PG_COLOR</code></span> </dt>\n<dd>\n<p>Specifies whether to use color in diagnostic messages. Possible values are <code class=\"literal\">always</code>, <code class=\"literal\">auto</code> and <code class=\"literal\">never</code>.</p>\n</dd>\n<dt id=\"APP-INITDB-ENVIRONMENT-TZ\"><span class=\"term\"><code class=\"envar\">TZ</code></span> </dt>\n<dd>\n<p>Specifies the default time zone of the created database cluster. The value should be a full time zone name (see <a class=\"xref\" href=\"/docs/19/datatype-datetime.html#DATATYPE-TIMEZONES\" title=\"8.5.3.\u00a0Time Zones\">Section\u00a08.5.3</a>).</p>\n</dd>\n</dl>\n</div>\n</div>\n<div class=\"refsect1\" id=\"id-1.9.5.3.8\">\n<h2>Notes</h2>\n<p><code class=\"command\">initdb</code> can also be invoked via <code class=\"command\">pg_ctl initdb</code>.</p>\n</div>\n<div class=\"refsect1\" id=\"id-1.9.5.3.9\">\n<h2>See Also</h2><span class=\"simplelist\"><a class=\"xref\" href=\"/docs/19/app-pg-ctl.html\" title=\"pg_ctl\"><span class=\"refentrytitle\"><span class=\"application\">pg_ctl</span></span></a>, <a class=\"xref\" href=\"/docs/19/app-postgres.html\" title=\"postgres\"><span class=\"refentrytitle\"><span class=\"application\">postgres</span></span></a>, <a class=\"xref\" href=\"/docs/19/auth-pg-hba-conf.html\" title=\"20.1.\u00a0The pg_hba.conf File\">Section\u00a020.1</a></span>\n</div>\n</div></div>", "manual_path": "app-initdb.html", "comparison_data": {"options": [{"names": ["-A authmethod", "--auth= authmethod"], "signature": "-A authmethod --auth= authmethod", "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": ["--auth-host= authmethod"], "signature": "--auth-host= authmethod", "description": "This option specifies the authentication method for local users via TCP/IP connections used in pg_hba.conf ( host lines)."}, {"names": ["--auth-local= authmethod"], "signature": "--auth-local= authmethod", "description": "This option specifies the authentication method for local users via Unix-domain socket connections used in pg_hba.conf ( local lines)."}, {"names": ["-D datadir", "--pgdata= datadir"], "signature": "-D datadir --pgdata= datadir", "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": ["-E encoding", "--encoding= encoding"], "signature": "-E encoding --encoding= encoding", "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": ["-g", "--allow-group-access"], "signature": "-g --allow-group-access", "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": ["--icu-locale= locale"], "signature": "--icu-locale= locale", "description": "Specifies the ICU locale when the ICU provider is used. Locale support is described in Section 23.1 ."}, {"names": ["--icu-rules= rules"], "signature": "--icu-rules= rules", "description": "Specifies additional collation rules to customize the behavior of the default collation. This is supported for ICU only."}, {"names": ["-k", "--data-checksums"], "signature": "-k --data-checksums", "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": ["--locale= locale"], "signature": "--locale= locale", "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": ["--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": "Like --locale , but only sets the locale in the specified category."}, {"names": ["--no-locale"], "signature": "--no-locale", "description": "Equivalent to --locale=C ."}, {"names": ["--builtin-locale= locale"], "signature": "--builtin-locale= locale", "description": "Specifies the locale name when the builtin provider is used. Locale support is described in Section 23.1 ."}, {"names": ["--locale-provider={ builtin | libc | icu }"], "signature": "--locale-provider={ builtin | libc | icu }", "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": ["--no-data-checksums"], "signature": "--no-data-checksums", "description": "Do not enable data checksums."}, {"names": ["--pwfile= filename"], "signature": "--pwfile= filename", "description": "Makes initdb read the bootstrap superuser's password from a file. The first line of the file is taken as the password."}, {"names": ["-T config", "--text-search-config= config"], "signature": "-T config --text-search-config= config", "description": "Sets the default text search configuration. See default_text_search_config for further information."}, {"names": ["-U username", "--username= username"], "signature": "-U username --username= username", "description": "Sets the user name of the bootstrap superuser . This defaults to the name of the operating-system user running initdb ."}, {"names": ["-W", "--pwprompt"], "signature": "-W --pwprompt", "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": ["-X directory", "--waldir= directory"], "signature": "-X directory --waldir= directory", "description": "This option specifies the directory where the write-ahead log should be stored."}, {"names": ["--wal-segsize= size"], "signature": "--wal-segsize= size", "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": ["-c name = value", "--set name = value"], "signature": "-c name = value --set name = value", "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": ["-d", "--debug"], "signature": "-d --debug", "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": ["--discard-caches"], "signature": "--discard-caches", "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": ["-L directory"], "signature": "-L directory", "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": ["-n", "--no-clean"], "signature": "-n --no-clean", "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-sync"], "signature": "-N --no-sync", "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": ["--no-sync-data-files"], "signature": "--no-sync-data-files", "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-instructions"], "signature": "--no-instructions", "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": ["-s", "--show"], "signature": "-s --show", "description": "Show internal settings and exit, without doing anything else. This can be used to debug the initdb installation."}, {"names": ["--sync-method= method"], "signature": "--sync-method= method", "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": ["-S", "--sync-only"], "signature": "-S --sync-only", "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": ["-V", "--version"], "signature": "-V --version", "description": "Print the initdb version and exit."}, {"names": ["-?", "--help"], "signature": "-? --help", "description": "Show help about initdb command line arguments, and exit."}], "synopsis": ["initdb [ option ...] [ --pgdata | -D ] datadir"], "environment": [{"name": "PGDATA", "description": "Specifies the directory where the database cluster is to be stored; can be overridden using the -D option."}, {"name": "PG_COLOR", "description": "Specifies whether to use color in diagnostic messages. Possible values are always , auto and never ."}, {"name": "TZ", "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 )."}]}, "comparison_hash": "3cf749b075e58e1590879efbcd64138d328a60046d79748365cf90a80781fbdd"}, "20": {"facts": [{"label": "Documented executable", "value": "initdb"}, {"label": "Executable version", "value": "20devel"}, {"label": "Reference inventory", "value": "Server applications"}, {"label": "Option definition groups", "value": "34"}], "tables": [{"key": "options", "rows": [{"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": {"url": "/docs/devel/app-initdb.html#APP-INITDB-OPTION-AUTH", "text": "-A authmethod --auth= authmethod"}}, {"summary": "This option specifies the authentication method for local users via TCP/IP connections used in pg_hba.conf ( host lines).", "signature": {"url": "/docs/devel/app-initdb.html#APP-INITDB-OPTION-AUTH-HOST", "text": "--auth-host= authmethod"}}, {"summary": "This option specifies the authentication method for local users via Unix-domain socket connections used in pg_hba.conf ( local lines).", "signature": {"url": "/docs/devel/app-initdb.html#APP-INITDB-OPTION-AUTH-LOCAL", "text": "--auth-local= authmethod"}}, {"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": {"url": "/docs/devel/app-initdb.html#APP-INITDB-OPTION-PGDATA", "text": "-D datadir --pgdata= datadir"}}, {"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": {"url": "/docs/devel/app-initdb.html#APP-INITDB-OPTION-ENCODING", "text": "-E encoding --encoding= encoding"}}, {"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": {"url": "/docs/devel/app-initdb.html#APP-INITDB-ALLOW-GROUP-ACCESS", "text": "-g --allow-group-access"}}, {"summary": "Specifies the ICU locale when the ICU provider is used. Locale support is described in Section 23.1 .", "signature": {"url": "/docs/devel/app-initdb.html#APP-INITDB-ICU-LOCALE", "text": "--icu-locale= locale"}}, {"summary": "Specifies additional collation rules to customize the behavior of the default collation. This is supported for ICU only.", "signature": {"url": "/docs/devel/app-initdb.html#APP-INITDB-ICU-RULES", "text": "--icu-rules= rules"}}, {"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": {"url": "/docs/devel/app-initdb.html#APP-INITDB-DATA-CHECKSUMS", "text": "-k --data-checksums"}}, {"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": {"url": "/docs/devel/app-initdb.html#APP-INITDB-OPTION-LOCALE", "text": "--locale= locale"}}, {"summary": "Like --locale , but only sets the locale in the specified category.", "signature": {"url": "/docs/devel/app-initdb.html#APP-INITDB-OPTION-LC-COLLATE", "text": "--lc-collate= locale --lc-ctype= locale --lc-messages= locale --lc-monetary= locale --lc-numeric= locale --lc-time= locale"}}, {"summary": "Equivalent to --locale=C .", "signature": {"url": "/docs/devel/app-initdb.html#APP-INITDB-OPTION-NO-LOCALE", "text": "--no-locale"}}, {"summary": "Specifies the locale name when the builtin provider is used. Locale support is described in Section 23.1 .", "signature": {"url": "/docs/devel/app-initdb.html#APP-INITDB-BUILTIN-LOCALE", "text": "--builtin-locale= locale"}}, {"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": {"url": "/docs/devel/app-initdb.html#APP-INITDB-OPTION-LOCALE-PROVIDER", "text": "--locale-provider={ builtin | libc | icu }"}}, {"summary": "Do not enable data checksums.", "signature": {"url": "/docs/devel/app-initdb.html#APP-INITDB-NO-DATA-CHECKSUMS", "text": "--no-data-checksums"}}, {"summary": "Makes initdb read the bootstrap superuser's password from a file. The first line of the file is taken as the password.", "signature": {"url": "/docs/devel/app-initdb.html#APP-INITDB-OPTION-PWFILE", "text": "--pwfile= filename"}}, {"summary": "Sets the default text search configuration. See default_text_search_config for further information.", "signature": {"url": "/docs/devel/app-initdb.html#APP-INITDB-OPTION-TEXT-SEARCH-CONFIG", "text": "-T config --text-search-config= config"}}, {"summary": "Sets the user name of the bootstrap superuser . This defaults to the name of the operating-system user running initdb .", "signature": {"url": "/docs/devel/app-initdb.html#APP-INITDB-OPTION-USERNAME", "text": "-U username --username= username"}}, {"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": {"url": "/docs/devel/app-initdb.html#APP-INITDB-OPTION-PWPROMPT", "text": "-W --pwprompt"}}, {"summary": "This option specifies the directory where the write-ahead log should be stored.", "signature": {"url": "/docs/devel/app-initdb.html#APP-INITDB-OPTION-WALDIR", "text": "-X directory --waldir= directory"}}, {"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": {"url": "/docs/devel/app-initdb.html#APP-INITDB-OPTION-WAL-SEGSIZE", "text": "--wal-segsize= size"}}, {"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": {"url": "/docs/devel/app-initdb.html#APP-INITDB-OPTION-SET", "text": "-c name = value --set name = value"}}, {"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": {"url": "/docs/devel/app-initdb.html#APP-INITDB-OPTION-DEBUG", "text": "-d --debug"}}, {"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": {"url": "/docs/devel/app-initdb.html#APP-INITDB-OPTION-DISCARD-CACHES", "text": "--discard-caches"}}, {"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": {"url": "/docs/devel/app-initdb.html#APP-INITDB-OPTION-L", "text": "-L directory"}}, {"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": {"url": "/docs/devel/app-initdb.html#APP-INITDB-OPTION-NO-CLEAN", "text": "-n --no-clean"}}, {"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": {"url": "/docs/devel/app-initdb.html#APP-INITDB-OPTION-NO-SYNC", "text": "-N --no-sync"}}, {"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": {"url": "/docs/devel/app-initdb.html#APP-INITDB-OPTION-NO-SYNC-DATA-FILES", "text": "--no-sync-data-files"}}, {"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": {"url": "/docs/devel/app-initdb.html#APP-INITDB-OPTION-NO-INSTRUCTIONS", "text": "--no-instructions"}}, {"summary": "Show internal settings and exit, without doing anything else. This can be used to debug the initdb installation.", "signature": {"url": "/docs/devel/app-initdb.html#APP-INITDB-OPTION-SHOW", "text": "-s --show"}}, {"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": {"url": "/docs/devel/app-initdb.html#APP-INITDB-OPTION-SYNC-METHOD", "text": "--sync-method= method"}}, {"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": {"url": "/docs/devel/app-initdb.html#APP-INITDB-OPTION-SYNC-ONLY", "text": "-S --sync-only"}}, {"summary": "Print the initdb version and exit.", "signature": {"url": "/docs/devel/app-initdb.html#APP-INITDB-OPTION-VERSION", "text": "-V --version"}}, {"summary": "Show help about initdb command line arguments, and exit.", "signature": {"url": "/docs/devel/app-initdb.html#APP-INITDB-OPTION-HELP", "text": "-? --help"}}], "title": "Documented options", "columns": [{"key": "signature", "label": "Option and arguments"}, {"key": "summary", "label": "Description"}]}, {"key": "environment", "rows": [{"name": "PGDATA", "description": "Specifies the directory where the database cluster is to be stored; can be overridden using the -D option."}, {"name": "PG_COLOR", "description": "Specifies whether to use color in diagnostic messages. Possible values are always , auto and never ."}, {"name": "TZ", "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 )."}], "title": "Environment variables", "columns": [{"key": "name", "label": "Variable"}, {"key": "description", "label": "Meaning"}]}], "options": [{"names": ["-A authmethod", "--auth= authmethod"], "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": "-A authmethod --auth= authmethod", "source_url": "/docs/devel/app-initdb.html#APP-INITDB-OPTION-AUTH", "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": ["--auth-host= authmethod"], "summary": "This option specifies the authentication method for local users via TCP/IP connections used in pg_hba.conf ( host lines).", "signature": "--auth-host= authmethod", "source_url": "/docs/devel/app-initdb.html#APP-INITDB-OPTION-AUTH-HOST", "description": "This option specifies the authentication method for local users via TCP/IP connections used in pg_hba.conf ( host lines)."}, {"names": ["--auth-local= authmethod"], "summary": "This option specifies the authentication method for local users via Unix-domain socket connections used in pg_hba.conf ( local lines).", "signature": "--auth-local= authmethod", "source_url": "/docs/devel/app-initdb.html#APP-INITDB-OPTION-AUTH-LOCAL", "description": "This option specifies the authentication method for local users via Unix-domain socket connections used in pg_hba.conf ( local lines)."}, {"names": ["-D datadir", "--pgdata= datadir"], "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": "-D datadir --pgdata= datadir", "source_url": "/docs/devel/app-initdb.html#APP-INITDB-OPTION-PGDATA", "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": ["-E encoding", "--encoding= 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": "-E encoding --encoding= encoding", "source_url": "/docs/devel/app-initdb.html#APP-INITDB-OPTION-ENCODING", "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": ["-g", "--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": "-g --allow-group-access", "source_url": "/docs/devel/app-initdb.html#APP-INITDB-ALLOW-GROUP-ACCESS", "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": ["--icu-locale= locale"], "summary": "Specifies the ICU locale when the ICU provider is used. Locale support is described in Section 23.1 .", "signature": "--icu-locale= locale", "source_url": "/docs/devel/app-initdb.html#APP-INITDB-ICU-LOCALE", "description": "Specifies the ICU locale when the ICU provider is used. Locale support is described in Section 23.1 ."}, {"names": ["--icu-rules= rules"], "summary": "Specifies additional collation rules to customize the behavior of the default collation. This is supported for ICU only.", "signature": "--icu-rules= rules", "source_url": "/docs/devel/app-initdb.html#APP-INITDB-ICU-RULES", "description": "Specifies additional collation rules to customize the behavior of the default collation. This is supported for ICU only."}, {"names": ["-k", "--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": "-k --data-checksums", "source_url": "/docs/devel/app-initdb.html#APP-INITDB-DATA-CHECKSUMS", "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": ["--locale= 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": "--locale= locale", "source_url": "/docs/devel/app-initdb.html#APP-INITDB-OPTION-LOCALE", "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": ["--lc-collate= locale", "--lc-ctype= locale", "--lc-messages= locale", "--lc-monetary= locale", "--lc-numeric= locale", "--lc-time= locale"], "summary": "Like --locale , but only sets the locale in the specified category.", "signature": "--lc-collate= locale --lc-ctype= locale --lc-messages= locale --lc-monetary= locale --lc-numeric= locale --lc-time= locale", "source_url": "/docs/devel/app-initdb.html#APP-INITDB-OPTION-LC-COLLATE", "description": "Like --locale , but only sets the locale in the specified category."}, {"names": ["--no-locale"], "summary": "Equivalent to --locale=C .", "signature": "--no-locale", "source_url": "/docs/devel/app-initdb.html#APP-INITDB-OPTION-NO-LOCALE", "description": "Equivalent to --locale=C ."}, {"names": ["--builtin-locale= locale"], "summary": "Specifies the locale name when the builtin provider is used. Locale support is described in Section 23.1 .", "signature": "--builtin-locale= locale", "source_url": "/docs/devel/app-initdb.html#APP-INITDB-BUILTIN-LOCALE", "description": "Specifies the locale name when the builtin provider is used. Locale support is described in Section 23.1 ."}, {"names": ["--locale-provider={ builtin | libc | icu }"], "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": "--locale-provider={ builtin | libc | icu }", "source_url": "/docs/devel/app-initdb.html#APP-INITDB-OPTION-LOCALE-PROVIDER", "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": ["--no-data-checksums"], "summary": "Do not enable data checksums.", "signature": "--no-data-checksums", "source_url": "/docs/devel/app-initdb.html#APP-INITDB-NO-DATA-CHECKSUMS", "description": "Do not enable data checksums."}, {"names": ["--pwfile= filename"], "summary": "Makes initdb read the bootstrap superuser's password from a file. The first line of the file is taken as the password.", "signature": "--pwfile= filename", "source_url": "/docs/devel/app-initdb.html#APP-INITDB-OPTION-PWFILE", "description": "Makes initdb read the bootstrap superuser's password from a file. The first line of the file is taken as the password."}, {"names": ["-T config", "--text-search-config= config"], "summary": "Sets the default text search configuration. See default_text_search_config for further information.", "signature": "-T config --text-search-config= config", "source_url": "/docs/devel/app-initdb.html#APP-INITDB-OPTION-TEXT-SEARCH-CONFIG", "description": "Sets the default text search configuration. See default_text_search_config for further information."}, {"names": ["-U username", "--username= username"], "summary": "Sets the user name of the bootstrap superuser . This defaults to the name of the operating-system user running initdb .", "signature": "-U username --username= username", "source_url": "/docs/devel/app-initdb.html#APP-INITDB-OPTION-USERNAME", "description": "Sets the user name of the bootstrap superuser . This defaults to the name of the operating-system user running initdb ."}, {"names": ["-W", "--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": "-W --pwprompt", "source_url": "/docs/devel/app-initdb.html#APP-INITDB-OPTION-PWPROMPT", "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": ["-X directory", "--waldir= directory"], "summary": "This option specifies the directory where the write-ahead log should be stored.", "signature": "-X directory --waldir= directory", "source_url": "/docs/devel/app-initdb.html#APP-INITDB-OPTION-WALDIR", "description": "This option specifies the directory where the write-ahead log should be stored."}, {"names": ["--wal-segsize= size"], "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": "--wal-segsize= size", "source_url": "/docs/devel/app-initdb.html#APP-INITDB-OPTION-WAL-SEGSIZE", "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": ["-c name = value", "--set name = value"], "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": "-c name = value --set name = value", "source_url": "/docs/devel/app-initdb.html#APP-INITDB-OPTION-SET", "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": ["-d", "--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": "-d --debug", "source_url": "/docs/devel/app-initdb.html#APP-INITDB-OPTION-DEBUG", "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": ["--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": "--discard-caches", "source_url": "/docs/devel/app-initdb.html#APP-INITDB-OPTION-DISCARD-CACHES", "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": ["-L directory"], "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": "-L directory", "source_url": "/docs/devel/app-initdb.html#APP-INITDB-OPTION-L", "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": ["-n", "--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": "-n --no-clean", "source_url": "/docs/devel/app-initdb.html#APP-INITDB-OPTION-NO-CLEAN", "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-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": "-N --no-sync", "source_url": "/docs/devel/app-initdb.html#APP-INITDB-OPTION-NO-SYNC", "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": ["--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": "--no-sync-data-files", "source_url": "/docs/devel/app-initdb.html#APP-INITDB-OPTION-NO-SYNC-DATA-FILES", "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-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": "--no-instructions", "source_url": "/docs/devel/app-initdb.html#APP-INITDB-OPTION-NO-INSTRUCTIONS", "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": ["-s", "--show"], "summary": "Show internal settings and exit, without doing anything else. This can be used to debug the initdb installation.", "signature": "-s --show", "source_url": "/docs/devel/app-initdb.html#APP-INITDB-OPTION-SHOW", "description": "Show internal settings and exit, without doing anything else. This can be used to debug the initdb installation."}, {"names": ["--sync-method= 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": "--sync-method= method", "source_url": "/docs/devel/app-initdb.html#APP-INITDB-OPTION-SYNC-METHOD", "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": ["-S", "--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": "-S --sync-only", "source_url": "/docs/devel/app-initdb.html#APP-INITDB-OPTION-SYNC-ONLY", "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": ["-V", "--version"], "summary": "Print the initdb version and exit.", "signature": "-V --version", "source_url": "/docs/devel/app-initdb.html#APP-INITDB-OPTION-VERSION", "description": "Print the initdb version and exit."}, {"names": ["-?", "--help"], "summary": "Show help about initdb command line arguments, and exit.", "signature": "-? --help", "source_url": "/docs/devel/app-initdb.html#APP-INITDB-OPTION-HELP", "description": "Show help about initdb command line arguments, and exit."}], "related": [], "release": {"ref": "https://ftp.postgresql.org/pub/snapshot/dev/postgresql-snapshot.tar.bz2", "label": "20devel", "major": "20", "channel": "devel", "manifest": {"pdf": {"A4": {"url": "/files/documentation/pdf/20/postgresql-20-A4.pdf", "bytes": 16030631, "pages": 3052, "sha256": "bd5d82c0ce38fc18f92a0447818a91a193a261776bca1c37564bf9a683e177d0", "built_at": "2026-09-28"}, "US": {"url": "/files/documentation/pdf/20/postgresql-20-US.pdf", "bytes": 15936613, "pages": 3223, "sha256": "d97d9e0db479a02f4234b175f50fcad70c3661619afc8d6df9b9437882e3c299", "built_at": "2026-09-28"}}, "tree": "0", "index": "index.html", "major": "20", "pages": 1156, "release": "20devel", "source_url": "https://ftp.postgresql.org/pub/snapshot/dev/postgresql-snapshot.tar.bz2", "svg_assets": 6, "source_mode": "en SGML built with pinned official archive", "source_sha256": "4d3346909b201ac1648232cf290462a7070c119326f56196f1f0253ed80fae41", "source_snapshot_utc": "26-Sep-2026 20:22"}, "revision": "2eba5e0fd4c3bffb2803247b6cd537878e9d6ee5a6dfbe3c50ece8b421b80918", "evidence_kind": "English manual and source declarations", "source_sha256": "4d3346909b201ac1648232cf290462a7070c119326f56196f1f0253ed80fae41"}, "sources": [{"url": "/docs/devel/app-initdb.html", "file": "app-initdb.html", "label": "20devel English manual \u00b7 app-initdb.html", "anchor": "", "sha256": "e39625982073c131744b648fc6ef08403a5996296ef4fdb87b091676f4a8a5b6"}, {"url": "/docs/devel/reference-server.html", "file": "reference-server.html", "label": "Server applications inventory", "anchor": "", "sha256": "5532c1ebfb8c6f310301be63a28daf0ae212e2a78025bea61a1bdca99e02c43d"}], "sections": [], "synopsis": ["initdb [ option ...] [ --pgdata | -D ] datadir"], "signature": "initdb [ option ...] [ --pgdata | -D ] datadir", "description": ["initdb \u2014 create a new PostgreSQL database cluster"], "environment": [{"name": "PGDATA", "description": "Specifies the directory where the database cluster is to be stored; can be overridden using the -D option."}, {"name": "PG_COLOR", "description": "Specifies whether to use color in diagnostic messages. Possible values are always , auto and never ."}, {"name": "TZ", "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 )."}], "manual_html": "<div><div class=\"refentry\" id=\"APP-INITDB\">\n<div class=\"titlepage\"></div>\n<div class=\"refnamediv\">\n<h2><span class=\"refentrytitle\"><span class=\"application\">initdb</span></span></h2>\n<p>initdb \u2014 create a new <span class=\"productname\">PostgreSQL</span> database cluster</p>\n</div>\n<div class=\"refsynopsisdiv\">\n<h2>Synopsis</h2>\n<div class=\"cmdsynopsis\">\n<p id=\"id-1.9.5.3.4.1\"><code class=\"command\">initdb</code> [<em class=\"replaceable\"><code>option</code></em>...] [ <code class=\"option\">--pgdata</code> | <code class=\"option\">-D</code> ] <em class=\"replaceable\"><code>datadir</code></em></p>\n</div>\n</div>\n<div class=\"refsect1\" id=\"R1-APP-INITDB-1\">\n<h2>Description</h2>\n<p><code class=\"command\">initdb</code> creates a new <span class=\"productname\">PostgreSQL</span> <a class=\"glossterm\" href=\"/docs/devel/glossary.html#GLOSSARY-DB-CLUSTER\"></a><a class=\"glossterm\" href=\"/docs/devel/glossary.html#GLOSSARY-DB-CLUSTER\" title=\"Database cluster\">database cluster</a>.</p>\n<p>Creating a database cluster consists of creating the <a class=\"glossterm\" href=\"/docs/devel/glossary.html#GLOSSARY-DATA-DIRECTORY\"></a><a class=\"glossterm\" href=\"/docs/devel/glossary.html#GLOSSARY-DATA-DIRECTORY\" title=\"Data directory\">directories</a> 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 <code class=\"literal\">postgres</code>, <code class=\"literal\">template1</code>, and <code class=\"literal\">template0</code> databases. The <code class=\"literal\">postgres</code> database is a default database meant for use by users, utilities and third party applications. <code class=\"literal\">template1</code> and <code class=\"literal\">template0</code> are meant as source databases to be copied by later <code class=\"command\">CREATE DATABASE</code> commands. <code class=\"literal\">template0</code> should never be modified, but you can add objects to <code class=\"literal\">template1</code>, which by default will be copied into databases created later. See <a class=\"xref\" href=\"/docs/devel/manage-ag-templatedbs.html\" title=\"22.3.\u00a0Template Databases\">Section\u00a022.3</a> for more details.</p>\n<p>Although <code class=\"command\">initdb</code> 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 <code class=\"command\">chown</code> to assign ownership of that directory to the database user account, then <code class=\"command\">su</code> to become the database user to run <code class=\"command\">initdb</code>.</p>\n<p><code class=\"command\">initdb</code> 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 <code class=\"command\">initdb</code> creates. Since the server cannot be run as root, you must not run <code class=\"command\">initdb</code> as root either. (It will in fact refuse to do so.)</p>\n<p>For security reasons the new cluster created by <code class=\"command\">initdb</code> will only be accessible by the cluster owner by default. The <code class=\"option\">--allow-group-access</code> 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.</p>\n<p><code class=\"command\">initdb</code> initializes the database cluster's default locale and character set encoding. These can also be set separately for each database when it is created. <code class=\"command\">initdb</code> determines those settings for the template databases, which will serve as the default for all other databases.</p>\n<p>By default, <code class=\"command\">initdb</code> uses the locale provider <code class=\"literal\">libc</code> (see <a class=\"xref\" href=\"/docs/devel/locale.html#LOCALE-PROVIDERS\" title=\"23.1.4.\u00a0Locale Providers\">Section\u00a023.1.4</a>). The <code class=\"literal\">libc</code> locale provider takes the locale settings from the environment, and determines the encoding from the locale settings.</p>\n<p>To choose a different locale for the cluster, use the option <code class=\"option\">--locale</code>. There are also individual options <code class=\"option\">--lc-*</code> and <code class=\"option\">--icu-locale</code> (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.</p>\n<p>Alternatively, <code class=\"command\">initdb</code> can use the ICU library to provide locale services by specifying <code class=\"literal\">--locale-provider=icu</code>. The server must be built with ICU support. To choose the specific ICU locale ID to apply, use the option <code class=\"option\">--icu-locale</code>. Note that for implementation reasons and to support legacy code, <code class=\"command\">initdb</code> will still select and initialize libc locale settings when the ICU locale provider is used.</p>\n<p>When <code class=\"command\">initdb</code> 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.</p>\n<p>More details about locale settings can be found in <a class=\"xref\" href=\"/docs/devel/locale.html\" title=\"23.1.\u00a0Locale Support\">Section\u00a023.1</a>.</p>\n<p>To alter the default encoding, use the <code class=\"option\">--encoding</code>. More details can be found in <a class=\"xref\" href=\"/docs/devel/multibyte.html\" title=\"23.3.\u00a0Character Set Support\">Section\u00a023.3</a>.</p>\n</div>\n<div class=\"refsect1\" id=\"id-1.9.5.3.6\">\n<h2>Options</h2>\n<div class=\"variablelist\">\n<dl class=\"variablelist\">\n<dt id=\"APP-INITDB-OPTION-AUTH\"><span class=\"term\"><code class=\"option\">-A <em class=\"replaceable\"><code>authmethod</code></em></code><br></span><span class=\"term\"><code class=\"option\">--auth=<em class=\"replaceable\"><code>authmethod</code></em></code></span> </dt>\n<dd>\n<p>This option specifies the default authentication method for local users used in <code class=\"filename\">pg_hba.conf</code> (<code class=\"literal\">host</code> and <code class=\"literal\">local</code> lines). See <a class=\"xref\" href=\"/docs/devel/auth-pg-hba-conf.html\" title=\"20.1.\u00a0The pg_hba.conf File\">Section\u00a020.1</a> for an overview of valid values.</p>\n<p><code class=\"command\">initdb</code> will prepopulate <code class=\"filename\">pg_hba.conf</code> entries using the specified authentication method for non-replication as well as replication connections.</p>\n<p>Do not use <code class=\"literal\">trust</code> unless you trust all local users on your system. <code class=\"literal\">trust</code> is the default for ease of installation.</p>\n</dd>\n<dt id=\"APP-INITDB-OPTION-AUTH-HOST\"><span class=\"term\"><code class=\"option\">--auth-host=<em class=\"replaceable\"><code>authmethod</code></em></code></span> </dt>\n<dd>\n<p>This option specifies the authentication method for local users via TCP/IP connections used in <code class=\"filename\">pg_hba.conf</code> (<code class=\"literal\">host</code> lines).</p>\n</dd>\n<dt id=\"APP-INITDB-OPTION-AUTH-LOCAL\"><span class=\"term\"><code class=\"option\">--auth-local=<em class=\"replaceable\"><code>authmethod</code></em></code></span> </dt>\n<dd>\n<p>This option specifies the authentication method for local users via Unix-domain socket connections used in <code class=\"filename\">pg_hba.conf</code> (<code class=\"literal\">local</code> lines).</p>\n</dd>\n<dt id=\"APP-INITDB-OPTION-PGDATA\"><span class=\"term\"><code class=\"option\">-D <em class=\"replaceable\"><code>datadir</code></em></code><br></span><span class=\"term\"><code class=\"option\">--pgdata=<em class=\"replaceable\"><code>datadir</code></em></code></span> </dt>\n<dd>\n<p>This option specifies the directory where the database cluster should be stored. This is the only information required by <code class=\"command\">initdb</code>, but you can avoid writing it by setting the <code class=\"envar\">PGDATA</code> environment variable, which can be convenient since the database server (<code class=\"command\">postgres</code>) can find the data directory later by the same variable.</p>\n</dd>\n<dt id=\"APP-INITDB-OPTION-ENCODING\"><span class=\"term\"><code class=\"option\">-E <em class=\"replaceable\"><code>encoding</code></em></code><br></span><span class=\"term\"><code class=\"option\">--encoding=<em class=\"replaceable\"><code>encoding</code></em></code></span> </dt>\n<dd>\n<p>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 <span class=\"productname\">PostgreSQL</span> server are described in <a class=\"xref\" href=\"/docs/devel/multibyte.html#MULTIBYTE-CHARSET-SUPPORTED\" title=\"23.3.1.\u00a0Supported Character Sets\">Section\u00a023.3.1</a>.</p>\n<p>By default, the template database encoding is derived from the locale. If <a class=\"xref\" href=\"/docs/devel/app-initdb.html#APP-INITDB-OPTION-NO-LOCALE\"><code class=\"option\">--no-locale</code></a> is specified (or equivalently, if the locale is <code class=\"literal\">C</code> or <code class=\"literal\">POSIX</code>), then the default is <code class=\"literal\">UTF8</code> for the ICU provider and <code class=\"literal\">SQL_ASCII</code> for the <code class=\"literal\">libc</code> provider.</p>\n</dd>\n<dt id=\"APP-INITDB-ALLOW-GROUP-ACCESS\"><span class=\"term\"><code class=\"option\">-g</code><br></span><span class=\"term\"><code class=\"option\">--allow-group-access</code></span> </dt>\n<dd>\n<p>Allows users in the same group as the cluster owner to read all cluster files created by <code class=\"command\">initdb</code>. This option is ignored on <span class=\"productname\">Windows</span> as it does not support POSIX-style group permissions.</p>\n</dd>\n<dt id=\"APP-INITDB-ICU-LOCALE\"><span class=\"term\"><code class=\"option\">--icu-locale=<em class=\"replaceable\"><code>locale</code></em></code></span> </dt>\n<dd>\n<p>Specifies the ICU locale when the ICU provider is used. Locale support is described in <a class=\"xref\" href=\"/docs/devel/locale.html\" title=\"23.1.\u00a0Locale Support\">Section\u00a023.1</a>.</p>\n</dd>\n<dt id=\"APP-INITDB-ICU-RULES\"><span class=\"term\"><code class=\"option\">--icu-rules=<em class=\"replaceable\"><code>rules</code></em></code></span> </dt>\n<dd>\n<p>Specifies additional collation rules to customize the behavior of the default collation. This is supported for ICU only.</p>\n</dd>\n<dt id=\"APP-INITDB-DATA-CHECKSUMS\"><span class=\"term\"><code class=\"option\">-k</code><br></span><span class=\"term\"><code class=\"option\">--data-checksums</code></span> </dt>\n<dd>\n<p>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 <a class=\"xref\" href=\"/docs/devel/app-initdb.html#APP-INITDB-NO-DATA-CHECKSUMS\"><code class=\"option\">--no-data-checksums</code></a> to disable checksums.</p>\n<p>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 <a class=\"link\" href=\"/docs/devel/monitoring-stats.html#MONITORING-PG-STAT-DATABASE-VIEW\" title=\"27.2.20.\u00a0pg_stat_database\"><code class=\"structname\">pg_stat_database</code></a> view. See <a class=\"xref\" href=\"/docs/devel/checksums.html\" title=\"28.2.\u00a0Data Checksums\">Section\u00a028.2</a> for details.</p>\n</dd>\n<dt id=\"APP-INITDB-OPTION-LOCALE\"><span class=\"term\"><code class=\"option\">--locale=<em class=\"replaceable\"><code>locale</code></em></code></span> </dt>\n<dd>\n<p>Sets the default locale for the database cluster. If this option is not specified, the locale is inherited from the environment that <code class=\"command\">initdb</code> runs in. Locale support is described in <a class=\"xref\" href=\"/docs/devel/locale.html\" title=\"23.1.\u00a0Locale Support\">Section\u00a023.1</a>.</p>\n<p>If <code class=\"option\">--locale-provider</code> is <code class=\"literal\">builtin</code>, <code class=\"option\">--locale</code> or <code class=\"option\">--builtin-locale</code> must be specified and set to <code class=\"literal\">C</code>, <code class=\"literal\">C.UTF-8</code> or <code class=\"literal\">PG_UNICODE_FAST</code>.</p>\n</dd>\n<dt id=\"APP-INITDB-OPTION-LC-COLLATE\"><span class=\"term\"><code class=\"option\">--lc-collate=<em class=\"replaceable\"><code>locale</code></em></code><br></span><span class=\"term\"><code class=\"option\">--lc-ctype=<em class=\"replaceable\"><code>locale</code></em></code><br></span><span class=\"term\"><code class=\"option\">--lc-messages=<em class=\"replaceable\"><code>locale</code></em></code><br></span><span class=\"term\"><code class=\"option\">--lc-monetary=<em class=\"replaceable\"><code>locale</code></em></code><br></span><span class=\"term\"><code class=\"option\">--lc-numeric=<em class=\"replaceable\"><code>locale</code></em></code><br></span><span class=\"term\"><code class=\"option\">--lc-time=<em class=\"replaceable\"><code>locale</code></em></code></span> </dt>\n<dd>\n<p>Like <code class=\"option\">--locale</code>, but only sets the locale in the specified category.</p>\n</dd>\n<dt id=\"APP-INITDB-OPTION-NO-LOCALE\"><span class=\"term\"><code class=\"option\">--no-locale</code></span> </dt>\n<dd>\n<p>Equivalent to <code class=\"option\">--locale=C</code>.</p>\n</dd>\n<dt id=\"APP-INITDB-BUILTIN-LOCALE\"><span class=\"term\"><code class=\"option\">--builtin-locale=<em class=\"replaceable\"><code>locale</code></em></code></span> </dt>\n<dd>\n<p>Specifies the locale name when the builtin provider is used. Locale support is described in <a class=\"xref\" href=\"/docs/devel/locale.html\" title=\"23.1.\u00a0Locale Support\">Section\u00a023.1</a>.</p>\n</dd>\n<dt id=\"APP-INITDB-OPTION-LOCALE-PROVIDER\"><span class=\"term\"><code class=\"option\">--locale-provider={<code class=\"literal\">builtin</code>|<code class=\"literal\">libc</code>|<code class=\"literal\">icu</code>}</code></span> </dt>\n<dd>\n<p>This option sets the locale provider for databases created in the new cluster. It can be overridden in the <code class=\"command\">CREATE DATABASE</code> command when new databases are subsequently created. The default is <code class=\"literal\">libc</code> (see <a class=\"xref\" href=\"/docs/devel/locale.html#LOCALE-PROVIDERS\" title=\"23.1.4.\u00a0Locale Providers\">Section\u00a023.1.4</a>).</p>\n</dd>\n<dt id=\"APP-INITDB-NO-DATA-CHECKSUMS\"><span class=\"term\"><code class=\"option\">--no-data-checksums</code></span> </dt>\n<dd>\n<p>Do not enable data checksums.</p>\n</dd>\n<dt id=\"APP-INITDB-OPTION-PWFILE\"><span class=\"term\"><code class=\"option\">--pwfile=<em class=\"replaceable\"><code>filename</code></em></code></span> </dt>\n<dd>\n<p>Makes <code class=\"command\">initdb</code> read the bootstrap superuser's password from a file. The first line of the file is taken as the password.</p>\n</dd>\n<dt id=\"APP-INITDB-OPTION-TEXT-SEARCH-CONFIG\"><span class=\"term\"><code class=\"option\">-T <em class=\"replaceable\"><code>config</code></em></code><br></span><span class=\"term\"><code class=\"option\">--text-search-config=<em class=\"replaceable\"><code>config</code></em></code></span> </dt>\n<dd>\n<p>Sets the default text search configuration. See <a class=\"xref\" href=\"/docs/devel/runtime-config-client.html#GUC-DEFAULT-TEXT-SEARCH-CONFIG\">default_text_search_config</a> for further information.</p>\n</dd>\n<dt id=\"APP-INITDB-OPTION-USERNAME\"><span class=\"term\"><code class=\"option\">-U <em class=\"replaceable\"><code>username</code></em></code><br></span><span class=\"term\"><code class=\"option\">--username=<em class=\"replaceable\"><code>username</code></em></code></span> </dt>\n<dd>\n<p>Sets the user name of the <a class=\"glossterm\" href=\"/docs/devel/glossary.html#GLOSSARY-BOOTSTRAP-SUPERUSER\"></a><a class=\"glossterm\" href=\"/docs/devel/glossary.html#GLOSSARY-BOOTSTRAP-SUPERUSER\" title=\"Bootstrap superuser\">bootstrap superuser</a>. This defaults to the name of the operating-system user running <code class=\"command\">initdb</code>.</p>\n</dd>\n<dt id=\"APP-INITDB-OPTION-PWPROMPT\"><span class=\"term\"><code class=\"option\">-W</code><br></span><span class=\"term\"><code class=\"option\">--pwprompt</code></span> </dt>\n<dd>\n<p>Makes <code class=\"command\">initdb</code> 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.</p>\n</dd>\n<dt id=\"APP-INITDB-OPTION-WALDIR\"><span class=\"term\"><code class=\"option\">-X <em class=\"replaceable\"><code>directory</code></em></code><br></span><span class=\"term\"><code class=\"option\">--waldir=<em class=\"replaceable\"><code>directory</code></em></code></span> </dt>\n<dd>\n<p>This option specifies the directory where the write-ahead log should be stored.</p>\n</dd>\n<dt id=\"APP-INITDB-OPTION-WAL-SEGSIZE\"><span class=\"term\"><code class=\"option\">--wal-segsize=<em class=\"replaceable\"><code>size</code></em></code></span> </dt>\n<dd>\n<p>Set the <em class=\"firstterm\">WAL segment size</em>, 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.</p>\n<p>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.</p>\n</dd>\n</dl>\n</div>\n<p>Other, less commonly used, options are also available:</p>\n<div class=\"variablelist\">\n<dl class=\"variablelist\">\n<dt id=\"APP-INITDB-OPTION-SET\"><span class=\"term\"><code class=\"option\">-c <em class=\"replaceable\"><code>name</code></em>=<em class=\"replaceable\"><code>value</code></em></code><br></span><span class=\"term\"><code class=\"option\">--set <em class=\"replaceable\"><code>name</code></em>=<em class=\"replaceable\"><code>value</code></em></code></span> </dt>\n<dd>\n<p>Forcibly set the server parameter <em class=\"replaceable\"><code>name</code></em> to <em class=\"replaceable\"><code>value</code></em> during <code class=\"command\">initdb</code>, and also install that setting in the generated <code class=\"filename\">postgresql.conf</code> 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.</p>\n</dd>\n<dt id=\"APP-INITDB-OPTION-DEBUG\"><span class=\"term\"><code class=\"option\">-d</code><br></span><span class=\"term\"><code class=\"option\">--debug</code></span> </dt>\n<dd>\n<p>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 <code class=\"command\">initdb</code> uses to create the catalog tables. This option generates a tremendous amount of extremely boring output.</p>\n</dd>\n<dt id=\"APP-INITDB-OPTION-DISCARD-CACHES\"><span class=\"term\"><code class=\"option\">--discard-caches</code></span> </dt>\n<dd>\n<p>Run the bootstrap backend with the <code class=\"literal\">debug_discard_caches=1</code> option. This takes a very long time and is only of use for deep debugging.</p>\n</dd>\n<dt id=\"APP-INITDB-OPTION-L\"><span class=\"term\"><code class=\"option\">-L <em class=\"replaceable\"><code>directory</code></em></code></span> </dt>\n<dd>\n<p>Specifies where <code class=\"command\">initdb</code> 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.</p>\n</dd>\n<dt id=\"APP-INITDB-OPTION-NO-CLEAN\"><span class=\"term\"><code class=\"option\">-n</code><br></span><span class=\"term\"><code class=\"option\">--no-clean</code></span> </dt>\n<dd>\n<p>By default, when <code class=\"command\">initdb</code> 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.</p>\n</dd>\n<dt id=\"APP-INITDB-OPTION-NO-SYNC\"><span class=\"term\"><code class=\"option\">-N</code><br></span><span class=\"term\"><code class=\"option\">--no-sync</code></span> </dt>\n<dd>\n<p>By default, <code class=\"command\">initdb</code> will wait for all files to be written safely to disk. This option causes <code class=\"command\">initdb</code> 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.</p>\n</dd>\n<dt id=\"APP-INITDB-OPTION-NO-SYNC-DATA-FILES\"><span class=\"term\"><code class=\"option\">--no-sync-data-files</code></span> </dt>\n<dd>\n<p>By default, <code class=\"command\">initdb</code> safely writes all database files to disk. This option instructs <code class=\"command\">initdb</code> to skip synchronizing all files in the individual database directories, the database directories themselves, and the tablespace directories, i.e., everything in the <code class=\"filename\">base</code> subdirectory and any other tablespace directories. Other files, such as those in <code class=\"literal\">pg_wal</code> and <code class=\"literal\">pg_xact</code>, will still be synchronized unless the <code class=\"option\">--no-sync</code> option is also specified.</p>\n<p>Note that if <code class=\"option\">--no-sync-data-files</code> is used in conjunction with <code class=\"option\">--sync-method=syncfs</code>, some or all of the aforementioned files and directories will be synchronized because <code class=\"literal\">syncfs</code> processes entire file systems.</p>\n<p>This option is primarily intended for internal use by tools that separately ensure the skipped files are synchronized to disk.</p>\n</dd>\n<dt id=\"APP-INITDB-OPTION-NO-INSTRUCTIONS\"><span class=\"term\"><code class=\"option\">--no-instructions</code></span> </dt>\n<dd>\n<p>By default, <code class=\"command\">initdb</code> 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 <code class=\"command\">initdb</code> in platform-specific behavior, where those instructions are likely to be incorrect.</p>\n</dd>\n<dt id=\"APP-INITDB-OPTION-SHOW\"><span class=\"term\"><code class=\"option\">-s</code><br></span><span class=\"term\"><code class=\"option\">--show</code></span> </dt>\n<dd>\n<p>Show internal settings and exit, without doing anything else. This can be used to debug the <span class=\"application\">initdb</span> installation.</p>\n</dd>\n<dt id=\"APP-INITDB-OPTION-SYNC-METHOD\"><span class=\"term\"><code class=\"option\">--sync-method=<em class=\"replaceable\"><code>method</code></em></code></span> </dt>\n<dd>\n<p>When set to <code class=\"literal\">fsync</code>, which is the default, <code class=\"command\">initdb</code> 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.</p>\n<p>On Linux, <code class=\"literal\">syncfs</code> 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 <a class=\"xref\" href=\"/docs/devel/runtime-config-error-handling.html#GUC-RECOVERY-INIT-SYNC-METHOD\">recovery_init_sync_method</a> for information about the caveats to be aware of when using <code class=\"literal\">syncfs</code>.</p>\n<p>This option has no effect when <code class=\"option\">--no-sync</code> is used.</p>\n</dd>\n<dt id=\"APP-INITDB-OPTION-SYNC-ONLY\"><span class=\"term\"><code class=\"option\">-S</code><br></span><span class=\"term\"><code class=\"option\">--sync-only</code></span> </dt>\n<dd>\n<p>Safely write all database files to disk and exit. This does not perform any of the normal <span class=\"application\">initdb</span> operations. Generally, this option is useful for ensuring reliable recovery after changing <a class=\"xref\" href=\"/docs/devel/runtime-config-wal.html#GUC-FSYNC\">fsync</a> from <code class=\"literal\">off</code> to <code class=\"literal\">on</code>.</p>\n</dd>\n</dl>\n</div>\n<p>Other options:</p>\n<div class=\"variablelist\">\n<dl class=\"variablelist\">\n<dt id=\"APP-INITDB-OPTION-VERSION\"><span class=\"term\"><code class=\"option\">-V</code><br></span><span class=\"term\"><code class=\"option\">--version</code></span> </dt>\n<dd>\n<p>Print the <span class=\"application\">initdb</span> version and exit.</p>\n</dd>\n<dt id=\"APP-INITDB-OPTION-HELP\"><span class=\"term\"><code class=\"option\">-?</code><br></span><span class=\"term\"><code class=\"option\">--help</code></span> </dt>\n<dd>\n<p>Show help about <span class=\"application\">initdb</span> command line arguments, and exit.</p>\n</dd>\n</dl>\n</div>\n</div>\n<div class=\"refsect1\" id=\"id-1.9.5.3.7\">\n<h2>Environment</h2>\n<div class=\"variablelist\">\n<dl class=\"variablelist\">\n<dt id=\"APP-INITDB-ENVIRONMENT-PGDATA\"><span class=\"term\"><code class=\"envar\">PGDATA</code></span> </dt>\n<dd>\n<p>Specifies the directory where the database cluster is to be stored; can be overridden using the <code class=\"option\">-D</code> option.</p>\n</dd>\n<dt id=\"APP-INITDB-ENVIRONMENT-PG-COLOR\"><span class=\"term\"><code class=\"envar\">PG_COLOR</code></span> </dt>\n<dd>\n<p>Specifies whether to use color in diagnostic messages. Possible values are <code class=\"literal\">always</code>, <code class=\"literal\">auto</code> and <code class=\"literal\">never</code>.</p>\n</dd>\n<dt id=\"APP-INITDB-ENVIRONMENT-TZ\"><span class=\"term\"><code class=\"envar\">TZ</code></span> </dt>\n<dd>\n<p>Specifies the default time zone of the created database cluster. The value should be a full time zone name (see <a class=\"xref\" href=\"/docs/devel/datatype-datetime.html#DATATYPE-TIMEZONES\" title=\"8.5.3.\u00a0Time Zones\">Section\u00a08.5.3</a>).</p>\n</dd>\n</dl>\n</div>\n</div>\n<div class=\"refsect1\" id=\"id-1.9.5.3.8\">\n<h2>Notes</h2>\n<p><code class=\"command\">initdb</code> can also be invoked via <code class=\"command\">pg_ctl initdb</code>.</p>\n</div>\n<div class=\"refsect1\" id=\"id-1.9.5.3.9\">\n<h2>See Also</h2><span class=\"simplelist\"><a class=\"xref\" href=\"/docs/devel/app-pg-ctl.html\" title=\"pg_ctl\"><span class=\"refentrytitle\"><span class=\"application\">pg_ctl</span></span></a>, <a class=\"xref\" href=\"/docs/devel/app-postgres.html\" title=\"postgres\"><span class=\"refentrytitle\"><span class=\"application\">postgres</span></span></a>, <a class=\"xref\" href=\"/docs/devel/auth-pg-hba-conf.html\" title=\"20.1.\u00a0The pg_hba.conf File\">Section\u00a020.1</a></span>\n</div>\n</div></div>", "manual_path": "app-initdb.html", "comparison_data": {"options": [{"names": ["-A authmethod", "--auth= authmethod"], "signature": "-A authmethod --auth= authmethod", "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": ["--auth-host= authmethod"], "signature": "--auth-host= authmethod", "description": "This option specifies the authentication method for local users via TCP/IP connections used in pg_hba.conf ( host lines)."}, {"names": ["--auth-local= authmethod"], "signature": "--auth-local= authmethod", "description": "This option specifies the authentication method for local users via Unix-domain socket connections used in pg_hba.conf ( local lines)."}, {"names": ["-D datadir", "--pgdata= datadir"], "signature": "-D datadir --pgdata= datadir", "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": ["-E encoding", "--encoding= encoding"], "signature": "-E encoding --encoding= encoding", "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": ["-g", "--allow-group-access"], "signature": "-g --allow-group-access", "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": ["--icu-locale= locale"], "signature": "--icu-locale= locale", "description": "Specifies the ICU locale when the ICU provider is used. Locale support is described in Section 23.1 ."}, {"names": ["--icu-rules= rules"], "signature": "--icu-rules= rules", "description": "Specifies additional collation rules to customize the behavior of the default collation. This is supported for ICU only."}, {"names": ["-k", "--data-checksums"], "signature": "-k --data-checksums", "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": ["--locale= locale"], "signature": "--locale= locale", "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": ["--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": "Like --locale , but only sets the locale in the specified category."}, {"names": ["--no-locale"], "signature": "--no-locale", "description": "Equivalent to --locale=C ."}, {"names": ["--builtin-locale= locale"], "signature": "--builtin-locale= locale", "description": "Specifies the locale name when the builtin provider is used. Locale support is described in Section 23.1 ."}, {"names": ["--locale-provider={ builtin | libc | icu }"], "signature": "--locale-provider={ builtin | libc | icu }", "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": ["--no-data-checksums"], "signature": "--no-data-checksums", "description": "Do not enable data checksums."}, {"names": ["--pwfile= filename"], "signature": "--pwfile= filename", "description": "Makes initdb read the bootstrap superuser's password from a file. The first line of the file is taken as the password."}, {"names": ["-T config", "--text-search-config= config"], "signature": "-T config --text-search-config= config", "description": "Sets the default text search configuration. See default_text_search_config for further information."}, {"names": ["-U username", "--username= username"], "signature": "-U username --username= username", "description": "Sets the user name of the bootstrap superuser . This defaults to the name of the operating-system user running initdb ."}, {"names": ["-W", "--pwprompt"], "signature": "-W --pwprompt", "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": ["-X directory", "--waldir= directory"], "signature": "-X directory --waldir= directory", "description": "This option specifies the directory where the write-ahead log should be stored."}, {"names": ["--wal-segsize= size"], "signature": "--wal-segsize= size", "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": ["-c name = value", "--set name = value"], "signature": "-c name = value --set name = value", "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": ["-d", "--debug"], "signature": "-d --debug", "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": ["--discard-caches"], "signature": "--discard-caches", "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": ["-L directory"], "signature": "-L directory", "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": ["-n", "--no-clean"], "signature": "-n --no-clean", "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-sync"], "signature": "-N --no-sync", "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": ["--no-sync-data-files"], "signature": "--no-sync-data-files", "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-instructions"], "signature": "--no-instructions", "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": ["-s", "--show"], "signature": "-s --show", "description": "Show internal settings and exit, without doing anything else. This can be used to debug the initdb installation."}, {"names": ["--sync-method= method"], "signature": "--sync-method= method", "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": ["-S", "--sync-only"], "signature": "-S --sync-only", "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": ["-V", "--version"], "signature": "-V --version", "description": "Print the initdb version and exit."}, {"names": ["-?", "--help"], "signature": "-? --help", "description": "Show help about initdb command line arguments, and exit."}], "synopsis": ["initdb [ option ...] [ --pgdata | -D ] datadir"], "environment": [{"name": "PGDATA", "description": "Specifies the directory where the database cluster is to be stored; can be overridden using the -D option."}, {"name": "PG_COLOR", "description": "Specifies whether to use color in diagnostic messages. Possible values are always , auto and never ."}, {"name": "TZ", "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 )."}]}, "comparison_hash": "3cf749b075e58e1590879efbcd64138d328a60046d79748365cf90a80781fbdd"}}}, "snapshot": {"facts": [{"label": "Documented executable", "value": "initdb"}, {"label": "Executable version", "value": "18.6"}, {"label": "Reference inventory", "value": "Server applications"}, {"label": "Option definition groups", "value": "34"}], "tables": [{"key": "options", "rows": [{"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": {"url": "/docs/18/app-initdb.html#APP-INITDB-OPTION-AUTH", "text": "-A authmethod --auth= authmethod"}}, {"summary": "This option specifies the authentication method for local users via TCP/IP connections used in pg_hba.conf ( host lines).", "signature": {"url": "/docs/18/app-initdb.html#APP-INITDB-OPTION-AUTH-HOST", "text": "--auth-host= authmethod"}}, {"summary": "This option specifies the authentication method for local users via Unix-domain socket connections used in pg_hba.conf ( local lines).", "signature": {"url": "/docs/18/app-initdb.html#APP-INITDB-OPTION-AUTH-LOCAL", "text": "--auth-local= authmethod"}}, {"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": {"url": "/docs/18/app-initdb.html#APP-INITDB-OPTION-PGDATA", "text": "-D directory --pgdata= directory"}}, {"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": {"url": "/docs/18/app-initdb.html#APP-INITDB-OPTION-ENCODING", "text": "-E encoding --encoding= encoding"}}, {"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": {"url": "/docs/18/app-initdb.html#APP-INITDB-ALLOW-GROUP-ACCESS", "text": "-g --allow-group-access"}}, {"summary": "Specifies the ICU locale when the ICU provider is used. Locale support is described in Section 23.1 .", "signature": {"url": "/docs/18/app-initdb.html#APP-INITDB-ICU-LOCALE", "text": "--icu-locale= locale"}}, {"summary": "Specifies additional collation rules to customize the behavior of the default collation. This is supported for ICU only.", "signature": {"url": "/docs/18/app-initdb.html#APP-INITDB-ICU-RULES", "text": "--icu-rules= rules"}}, {"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": {"url": "/docs/18/app-initdb.html#APP-INITDB-DATA-CHECKSUMS", "text": "-k --data-checksums"}}, {"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": {"url": "/docs/18/app-initdb.html#APP-INITDB-OPTION-LOCALE", "text": "--locale= locale"}}, {"summary": "Like --locale , but only sets the locale in the specified category.", "signature": {"url": "/docs/18/app-initdb.html#APP-INITDB-OPTION-LC-COLLATE", "text": "--lc-collate= locale --lc-ctype= locale --lc-messages= locale --lc-monetary= locale --lc-numeric= locale --lc-time= locale"}}, {"summary": "Equivalent to --locale=C .", "signature": {"url": "/docs/18/app-initdb.html#APP-INITDB-OPTION-NO-LOCALE", "text": "--no-locale"}}, {"summary": "Specifies the locale name when the builtin provider is used. Locale support is described in Section 23.1 .", "signature": {"url": "/docs/18/app-initdb.html#APP-INITDB-BUILTIN-LOCALE", "text": "--builtin-locale= locale"}}, {"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": {"url": "/docs/18/app-initdb.html#APP-INITDB-OPTION-LOCALE-PROVIDER", "text": "--locale-provider={ builtin | libc | icu }"}}, {"summary": "Do not enable data checksums.", "signature": {"url": "/docs/18/app-initdb.html#APP-INITDB-NO-DATA-CHECKSUMS", "text": "--no-data-checksums"}}, {"summary": "Makes initdb read the bootstrap superuser's password from a file. The first line of the file is taken as the password.", "signature": {"url": "/docs/18/app-initdb.html#APP-INITDB-OPTION-PWFILE", "text": "--pwfile= filename"}}, {"summary": "Sets the default text search configuration. See default_text_search_config for further information.", "signature": {"url": "/docs/18/app-initdb.html#APP-INITDB-OPTION-TEXT-SEARCH-CONFIG", "text": "-T config --text-search-config= config"}}, {"summary": "Sets the user name of the bootstrap superuser . This defaults to the name of the operating-system user running initdb .", "signature": {"url": "/docs/18/app-initdb.html#APP-INITDB-OPTION-USERNAME", "text": "-U username --username= username"}}, {"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": {"url": "/docs/18/app-initdb.html#APP-INITDB-OPTION-PWPROMPT", "text": "-W --pwprompt"}}, {"summary": "This option specifies the directory where the write-ahead log should be stored.", "signature": {"url": "/docs/18/app-initdb.html#APP-INITDB-OPTION-WALDIR", "text": "-X directory --waldir= directory"}}, {"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": {"url": "/docs/18/app-initdb.html#APP-INITDB-OPTION-WAL-SEGSIZE", "text": "--wal-segsize= size"}}, {"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": {"url": "/docs/18/app-initdb.html#APP-INITDB-OPTION-SET", "text": "-c name = value --set name = value"}}, {"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": {"url": "/docs/18/app-initdb.html#APP-INITDB-OPTION-DEBUG", "text": "-d --debug"}}, {"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": {"url": "/docs/18/app-initdb.html#APP-INITDB-OPTION-DISCARD-CACHES", "text": "--discard-caches"}}, {"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": {"url": "/docs/18/app-initdb.html#APP-INITDB-OPTION-L", "text": "-L directory"}}, {"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": {"url": "/docs/18/app-initdb.html#APP-INITDB-OPTION-NO-CLEAN", "text": "-n --no-clean"}}, {"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": {"url": "/docs/18/app-initdb.html#APP-INITDB-OPTION-NO-SYNC", "text": "-N --no-sync"}}, {"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": {"url": "/docs/18/app-initdb.html#APP-INITDB-OPTION-NO-SYNC-DATA-FILES", "text": "--no-sync-data-files"}}, {"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": {"url": "/docs/18/app-initdb.html#APP-INITDB-OPTION-NO-INSTRUCTIONS", "text": "--no-instructions"}}, {"summary": "Show internal settings and exit, without doing anything else. This can be used to debug the initdb installation.", "signature": {"url": "/docs/18/app-initdb.html#APP-INITDB-OPTION-SHOW", "text": "-s --show"}}, {"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": {"url": "/docs/18/app-initdb.html#APP-INITDB-OPTION-SYNC-METHOD", "text": "--sync-method= method"}}, {"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": {"url": "/docs/18/app-initdb.html#APP-INITDB-OPTION-SYNC-ONLY", "text": "-S --sync-only"}}, {"summary": "Print the initdb version and exit.", "signature": {"url": "/docs/18/app-initdb.html#APP-INITDB-OPTION-VERSION", "text": "-V --version"}}, {"summary": "Show help about initdb command line arguments, and exit.", "signature": {"url": "/docs/18/app-initdb.html#APP-INITDB-OPTION-HELP", "text": "-? --help"}}], "title": "Documented options", "columns": [{"key": "signature", "label": "Option and arguments"}, {"key": "summary", "label": "Description"}]}, {"key": "environment", "rows": [{"name": "PGDATA", "description": "Specifies the directory where the database cluster is to be stored; can be overridden using the -D option."}, {"name": "PG_COLOR", "description": "Specifies whether to use color in diagnostic messages. Possible values are always , auto and never ."}, {"name": "TZ", "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 )."}], "title": "Environment variables", "columns": [{"key": "name", "label": "Variable"}, {"key": "description", "label": "Meaning"}]}], "options": [{"names": ["-A authmethod", "--auth= authmethod"], "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": "-A authmethod --auth= authmethod", "source_url": "/docs/18/app-initdb.html#APP-INITDB-OPTION-AUTH", "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": ["--auth-host= authmethod"], "summary": "This option specifies the authentication method for local users via TCP/IP connections used in pg_hba.conf ( host lines).", "signature": "--auth-host= authmethod", "source_url": "/docs/18/app-initdb.html#APP-INITDB-OPTION-AUTH-HOST", "description": "This option specifies the authentication method for local users via TCP/IP connections used in pg_hba.conf ( host lines)."}, {"names": ["--auth-local= authmethod"], "summary": "This option specifies the authentication method for local users via Unix-domain socket connections used in pg_hba.conf ( local lines).", "signature": "--auth-local= authmethod", "source_url": "/docs/18/app-initdb.html#APP-INITDB-OPTION-AUTH-LOCAL", "description": "This option specifies the authentication method for local users via Unix-domain socket connections used in pg_hba.conf ( local lines)."}, {"names": ["-D directory", "--pgdata= directory"], "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": "-D directory --pgdata= directory", "source_url": "/docs/18/app-initdb.html#APP-INITDB-OPTION-PGDATA", "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": ["-E encoding", "--encoding= 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": "-E encoding --encoding= encoding", "source_url": "/docs/18/app-initdb.html#APP-INITDB-OPTION-ENCODING", "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": ["-g", "--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": "-g --allow-group-access", "source_url": "/docs/18/app-initdb.html#APP-INITDB-ALLOW-GROUP-ACCESS", "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": ["--icu-locale= locale"], "summary": "Specifies the ICU locale when the ICU provider is used. Locale support is described in Section 23.1 .", "signature": "--icu-locale= locale", "source_url": "/docs/18/app-initdb.html#APP-INITDB-ICU-LOCALE", "description": "Specifies the ICU locale when the ICU provider is used. Locale support is described in Section 23.1 ."}, {"names": ["--icu-rules= rules"], "summary": "Specifies additional collation rules to customize the behavior of the default collation. This is supported for ICU only.", "signature": "--icu-rules= rules", "source_url": "/docs/18/app-initdb.html#APP-INITDB-ICU-RULES", "description": "Specifies additional collation rules to customize the behavior of the default collation. This is supported for ICU only."}, {"names": ["-k", "--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": "-k --data-checksums", "source_url": "/docs/18/app-initdb.html#APP-INITDB-DATA-CHECKSUMS", "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": ["--locale= 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": "--locale= locale", "source_url": "/docs/18/app-initdb.html#APP-INITDB-OPTION-LOCALE", "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": ["--lc-collate= locale", "--lc-ctype= locale", "--lc-messages= locale", "--lc-monetary= locale", "--lc-numeric= locale", "--lc-time= locale"], "summary": "Like --locale , but only sets the locale in the specified category.", "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", "description": "Like --locale , but only sets the locale in the specified category."}, {"names": ["--no-locale"], "summary": "Equivalent to --locale=C .", "signature": "--no-locale", "source_url": "/docs/18/app-initdb.html#APP-INITDB-OPTION-NO-LOCALE", "description": "Equivalent to --locale=C ."}, {"names": ["--builtin-locale= locale"], "summary": "Specifies the locale name when the builtin provider is used. Locale support is described in Section 23.1 .", "signature": "--builtin-locale= locale", "source_url": "/docs/18/app-initdb.html#APP-INITDB-BUILTIN-LOCALE", "description": "Specifies the locale name when the builtin provider is used. Locale support is described in Section 23.1 ."}, {"names": ["--locale-provider={ builtin | libc | icu }"], "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": "--locale-provider={ builtin | libc | icu }", "source_url": "/docs/18/app-initdb.html#APP-INITDB-OPTION-LOCALE-PROVIDER", "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": ["--no-data-checksums"], "summary": "Do not enable data checksums.", "signature": "--no-data-checksums", "source_url": "/docs/18/app-initdb.html#APP-INITDB-NO-DATA-CHECKSUMS", "description": "Do not enable data checksums."}, {"names": ["--pwfile= filename"], "summary": "Makes initdb read the bootstrap superuser's password from a file. The first line of the file is taken as the password.", "signature": "--pwfile= filename", "source_url": "/docs/18/app-initdb.html#APP-INITDB-OPTION-PWFILE", "description": "Makes initdb read the bootstrap superuser's password from a file. The first line of the file is taken as the password."}, {"names": ["-T config", "--text-search-config= config"], "summary": "Sets the default text search configuration. See default_text_search_config for further information.", "signature": "-T config --text-search-config= config", "source_url": "/docs/18/app-initdb.html#APP-INITDB-OPTION-TEXT-SEARCH-CONFIG", "description": "Sets the default text search configuration. See default_text_search_config for further information."}, {"names": ["-U username", "--username= username"], "summary": "Sets the user name of the bootstrap superuser . This defaults to the name of the operating-system user running initdb .", "signature": "-U username --username= username", "source_url": "/docs/18/app-initdb.html#APP-INITDB-OPTION-USERNAME", "description": "Sets the user name of the bootstrap superuser . This defaults to the name of the operating-system user running initdb ."}, {"names": ["-W", "--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": "-W --pwprompt", "source_url": "/docs/18/app-initdb.html#APP-INITDB-OPTION-PWPROMPT", "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": ["-X directory", "--waldir= directory"], "summary": "This option specifies the directory where the write-ahead log should be stored.", "signature": "-X directory --waldir= directory", "source_url": "/docs/18/app-initdb.html#APP-INITDB-OPTION-WALDIR", "description": "This option specifies the directory where the write-ahead log should be stored."}, {"names": ["--wal-segsize= size"], "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": "--wal-segsize= size", "source_url": "/docs/18/app-initdb.html#APP-INITDB-OPTION-WAL-SEGSIZE", "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": ["-c name = value", "--set name = value"], "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": "-c name = value --set name = value", "source_url": "/docs/18/app-initdb.html#APP-INITDB-OPTION-SET", "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": ["-d", "--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": "-d --debug", "source_url": "/docs/18/app-initdb.html#APP-INITDB-OPTION-DEBUG", "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": ["--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": "--discard-caches", "source_url": "/docs/18/app-initdb.html#APP-INITDB-OPTION-DISCARD-CACHES", "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": ["-L directory"], "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": "-L directory", "source_url": "/docs/18/app-initdb.html#APP-INITDB-OPTION-L", "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": ["-n", "--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": "-n --no-clean", "source_url": "/docs/18/app-initdb.html#APP-INITDB-OPTION-NO-CLEAN", "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-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": "-N --no-sync", "source_url": "/docs/18/app-initdb.html#APP-INITDB-OPTION-NO-SYNC", "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": ["--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": "--no-sync-data-files", "source_url": "/docs/18/app-initdb.html#APP-INITDB-OPTION-NO-SYNC-DATA-FILES", "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-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": "--no-instructions", "source_url": "/docs/18/app-initdb.html#APP-INITDB-OPTION-NO-INSTRUCTIONS", "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": ["-s", "--show"], "summary": "Show internal settings and exit, without doing anything else. This can be used to debug the initdb installation.", "signature": "-s --show", "source_url": "/docs/18/app-initdb.html#APP-INITDB-OPTION-SHOW", "description": "Show internal settings and exit, without doing anything else. This can be used to debug the initdb installation."}, {"names": ["--sync-method= 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": "--sync-method= method", "source_url": "/docs/18/app-initdb.html#APP-INITDB-OPTION-SYNC-METHOD", "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": ["-S", "--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": "-S --sync-only", "source_url": "/docs/18/app-initdb.html#APP-INITDB-OPTION-SYNC-ONLY", "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": ["-V", "--version"], "summary": "Print the initdb version and exit.", "signature": "-V --version", "source_url": "/docs/18/app-initdb.html#APP-INITDB-OPTION-VERSION", "description": "Print the initdb version and exit."}, {"names": ["-?", "--help"], "summary": "Show help about initdb command line arguments, and exit.", "signature": "-? --help", "source_url": "/docs/18/app-initdb.html#APP-INITDB-OPTION-HELP", "description": "Show help about initdb command line arguments, and exit."}], "related": [], "release": {"ref": "https://ftp.postgresql.org/pub/source/v18.6/postgresql-18.6.tar.bz2", "label": "18.6", "major": "18", "channel": "stable", "manifest": {"pdf": {"A4": {"url": "/files/documentation/pdf/18/postgresql-18-A4.pdf", "bytes": 15865106, "pages": 3154, "sha256": "19512c405da53f9f7fcf0abba359223aa65f021be025bf3411381918f92e3190", "built_at": "2026-09-26"}, "US": {"url": "/files/documentation/pdf/18/postgresql-18-US.pdf", "bytes": 15748059, "pages": 3328, "sha256": "facbe6c229e598b872d3d98bef53308f46e06746006fa4590de9a7de9dd46319", "built_at": "2026-09-26"}}, "tree": "18", "index": "index.html", "major": "18", "pages": 1148, "release": "18.6", "source_url": "https://ftp.postgresql.org/pub/source/v18.6/postgresql-18.6.tar.bz2", "svg_assets": 3, "source_mode": "en SGML built with pinned official archive", "source_sha256": "555610c24d53e4316da5b7d3fc25c279d96856d5e0e23ee308c328c5fa881d9f"}, "revision": "ee8d1a3612338fd9adf250730cb640fcc5233b5491337cc00a316a44e3a0b9f8", "evidence_kind": "English manual and source declarations", "source_sha256": "555610c24d53e4316da5b7d3fc25c279d96856d5e0e23ee308c328c5fa881d9f"}, "sources": [{"url": "/docs/18/app-initdb.html", "file": "app-initdb.html", "label": "18.6 English manual \u00b7 app-initdb.html", "anchor": "", "sha256": "ca8245d2c61740de3b11df2b81993b18e311705e2c23bebfa7cafda1bcd15321"}, {"url": "/docs/18/reference-server.html", "file": "reference-server.html", "label": "Server applications inventory", "anchor": "", "sha256": "e9f8bbcc8e3641fadd1d20991e8aad6b532155b786ba5a1b7b364ec4f1a5bef3"}], "sections": [], "synopsis": ["initdb [ option ...] [ --pgdata | -D ] directory"], "signature": "initdb [ option ...] [ --pgdata | -D ] directory", "description": ["initdb \u2014 create a new PostgreSQL database cluster"], "environment": [{"name": "PGDATA", "description": "Specifies the directory where the database cluster is to be stored; can be overridden using the -D option."}, {"name": "PG_COLOR", "description": "Specifies whether to use color in diagnostic messages. Possible values are always , auto and never ."}, {"name": "TZ", "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 )."}], "manual_html": "<div><div class=\"refentry\" id=\"APP-INITDB\">\n<div class=\"titlepage\"></div>\n<div class=\"refnamediv\">\n<h2><span class=\"refentrytitle\"><span class=\"application\">initdb</span></span></h2>\n<p>initdb \u2014 create a new <span class=\"productname\">PostgreSQL</span> database cluster</p>\n</div>\n<div class=\"refsynopsisdiv\">\n<h2>Synopsis</h2>\n<div class=\"cmdsynopsis\">\n<p id=\"id-1.9.5.3.4.1\"><code class=\"command\">initdb</code> [<em class=\"replaceable\"><code>option</code></em>...] [ <code class=\"option\">--pgdata</code> | <code class=\"option\">-D</code> ] <em class=\"replaceable\"><code>directory</code></em></p>\n</div>\n</div>\n<div class=\"refsect1\" id=\"R1-APP-INITDB-1\">\n<h2>Description</h2>\n<p><code class=\"command\">initdb</code> creates a new <span class=\"productname\">PostgreSQL</span> <a class=\"glossterm\" href=\"/docs/18/glossary.html#GLOSSARY-DB-CLUSTER\"></a><a class=\"glossterm\" href=\"/docs/18/glossary.html#GLOSSARY-DB-CLUSTER\" title=\"Database cluster\">database cluster</a>.</p>\n<p>Creating a database cluster consists of creating the <a class=\"glossterm\" href=\"/docs/18/glossary.html#GLOSSARY-DATA-DIRECTORY\"></a><a class=\"glossterm\" href=\"/docs/18/glossary.html#GLOSSARY-DATA-DIRECTORY\" title=\"Data directory\">directories</a> 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 <code class=\"literal\">postgres</code>, <code class=\"literal\">template1</code>, and <code class=\"literal\">template0</code> databases. The <code class=\"literal\">postgres</code> database is a default database meant for use by users, utilities and third party applications. <code class=\"literal\">template1</code> and <code class=\"literal\">template0</code> are meant as source databases to be copied by later <code class=\"command\">CREATE DATABASE</code> commands. <code class=\"literal\">template0</code> should never be modified, but you can add objects to <code class=\"literal\">template1</code>, which by default will be copied into databases created later. See <a class=\"xref\" href=\"/docs/18/manage-ag-templatedbs.html\" title=\"22.3.\u00a0Template Databases\">Section\u00a022.3</a> for more details.</p>\n<p>Although <code class=\"command\">initdb</code> 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 <code class=\"command\">chown</code> to assign ownership of that directory to the database user account, then <code class=\"command\">su</code> to become the database user to run <code class=\"command\">initdb</code>.</p>\n<p><code class=\"command\">initdb</code> 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 <code class=\"command\">initdb</code> creates. Since the server cannot be run as root, you must not run <code class=\"command\">initdb</code> as root either. (It will in fact refuse to do so.)</p>\n<p>For security reasons the new cluster created by <code class=\"command\">initdb</code> will only be accessible by the cluster owner by default. The <code class=\"option\">--allow-group-access</code> 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.</p>\n<p><code class=\"command\">initdb</code> initializes the database cluster's default locale and character set encoding. These can also be set separately for each database when it is created. <code class=\"command\">initdb</code> determines those settings for the template databases, which will serve as the default for all other databases.</p>\n<p>By default, <code class=\"command\">initdb</code> uses the locale provider <code class=\"literal\">libc</code> (see <a class=\"xref\" href=\"/docs/18/locale.html#LOCALE-PROVIDERS\" title=\"23.1.4.\u00a0Locale Providers\">Section\u00a023.1.4</a>). The <code class=\"literal\">libc</code> locale provider takes the locale settings from the environment, and determines the encoding from the locale settings.</p>\n<p>To choose a different locale for the cluster, use the option <code class=\"option\">--locale</code>. There are also individual options <code class=\"option\">--lc-*</code> and <code class=\"option\">--icu-locale</code> (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.</p>\n<p>Alternatively, <code class=\"command\">initdb</code> can use the ICU library to provide locale services by specifying <code class=\"literal\">--locale-provider=icu</code>. The server must be built with ICU support. To choose the specific ICU locale ID to apply, use the option <code class=\"option\">--icu-locale</code>. Note that for implementation reasons and to support legacy code, <code class=\"command\">initdb</code> will still select and initialize libc locale settings when the ICU locale provider is used.</p>\n<p>When <code class=\"command\">initdb</code> 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.</p>\n<p>More details about locale settings can be found in <a class=\"xref\" href=\"/docs/18/locale.html\" title=\"23.1.\u00a0Locale Support\">Section\u00a023.1</a>.</p>\n<p>To alter the default encoding, use the <code class=\"option\">--encoding</code>. More details can be found in <a class=\"xref\" href=\"/docs/18/multibyte.html\" title=\"23.3.\u00a0Character Set Support\">Section\u00a023.3</a>.</p>\n</div>\n<div class=\"refsect1\" id=\"id-1.9.5.3.6\">\n<h2>Options</h2>\n<div class=\"variablelist\">\n<dl class=\"variablelist\">\n<dt id=\"APP-INITDB-OPTION-AUTH\"><span class=\"term\"><code class=\"option\">-A <em class=\"replaceable\"><code>authmethod</code></em></code><br></span><span class=\"term\"><code class=\"option\">--auth=<em class=\"replaceable\"><code>authmethod</code></em></code></span> </dt>\n<dd>\n<p>This option specifies the default authentication method for local users used in <code class=\"filename\">pg_hba.conf</code> (<code class=\"literal\">host</code> and <code class=\"literal\">local</code> lines). See <a class=\"xref\" href=\"/docs/18/auth-pg-hba-conf.html\" title=\"20.1.\u00a0The pg_hba.conf File\">Section\u00a020.1</a> for an overview of valid values.</p>\n<p><code class=\"command\">initdb</code> will prepopulate <code class=\"filename\">pg_hba.conf</code> entries using the specified authentication method for non-replication as well as replication connections.</p>\n<p>Do not use <code class=\"literal\">trust</code> unless you trust all local users on your system. <code class=\"literal\">trust</code> is the default for ease of installation.</p>\n</dd>\n<dt id=\"APP-INITDB-OPTION-AUTH-HOST\"><span class=\"term\"><code class=\"option\">--auth-host=<em class=\"replaceable\"><code>authmethod</code></em></code></span> </dt>\n<dd>\n<p>This option specifies the authentication method for local users via TCP/IP connections used in <code class=\"filename\">pg_hba.conf</code> (<code class=\"literal\">host</code> lines).</p>\n</dd>\n<dt id=\"APP-INITDB-OPTION-AUTH-LOCAL\"><span class=\"term\"><code class=\"option\">--auth-local=<em class=\"replaceable\"><code>authmethod</code></em></code></span> </dt>\n<dd>\n<p>This option specifies the authentication method for local users via Unix-domain socket connections used in <code class=\"filename\">pg_hba.conf</code> (<code class=\"literal\">local</code> lines).</p>\n</dd>\n<dt id=\"APP-INITDB-OPTION-PGDATA\"><span class=\"term\"><code class=\"option\">-D <em class=\"replaceable\"><code>directory</code></em></code><br></span><span class=\"term\"><code class=\"option\">--pgdata=<em class=\"replaceable\"><code>directory</code></em></code></span> </dt>\n<dd>\n<p>This option specifies the directory where the database cluster should be stored. This is the only information required by <code class=\"command\">initdb</code>, but you can avoid writing it by setting the <code class=\"envar\">PGDATA</code> environment variable, which can be convenient since the database server (<code class=\"command\">postgres</code>) can find the data directory later by the same variable.</p>\n</dd>\n<dt id=\"APP-INITDB-OPTION-ENCODING\"><span class=\"term\"><code class=\"option\">-E <em class=\"replaceable\"><code>encoding</code></em></code><br></span><span class=\"term\"><code class=\"option\">--encoding=<em class=\"replaceable\"><code>encoding</code></em></code></span> </dt>\n<dd>\n<p>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 <span class=\"productname\">PostgreSQL</span> server are described in <a class=\"xref\" href=\"/docs/18/multibyte.html#MULTIBYTE-CHARSET-SUPPORTED\" title=\"23.3.1.\u00a0Supported Character Sets\">Section\u00a023.3.1</a>.</p>\n<p>By default, the template database encoding is derived from the locale. If <a class=\"xref\" href=\"/docs/18/app-initdb.html#APP-INITDB-OPTION-NO-LOCALE\"><code class=\"option\">--no-locale</code></a> is specified (or equivalently, if the locale is <code class=\"literal\">C</code> or <code class=\"literal\">POSIX</code>), then the default is <code class=\"literal\">UTF8</code> for the ICU provider and <code class=\"literal\">SQL_ASCII</code> for the <code class=\"literal\">libc</code> provider.</p>\n</dd>\n<dt id=\"APP-INITDB-ALLOW-GROUP-ACCESS\"><span class=\"term\"><code class=\"option\">-g</code><br></span><span class=\"term\"><code class=\"option\">--allow-group-access</code></span> </dt>\n<dd>\n<p>Allows users in the same group as the cluster owner to read all cluster files created by <code class=\"command\">initdb</code>. This option is ignored on <span class=\"productname\">Windows</span> as it does not support POSIX-style group permissions.</p>\n</dd>\n<dt id=\"APP-INITDB-ICU-LOCALE\"><span class=\"term\"><code class=\"option\">--icu-locale=<em class=\"replaceable\"><code>locale</code></em></code></span> </dt>\n<dd>\n<p>Specifies the ICU locale when the ICU provider is used. Locale support is described in <a class=\"xref\" href=\"/docs/18/locale.html\" title=\"23.1.\u00a0Locale Support\">Section\u00a023.1</a>.</p>\n</dd>\n<dt id=\"APP-INITDB-ICU-RULES\"><span class=\"term\"><code class=\"option\">--icu-rules=<em class=\"replaceable\"><code>rules</code></em></code></span> </dt>\n<dd>\n<p>Specifies additional collation rules to customize the behavior of the default collation. This is supported for ICU only.</p>\n</dd>\n<dt id=\"APP-INITDB-DATA-CHECKSUMS\"><span class=\"term\"><code class=\"option\">-k</code><br></span><span class=\"term\"><code class=\"option\">--data-checksums</code></span> </dt>\n<dd>\n<p>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 <a class=\"xref\" href=\"/docs/18/app-initdb.html#APP-INITDB-NO-DATA-CHECKSUMS\"><code class=\"option\">--no-data-checksums</code></a> to disable checksums.</p>\n<p>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 <a class=\"link\" href=\"/docs/18/monitoring-stats.html#MONITORING-PG-STAT-DATABASE-VIEW\" title=\"27.2.17.\u00a0pg_stat_database\"><code class=\"structname\">pg_stat_database</code></a> view. See <a class=\"xref\" href=\"/docs/18/checksums.html\" title=\"28.2.\u00a0Data Checksums\">Section\u00a028.2</a> for details.</p>\n</dd>\n<dt id=\"APP-INITDB-OPTION-LOCALE\"><span class=\"term\"><code class=\"option\">--locale=<em class=\"replaceable\"><code>locale</code></em></code></span> </dt>\n<dd>\n<p>Sets the default locale for the database cluster. If this option is not specified, the locale is inherited from the environment that <code class=\"command\">initdb</code> runs in. Locale support is described in <a class=\"xref\" href=\"/docs/18/locale.html\" title=\"23.1.\u00a0Locale Support\">Section\u00a023.1</a>.</p>\n<p>If <code class=\"option\">--locale-provider</code> is <code class=\"literal\">builtin</code>, <code class=\"option\">--locale</code> or <code class=\"option\">--builtin-locale</code> must be specified and set to <code class=\"literal\">C</code>, <code class=\"literal\">C.UTF-8</code> or <code class=\"literal\">PG_UNICODE_FAST</code>.</p>\n</dd>\n<dt id=\"APP-INITDB-OPTION-LC-COLLATE\"><span class=\"term\"><code class=\"option\">--lc-collate=<em class=\"replaceable\"><code>locale</code></em></code><br></span><span class=\"term\"><code class=\"option\">--lc-ctype=<em class=\"replaceable\"><code>locale</code></em></code><br></span><span class=\"term\"><code class=\"option\">--lc-messages=<em class=\"replaceable\"><code>locale</code></em></code><br></span><span class=\"term\"><code class=\"option\">--lc-monetary=<em class=\"replaceable\"><code>locale</code></em></code><br></span><span class=\"term\"><code class=\"option\">--lc-numeric=<em class=\"replaceable\"><code>locale</code></em></code><br></span><span class=\"term\"><code class=\"option\">--lc-time=<em class=\"replaceable\"><code>locale</code></em></code></span> </dt>\n<dd>\n<p>Like <code class=\"option\">--locale</code>, but only sets the locale in the specified category.</p>\n</dd>\n<dt id=\"APP-INITDB-OPTION-NO-LOCALE\"><span class=\"term\"><code class=\"option\">--no-locale</code></span> </dt>\n<dd>\n<p>Equivalent to <code class=\"option\">--locale=C</code>.</p>\n</dd>\n<dt id=\"APP-INITDB-BUILTIN-LOCALE\"><span class=\"term\"><code class=\"option\">--builtin-locale=<em class=\"replaceable\"><code>locale</code></em></code></span> </dt>\n<dd>\n<p>Specifies the locale name when the builtin provider is used. Locale support is described in <a class=\"xref\" href=\"/docs/18/locale.html\" title=\"23.1.\u00a0Locale Support\">Section\u00a023.1</a>.</p>\n</dd>\n<dt id=\"APP-INITDB-OPTION-LOCALE-PROVIDER\"><span class=\"term\"><code class=\"option\">--locale-provider={<code class=\"literal\">builtin</code>|<code class=\"literal\">libc</code>|<code class=\"literal\">icu</code>}</code></span> </dt>\n<dd>\n<p>This option sets the locale provider for databases created in the new cluster. It can be overridden in the <code class=\"command\">CREATE DATABASE</code> command when new databases are subsequently created. The default is <code class=\"literal\">libc</code> (see <a class=\"xref\" href=\"/docs/18/locale.html#LOCALE-PROVIDERS\" title=\"23.1.4.\u00a0Locale Providers\">Section\u00a023.1.4</a>).</p>\n</dd>\n<dt id=\"APP-INITDB-NO-DATA-CHECKSUMS\"><span class=\"term\"><code class=\"option\">--no-data-checksums</code></span> </dt>\n<dd>\n<p>Do not enable data checksums.</p>\n</dd>\n<dt id=\"APP-INITDB-OPTION-PWFILE\"><span class=\"term\"><code class=\"option\">--pwfile=<em class=\"replaceable\"><code>filename</code></em></code></span> </dt>\n<dd>\n<p>Makes <code class=\"command\">initdb</code> read the bootstrap superuser's password from a file. The first line of the file is taken as the password.</p>\n</dd>\n<dt id=\"APP-INITDB-OPTION-TEXT-SEARCH-CONFIG\"><span class=\"term\"><code class=\"option\">-T <em class=\"replaceable\"><code>config</code></em></code><br></span><span class=\"term\"><code class=\"option\">--text-search-config=<em class=\"replaceable\"><code>config</code></em></code></span> </dt>\n<dd>\n<p>Sets the default text search configuration. See <a class=\"xref\" href=\"/docs/18/runtime-config-client.html#GUC-DEFAULT-TEXT-SEARCH-CONFIG\">default_text_search_config</a> for further information.</p>\n</dd>\n<dt id=\"APP-INITDB-OPTION-USERNAME\"><span class=\"term\"><code class=\"option\">-U <em class=\"replaceable\"><code>username</code></em></code><br></span><span class=\"term\"><code class=\"option\">--username=<em class=\"replaceable\"><code>username</code></em></code></span> </dt>\n<dd>\n<p>Sets the user name of the <a class=\"glossterm\" href=\"/docs/18/glossary.html#GLOSSARY-BOOTSTRAP-SUPERUSER\"></a><a class=\"glossterm\" href=\"/docs/18/glossary.html#GLOSSARY-BOOTSTRAP-SUPERUSER\" title=\"Bootstrap superuser\">bootstrap superuser</a>. This defaults to the name of the operating-system user running <code class=\"command\">initdb</code>.</p>\n</dd>\n<dt id=\"APP-INITDB-OPTION-PWPROMPT\"><span class=\"term\"><code class=\"option\">-W</code><br></span><span class=\"term\"><code class=\"option\">--pwprompt</code></span> </dt>\n<dd>\n<p>Makes <code class=\"command\">initdb</code> 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.</p>\n</dd>\n<dt id=\"APP-INITDB-OPTION-WALDIR\"><span class=\"term\"><code class=\"option\">-X <em class=\"replaceable\"><code>directory</code></em></code><br></span><span class=\"term\"><code class=\"option\">--waldir=<em class=\"replaceable\"><code>directory</code></em></code></span> </dt>\n<dd>\n<p>This option specifies the directory where the write-ahead log should be stored.</p>\n</dd>\n<dt id=\"APP-INITDB-OPTION-WAL-SEGSIZE\"><span class=\"term\"><code class=\"option\">--wal-segsize=<em class=\"replaceable\"><code>size</code></em></code></span> </dt>\n<dd>\n<p>Set the <em class=\"firstterm\">WAL segment size</em>, 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.</p>\n<p>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.</p>\n</dd>\n</dl>\n</div>\n<p>Other, less commonly used, options are also available:</p>\n<div class=\"variablelist\">\n<dl class=\"variablelist\">\n<dt id=\"APP-INITDB-OPTION-SET\"><span class=\"term\"><code class=\"option\">-c <em class=\"replaceable\"><code>name</code></em>=<em class=\"replaceable\"><code>value</code></em></code><br></span><span class=\"term\"><code class=\"option\">--set <em class=\"replaceable\"><code>name</code></em>=<em class=\"replaceable\"><code>value</code></em></code></span> </dt>\n<dd>\n<p>Forcibly set the server parameter <em class=\"replaceable\"><code>name</code></em> to <em class=\"replaceable\"><code>value</code></em> during <code class=\"command\">initdb</code>, and also install that setting in the generated <code class=\"filename\">postgresql.conf</code> 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.</p>\n</dd>\n<dt id=\"APP-INITDB-OPTION-DEBUG\"><span class=\"term\"><code class=\"option\">-d</code><br></span><span class=\"term\"><code class=\"option\">--debug</code></span> </dt>\n<dd>\n<p>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 <code class=\"command\">initdb</code> uses to create the catalog tables. This option generates a tremendous amount of extremely boring output.</p>\n</dd>\n<dt id=\"APP-INITDB-OPTION-DISCARD-CACHES\"><span class=\"term\"><code class=\"option\">--discard-caches</code></span> </dt>\n<dd>\n<p>Run the bootstrap backend with the <code class=\"literal\">debug_discard_caches=1</code> option. This takes a very long time and is only of use for deep debugging.</p>\n</dd>\n<dt id=\"APP-INITDB-OPTION-L\"><span class=\"term\"><code class=\"option\">-L <em class=\"replaceable\"><code>directory</code></em></code></span> </dt>\n<dd>\n<p>Specifies where <code class=\"command\">initdb</code> 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.</p>\n</dd>\n<dt id=\"APP-INITDB-OPTION-NO-CLEAN\"><span class=\"term\"><code class=\"option\">-n</code><br></span><span class=\"term\"><code class=\"option\">--no-clean</code></span> </dt>\n<dd>\n<p>By default, when <code class=\"command\">initdb</code> 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.</p>\n</dd>\n<dt id=\"APP-INITDB-OPTION-NO-SYNC\"><span class=\"term\"><code class=\"option\">-N</code><br></span><span class=\"term\"><code class=\"option\">--no-sync</code></span> </dt>\n<dd>\n<p>By default, <code class=\"command\">initdb</code> will wait for all files to be written safely to disk. This option causes <code class=\"command\">initdb</code> 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.</p>\n</dd>\n<dt id=\"APP-INITDB-OPTION-NO-SYNC-DATA-FILES\"><span class=\"term\"><code class=\"option\">--no-sync-data-files</code></span> </dt>\n<dd>\n<p>By default, <code class=\"command\">initdb</code> safely writes all database files to disk. This option instructs <code class=\"command\">initdb</code> to skip synchronizing all files in the individual database directories, the database directories themselves, and the tablespace directories, i.e., everything in the <code class=\"filename\">base</code> subdirectory and any other tablespace directories. Other files, such as those in <code class=\"literal\">pg_wal</code> and <code class=\"literal\">pg_xact</code>, will still be synchronized unless the <code class=\"option\">--no-sync</code> option is also specified.</p>\n<p>Note that if <code class=\"option\">--no-sync-data-files</code> is used in conjunction with <code class=\"option\">--sync-method=syncfs</code>, some or all of the aforementioned files and directories will be synchronized because <code class=\"literal\">syncfs</code> processes entire file systems.</p>\n<p>This option is primarily intended for internal use by tools that separately ensure the skipped files are synchronized to disk.</p>\n</dd>\n<dt id=\"APP-INITDB-OPTION-NO-INSTRUCTIONS\"><span class=\"term\"><code class=\"option\">--no-instructions</code></span> </dt>\n<dd>\n<p>By default, <code class=\"command\">initdb</code> 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 <code class=\"command\">initdb</code> in platform-specific behavior, where those instructions are likely to be incorrect.</p>\n</dd>\n<dt id=\"APP-INITDB-OPTION-SHOW\"><span class=\"term\"><code class=\"option\">-s</code><br></span><span class=\"term\"><code class=\"option\">--show</code></span> </dt>\n<dd>\n<p>Show internal settings and exit, without doing anything else. This can be used to debug the <span class=\"application\">initdb</span> installation.</p>\n</dd>\n<dt id=\"APP-INITDB-OPTION-SYNC-METHOD\"><span class=\"term\"><code class=\"option\">--sync-method=<em class=\"replaceable\"><code>method</code></em></code></span> </dt>\n<dd>\n<p>When set to <code class=\"literal\">fsync</code>, which is the default, <code class=\"command\">initdb</code> 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.</p>\n<p>On Linux, <code class=\"literal\">syncfs</code> 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 <a class=\"xref\" href=\"/docs/18/runtime-config-error-handling.html#GUC-RECOVERY-INIT-SYNC-METHOD\">recovery_init_sync_method</a> for information about the caveats to be aware of when using <code class=\"literal\">syncfs</code>.</p>\n<p>This option has no effect when <code class=\"option\">--no-sync</code> is used.</p>\n</dd>\n<dt id=\"APP-INITDB-OPTION-SYNC-ONLY\"><span class=\"term\"><code class=\"option\">-S</code><br></span><span class=\"term\"><code class=\"option\">--sync-only</code></span> </dt>\n<dd>\n<p>Safely write all database files to disk and exit. This does not perform any of the normal <span class=\"application\">initdb</span> operations. Generally, this option is useful for ensuring reliable recovery after changing <a class=\"xref\" href=\"/docs/18/runtime-config-wal.html#GUC-FSYNC\">fsync</a> from <code class=\"literal\">off</code> to <code class=\"literal\">on</code>.</p>\n</dd>\n</dl>\n</div>\n<p>Other options:</p>\n<div class=\"variablelist\">\n<dl class=\"variablelist\">\n<dt id=\"APP-INITDB-OPTION-VERSION\"><span class=\"term\"><code class=\"option\">-V</code><br></span><span class=\"term\"><code class=\"option\">--version</code></span> </dt>\n<dd>\n<p>Print the <span class=\"application\">initdb</span> version and exit.</p>\n</dd>\n<dt id=\"APP-INITDB-OPTION-HELP\"><span class=\"term\"><code class=\"option\">-?</code><br></span><span class=\"term\"><code class=\"option\">--help</code></span> </dt>\n<dd>\n<p>Show help about <span class=\"application\">initdb</span> command line arguments, and exit.</p>\n</dd>\n</dl>\n</div>\n</div>\n<div class=\"refsect1\" id=\"id-1.9.5.3.7\">\n<h2>Environment</h2>\n<div class=\"variablelist\">\n<dl class=\"variablelist\">\n<dt id=\"APP-INITDB-ENVIRONMENT-PGDATA\"><span class=\"term\"><code class=\"envar\">PGDATA</code></span> </dt>\n<dd>\n<p>Specifies the directory where the database cluster is to be stored; can be overridden using the <code class=\"option\">-D</code> option.</p>\n</dd>\n<dt id=\"APP-INITDB-ENVIRONMENT-PG-COLOR\"><span class=\"term\"><code class=\"envar\">PG_COLOR</code></span> </dt>\n<dd>\n<p>Specifies whether to use color in diagnostic messages. Possible values are <code class=\"literal\">always</code>, <code class=\"literal\">auto</code> and <code class=\"literal\">never</code>.</p>\n</dd>\n<dt id=\"APP-INITDB-ENVIRONMENT-TZ\"><span class=\"term\"><code class=\"envar\">TZ</code></span> </dt>\n<dd>\n<p>Specifies the default time zone of the created database cluster. The value should be a full time zone name (see <a class=\"xref\" href=\"/docs/18/datatype-datetime.html#DATATYPE-TIMEZONES\" title=\"8.5.3.\u00a0Time Zones\">Section\u00a08.5.3</a>).</p>\n</dd>\n</dl>\n</div>\n</div>\n<div class=\"refsect1\" id=\"id-1.9.5.3.8\">\n<h2>Notes</h2>\n<p><code class=\"command\">initdb</code> can also be invoked via <code class=\"command\">pg_ctl initdb</code>.</p>\n</div>\n<div class=\"refsect1\" id=\"id-1.9.5.3.9\">\n<h2>See Also</h2><span class=\"simplelist\"><a class=\"xref\" href=\"/docs/18/app-pg-ctl.html\" title=\"pg_ctl\"><span class=\"refentrytitle\"><span class=\"application\">pg_ctl</span></span></a>, <a class=\"xref\" href=\"/docs/18/app-postgres.html\" title=\"postgres\"><span class=\"refentrytitle\"><span class=\"application\">postgres</span></span></a>, <a class=\"xref\" href=\"/docs/18/auth-pg-hba-conf.html\" title=\"20.1.\u00a0The pg_hba.conf File\">Section\u00a020.1</a></span>\n</div>\n</div></div>", "manual_path": "app-initdb.html", "comparison_data": {"options": [{"names": ["-A authmethod", "--auth= authmethod"], "signature": "-A authmethod --auth= authmethod", "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": ["--auth-host= authmethod"], "signature": "--auth-host= authmethod", "description": "This option specifies the authentication method for local users via TCP/IP connections used in pg_hba.conf ( host lines)."}, {"names": ["--auth-local= authmethod"], "signature": "--auth-local= authmethod", "description": "This option specifies the authentication method for local users via Unix-domain socket connections used in pg_hba.conf ( local lines)."}, {"names": ["-D directory", "--pgdata= directory"], "signature": "-D directory --pgdata= directory", "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": ["-E encoding", "--encoding= encoding"], "signature": "-E encoding --encoding= encoding", "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": ["-g", "--allow-group-access"], "signature": "-g --allow-group-access", "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": ["--icu-locale= locale"], "signature": "--icu-locale= locale", "description": "Specifies the ICU locale when the ICU provider is used. Locale support is described in Section 23.1 ."}, {"names": ["--icu-rules= rules"], "signature": "--icu-rules= rules", "description": "Specifies additional collation rules to customize the behavior of the default collation. This is supported for ICU only."}, {"names": ["-k", "--data-checksums"], "signature": "-k --data-checksums", "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": ["--locale= locale"], "signature": "--locale= locale", "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": ["--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": "Like --locale , but only sets the locale in the specified category."}, {"names": ["--no-locale"], "signature": "--no-locale", "description": "Equivalent to --locale=C ."}, {"names": ["--builtin-locale= locale"], "signature": "--builtin-locale= locale", "description": "Specifies the locale name when the builtin provider is used. Locale support is described in Section 23.1 ."}, {"names": ["--locale-provider={ builtin | libc | icu }"], "signature": "--locale-provider={ builtin | libc | icu }", "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": ["--no-data-checksums"], "signature": "--no-data-checksums", "description": "Do not enable data checksums."}, {"names": ["--pwfile= filename"], "signature": "--pwfile= filename", "description": "Makes initdb read the bootstrap superuser's password from a file. The first line of the file is taken as the password."}, {"names": ["-T config", "--text-search-config= config"], "signature": "-T config --text-search-config= config", "description": "Sets the default text search configuration. See default_text_search_config for further information."}, {"names": ["-U username", "--username= username"], "signature": "-U username --username= username", "description": "Sets the user name of the bootstrap superuser . This defaults to the name of the operating-system user running initdb ."}, {"names": ["-W", "--pwprompt"], "signature": "-W --pwprompt", "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": ["-X directory", "--waldir= directory"], "signature": "-X directory --waldir= directory", "description": "This option specifies the directory where the write-ahead log should be stored."}, {"names": ["--wal-segsize= size"], "signature": "--wal-segsize= size", "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": ["-c name = value", "--set name = value"], "signature": "-c name = value --set name = value", "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": ["-d", "--debug"], "signature": "-d --debug", "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": ["--discard-caches"], "signature": "--discard-caches", "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": ["-L directory"], "signature": "-L directory", "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": ["-n", "--no-clean"], "signature": "-n --no-clean", "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-sync"], "signature": "-N --no-sync", "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": ["--no-sync-data-files"], "signature": "--no-sync-data-files", "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-instructions"], "signature": "--no-instructions", "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": ["-s", "--show"], "signature": "-s --show", "description": "Show internal settings and exit, without doing anything else. This can be used to debug the initdb installation."}, {"names": ["--sync-method= method"], "signature": "--sync-method= method", "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": ["-S", "--sync-only"], "signature": "-S --sync-only", "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": ["-V", "--version"], "signature": "-V --version", "description": "Print the initdb version and exit."}, {"names": ["-?", "--help"], "signature": "-? --help", "description": "Show help about initdb command line arguments, and exit."}], "synopsis": ["initdb [ option ...] [ --pgdata | -D ] directory"], "environment": [{"name": "PGDATA", "description": "Specifies the directory where the database cluster is to be stored; can be overridden using the -D option."}, {"name": "PG_COLOR", "description": "Specifies whether to use color in diagnostic messages. Possible values are always , auto and never ."}, {"name": "TZ", "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 )."}]}, "comparison_hash": "9d023384fdab35b09900cd14ac90a5dbe44bace6659e36877cd11b68fb2bd76e"}, "comparison": {"left": "16", "right": "17", "status": "changed", "diff": "--- PostgreSQL 16\n+++ PostgreSQL 17\n@@ -15,7 +15,7 @@\n   ],\n   \"options\": [\n     {\n-      \"description\": \"This option specifies the default authentication method for local users used in pg_hba.conf ( host and local lines). See Section 21.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.\",\n+      \"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.\",\n       \"names\": [\n         \"-A authmethod\",\n         \"--auth= authmethod\"\n@@ -45,7 +45,7 @@\n       \"signature\": \"-D directory --pgdata= directory\"\n     },\n     {\n-      \"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 24.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.\",\n+      \"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.\",\n       \"names\": [\n         \"-E encoding\",\n         \"--encoding= encoding\"\n@@ -61,7 +61,7 @@\n       \"signature\": \"-g --allow-group-access\"\n     },\n     {\n-      \"description\": \"Specifies the ICU locale when the ICU provider is used. Locale support is described in Section 24.1 .\",\n+      \"description\": \"Specifies the ICU locale when the ICU provider is used. Locale support is described in Section 23.1 .\",\n       \"names\": [\n         \"--icu-locale= locale\"\n       ],\n@@ -75,7 +75,7 @@\n       \"signature\": \"--icu-rules= rules\"\n     },\n     {\n-      \"description\": \"Use checksums on data pages to help detect corruption by the I/O system that would otherwise be silent. Enabling checksums may incur a noticeable 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 30.2 for details.\",\n+      \"description\": \"Use checksums on data pages to help detect corruption by the I/O system that would otherwise be silent. Enabling checksums may incur a noticeable 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.\",\n       \"names\": [\n         \"-k\",\n         \"--data-checksums\"\n@@ -83,7 +83,7 @@\n       \"signature\": \"-k --data-checksums\"\n     },\n     {\n-      \"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 24.1 .\",\n+      \"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 or C.UTF-8 .\",\n       \"names\": [\n         \"--locale= locale\"\n       ],\n@@ -109,11 +109,102 @@\n       \"signature\": \"--no-locale\"\n     },\n     {\n-      \"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 24.1.4 ).\",\n-      \"names\": [\n-        \"--locale-provider={ libc | icu }\"\n-      ],\n-      \"signature\": \"--locale-provider={ libc | icu }\"\n+      \"description\": \"Specifies the locale name when the builtin provider is used. Locale support is described in Section 23.1 .\",\n+      \"names\": [\n+        \"--builtin-locale= locale\"\n+      ],\n+      \"signature\": \"--builtin-locale= locale\"\n+    },\n+    {\n+      \"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 ).\",\n+      \"names\": [\n+        \"--locale-provider={ builtin | libc | icu }\"\n+      ],\n+      \"signature\": \"--locale-provider={ builtin | libc | icu }\"\n+    },\n+    {\n+      \"description\": \"Makes initdb read the bootstrap superuser's password from a file. The first line of the file is taken as the password.\",\n+      \"names\": [\n+        \"--pwfile= filename\"\n+      ],\n+      \"signature\": \"--pwfile= filename\"\n+    },\n+    {\n+      \"description\": \"Sets the default text search configuration. See default_text_search_config for further information.\",\n+      \"names\": [\n+        \"-T config\",\n+        \"--text-search-config= config\"\n+      ],\n+      \"signature\": \"-T config --text-search-config= config\"\n+    },\n+    {\n+      \"description\": \"Sets the user name of the bootstrap superuser . This defaults to the name of the operating-system user running initdb .\",\n+      \"names\": [\n+        \"-U username\",\n+        \"--username= username\"\n+      ],\n+      \"signature\": \"-U username --username= username\"\n+    },\n+    {\n+      \"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.\",\n+      \"names\": [\n+        \"-W\",\n+        \"--pwprompt\"\n+      ],\n+      \"signature\": \"-W --pwprompt\"\n+    },\n+    {\n+      \"description\": \"This option specifies the directory where the write-ahead log should be stored.\",\n+      \"names\": [\n+        \"-X directory\",\n+        \"--waldir= directory\"\n+      ],\n+      \"signature\": \"-X directory --waldir= directory\"\n+    },\n+    {\n+      \"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.\",\n+      \"names\": [\n+        \"--wal-segsize= size\"\n+      ],\n+      \"signature\": \"--wal-segsize= size\"\n+    },\n+    {\n+      \"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.\",\n+      \"names\": [\n+        \"-c name = value\",\n+        \"--set name = value\"\n+      ],\n+      \"signature\": \"-c name = value --set name = value\"\n+    },\n+    {\n+      \"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.\",\n+      \"names\": [\n+        \"-d\",\n+        \"--debug\"\n+      ],\n+      \"signature\": \"-d --debug\"\n+    },\n+    {\n+      \"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.\",\n+      \"names\": [\n+        \"--discard-caches\"\n+      ],\n+      \"signature\": \"--discard-caches\"\n+    },\n+    {\n+      \"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.\",\n+      \"names\": [\n+        \"-L directory\"\n+      ],\n+      \"signature\": \"-L directory\"\n+    },\n+    {\n+      \"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.\",\n+      \"names\": [\n+        \"-n\",\n+        \"--no-clean\"\n+      ],\n+      \"signature\": \"-n --no-clean\"\n     },\n     {\n       \"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.\",\n@@ -131,11 +222,19 @@\n       \"signature\": \"--no-instructions\"\n     },\n     {\n-      \"description\": \"Makes initdb read the bootstrap superuser's password from a file. The first line of the file is taken as the password.\",\n-      \"names\": [\n-        \"--pwfile= filename\"\n-      ],\n-      \"signature\": \"--pwfile= filename\"\n+      \"description\": \"Show internal settings and exit, without doing anything else. This can be used to debug the initdb installation.\",\n+      \"names\": [\n+        \"-s\",\n+        \"--show\"\n+      ],\n+      \"signature\": \"-s --show\"\n+    },\n+    {\n+      \"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.\",\n+      \"names\": [\n+        \"--sync-method= method\"\n+      ],\n+      \"signature\": \"--sync-method= method\"\n     },\n     {\n       \"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 .\",\n@@ -144,83 +243,6 @@\n         \"--sync-only\"\n       ],\n       \"signature\": \"-S --sync-only\"\n-    },\n-    {\n-      \"description\": \"Sets the default text search configuration. See default_text_search_config for further information.\",\n-      \"names\": [\n-        \"-T config\",\n-        \"--text-search-config= config\"\n-      ],\n-      \"signature\": \"-T config --text-search-config= config\"\n-    },\n-    {\n-      \"description\": \"Sets the user name of the bootstrap superuser . This defaults to the name of the operating-system user running initdb .\",\n-      \"names\": [\n-        \"-U username\",\n-        \"--username= username\"\n-      ],\n-      \"signature\": \"-U username --username= username\"\n-    },\n-    {\n-      \"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.\",\n-      \"names\": [\n-        \"-W\",\n-        \"--pwprompt\"\n-      ],\n-      \"signature\": \"-W --pwprompt\"\n-    },\n-    {\n-      \"description\": \"This option specifies the directory where the write-ahead log should be stored.\",\n-      \"names\": [\n-        \"-X directory\",\n-        \"--waldir= directory\"\n-      ],\n-      \"signature\": \"-X directory --waldir= directory\"\n-    },\n-    {\n-      \"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.\",\n-      \"names\": [\n-        \"--wal-segsize= size\"\n-      ],\n-      \"signature\": \"--wal-segsize= size\"\n-    },\n-    {\n-      \"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.\",\n-      \"names\": [\n-        \"-c name = value\",\n-        \"--set name = value\"\n-      ],\n-      \"signature\": \"-c name = value --set name = value\"\n-    },\n-    {\n-      \"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.\",\n-      \"names\": [\n-        \"-d\",\n-        \"--debug\"\n-      ],\n-      \"signature\": \"-d --debug\"\n-    },\n-    {\n-      \"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.\",\n-      \"names\": [\n-        \"--discard-caches\"\n-      ],\n-      \"signature\": \"--discard-caches\"\n-    },\n-    {\n-      \"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.\",\n-      \"names\": [\n-        \"-L directory\"\n-      ],\n-      \"signature\": \"-L directory\"\n-    },\n-    {\n-      \"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.\",\n-      \"names\": [\n-        \"-n\",\n-        \"--no-clean\"\n-      ],\n-      \"signature\": \"-n --no-clean\"\n     },\n     {\n       \"description\": \"Print the initdb version and exit.\","}}