{"kind": "tool", "major": "18", "item": {"slug": "initdb", "name": "initdb", "name_zh": "", "category": "\u670d\u52a1\u7aef\u7a0b\u5e8f", "summary": "initdb \u2014 \u521b\u5efa\u4e00\u4e2a\u65b0\u7684 PostgreSQL \u6570\u636e\u5e93\u96c6\u7c07", "aliases": ["initdb"], "content_hash": "6f0dc738f5df98c2c1f419200a29fc1e92b5064cb3200bea5d10ff21832cf75d", "versions": {"10": {"facts": [{"label": "\u624b\u518c\u4e2d\u7684\u53ef\u6267\u884c\u7a0b\u5e8f", "value": "initdb"}, {"label": "\u7a0b\u5e8f\u7248\u672c", "value": "10.23"}, {"label": "\u53c2\u8003\u6e05\u5355", "value": "\u670d\u52a1\u7aef\u7a0b\u5e8f"}, {"label": "\u9009\u9879\u5b9a\u4e49\u7ec4", "value": "21"}], "tables": [{"key": "options", "rows": [{"summary": "\u6b64\u9009\u9879\u6307\u5b9a pg_hba.conf \u4e2d\u672c\u5730\u7528\u6237\u4f7f\u7528\u7684\u9ed8\u8ba4\u8ba4\u8bc1\u65b9\u6cd5\uff08 host \u548c local \u884c\uff09\u3002 initdb \u4f1a\u4f7f\u7528\u6307\u5b9a\u7684\u8ba4\u8bc1\u65b9\u6cd5\uff0c\u4e3a\u975e\u590d\u5236\u8fde\u63a5\u548c\u590d\u5236\u8fde\u63a5\u9884\u5148\u586b\u5145 pg_hba.conf \u6761\u76ee\u3002", "signature": {"url": "/docs/10/app-initdb.html", "text": "-A authmethod --auth= authmethod"}}, {"summary": "\u8be5\u9009\u9879\u6307\u5b9a pg_hba.conf \u4e2d\u672c\u5730\u7528\u6237\u901a\u8fc7 TCP/IP \u8fde\u63a5\u65f6\uff08 host \u884c\uff09\u4f7f\u7528\u7684\u8ba4\u8bc1\u65b9\u6cd5\u3002", "signature": {"url": "/docs/10/app-initdb.html", "text": "--auth-host= authmethod"}}, {"summary": "\u8be5\u9009\u9879\u6307\u5b9a pg_hba.conf \u4e2d\u672c\u5730\u7528\u6237\u901a\u8fc7 Unix \u57df\u5957\u63a5\u5b57\u8fde\u63a5\u65f6\uff08 local \u884c\uff09\u4f7f\u7528\u7684\u8ba4\u8bc1\u65b9\u6cd5\u3002", "signature": {"url": "/docs/10/app-initdb.html", "text": "--auth-local= authmethod"}}, {"summary": "\u8be5\u9009\u9879\u6307\u5b9a\u6570\u636e\u5e93\u96c6\u7c07\u5e94\u5b58\u653e\u7684\u76ee\u5f55\u3002\u8fd9\u662f initdb \u6240\u9700\u7684\u552f\u4e00\u4fe1\u606f\uff0c\u4f46\u4e5f\u53ef\u4ee5\u901a\u8fc7\u8bbe\u7f6e PGDATA \u73af\u5883\u53d8\u91cf\u6765\u7701\u53bb\u663e\u5f0f\u5199\u51fa\u5b83\uff1b\u8fd9\u901a\u5e38\u66f4\u65b9\u4fbf\uff0c\u56e0\u4e3a\u6570\u636e\u5e93\u670d\u52a1\u5668\uff08 postgres \uff09\u4e4b\u540e\u4e5f\u53ef\u4ee5\u901a\u8fc7\u540c\u4e00\u53d8\u91cf\u627e\u5230\u6570\u636e\u76ee\u5f55\u3002", "signature": {"url": "/docs/10/app-initdb.html", "text": "-D directory --pgdata= directory"}}, {"summary": "\u9009\u62e9\u6a21\u677f\u6570\u636e\u5e93\u7684\u7f16\u7801\u3002\u8fd9\u4e5f\u4f1a\u6210\u4e3a\u4ee5\u540e\u521b\u5efa\u7684\u4efb\u4f55\u6570\u636e\u5e93\u7684\u9ed8\u8ba4\u7f16\u7801\uff0c\u9664\u975e\u5728\u521b\u5efa\u65f6\u8986\u76d6\u5b83\u3002\u9ed8\u8ba4\u503c\u7531\u533a\u57df\u8bbe\u7f6e\u63a8\u5bfc\u800c\u6765\uff0c\u5982\u679c\u65e0\u6cd5\u63a8\u5bfc\uff0c\u5219\u4f7f\u7528 SQL_ASCII \u3002 PostgreSQL \u670d\u52a1\u5668\u652f\u6301\u7684\u5b57\u7b26\u96c6\u5728 \u7b2c 23.3.1 \u8282 \u4e2d\u4ecb\u7ecd\u3002", "signature": {"url": "/docs/10/app-initdb.html", "text": "-E encoding --encoding= encoding"}}, {"summary": "\u5728\u6570\u636e\u9875\u4e0a\u4f7f\u7528\u6821\u9a8c\u548c\uff0c\u5e2e\u52a9\u68c0\u6d4b I/O \u7cfb\u7edf\u9020\u6210\u7684\u3001\u5426\u5219\u53ef\u80fd\u6084\u65e0\u58f0\u606f\u7684\u6570\u636e\u635f\u574f\u3002\u542f\u7528\u6821\u9a8c\u548c\u53ef\u80fd\u4f1a\u5e26\u6765\u660e\u663e\u7684\u6027\u80fd\u635f\u5931\u3002\u6b64\u9009\u9879\u53ea\u80fd\u5728\u521d\u59cb\u5316\u65f6\u8bbe\u7f6e\uff0c\u4ee5\u540e\u4e0d\u80fd\u66f4\u6539\u3002\u5982\u679c\u542f\u7528\uff0c\u5c31\u4f1a\u4e3a\u6240\u6709\u6570\u636e\u5e93\u4e2d\u7684\u6240\u6709\u5bf9\u8c61\u8ba1\u7b97\u6821\u9a8c\u548c\u3002", "signature": {"url": "/docs/10/app-initdb.html#APP-INITDB-DATA-CHECKSUMS", "text": "-k --data-checksums"}}, {"summary": "\u8bbe\u7f6e\u6570\u636e\u5e93\u96c6\u7c07\u7684\u9ed8\u8ba4\u533a\u57df\u8bbe\u7f6e\u3002\u5982\u679c\u672a\u6307\u5b9a\u8be5\u9009\u9879\uff0c\u533a\u57df\u8bbe\u7f6e\u5c06\u7ee7\u627f\u81ea initdb \u8fd0\u884c\u65f6\u6240\u5728\u7684\u73af\u5883\u3002\u533a\u57df\u8bbe\u7f6e\u652f\u6301\u89c1 \u7b2c 23.1 \u8282 \u3002", "signature": {"url": "/docs/10/app-initdb.html", "text": "--locale= locale"}}, {"summary": "\u7c7b\u4f3c\u4e8e --locale \uff0c\u4f46\u53ea\u5728\u6307\u5b9a\u7684\u7c7b\u522b\u4e2d\u8bbe\u7f6e\u533a\u57df\u8bbe\u7f6e\u3002", "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": "\u7b49\u4ef7\u4e8e --locale=C \u3002", "signature": {"url": "/docs/10/app-initdb.html", "text": "--no-locale"}}, {"summary": "\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c initdb \u4f1a\u7b49\u5f85\u6240\u6709\u6587\u4ef6\u5b89\u5168\u5199\u5165\u78c1\u76d8\u3002\u6b64\u9009\u9879\u4f7f initdb \u4e0d\u7b49\u5f85\u5c31\u8fd4\u56de\uff0c\u901f\u5ea6\u66f4\u5feb\uff0c\u4f46\u610f\u5473\u7740\u6b64\u540e\u64cd\u4f5c\u7cfb\u7edf\u5d29\u6e83\u53ef\u80fd\u4f1a\u9020\u6210\u6570\u636e\u76ee\u5f55\u635f\u574f\u3002\u901a\u5e38\uff0c\u6b64\u9009\u9879\u9002\u7528\u4e8e\u6d4b\u8bd5\uff0c\u4f46\u4e0d\u5e94\u5728\u521b\u5efa\u751f\u4ea7\u5b89\u88c5\u65f6\u4f7f\u7528\u3002", "signature": {"url": "/docs/10/app-initdb.html", "text": "-N --no-sync"}}, {"summary": "\u4f7f initdb \u4ece\u6587\u4ef6\u4e2d\u8bfb\u53d6\u6570\u636e\u5e93\u8d85\u7ea7\u7528\u6237\u7684\u5bc6\u7801\u3002\u6587\u4ef6\u7684\u7b2c\u4e00\u884c\u4f1a\u88ab\u5f53\u4f5c\u5bc6\u7801\u3002", "signature": {"url": "/docs/10/app-initdb.html", "text": "--pwfile= filename"}}, {"summary": "\u5c06\u6240\u6709\u6570\u636e\u5e93\u6587\u4ef6\u5b89\u5168\u5199\u5165\u78c1\u76d8\uff0c\u7136\u540e\u9000\u51fa\u3002\u8fd9\u4e0d\u4f1a\u6267\u884c\u4efb\u4f55\u5e38\u89c4 initdb \u64cd\u4f5c\u3002", "signature": {"url": "/docs/10/app-initdb.html", "text": "-S --sync-only"}}, {"summary": "\u8bbe\u7f6e\u9ed8\u8ba4\u6587\u672c\u68c0\u7d22\u914d\u7f6e\u3002\u66f4\u591a\u4fe1\u606f\u89c1 default_text_search_config \u3002", "signature": {"url": "/docs/10/app-initdb.html", "text": "-T config --text-search-config= config"}}, {"summary": "\u9009\u62e9\u6570\u636e\u5e93\u8d85\u7ea7\u7528\u6237\u7684\u7528\u6237\u540d\u3002\u9ed8\u8ba4\u503c\u662f\u8fd0\u884c initdb \u7684\u6709\u6548\u7528\u6237\u7684\u540d\u79f0\u3002\u8d85\u7ea7\u7528\u6237\u7684\u540d\u79f0\u672c\u8eab\u5e76\u4e0d\u91cd\u8981\uff0c\u4e0d\u8fc7\u5373\u4f7f\u64cd\u4f5c\u7cfb\u7edf\u7528\u6237\u540d\u79f0\u4e0d\u540c\uff0c\u4e5f\u53ef\u4ee5\u9009\u62e9\u6cbf\u7528\u60ef\u5e38\u7684\u540d\u79f0 postgres \u3002", "signature": {"url": "/docs/10/app-initdb.html", "text": "-U username --username= username"}}, {"summary": "\u4f7f initdb \u63d0\u793a\u8f93\u5165\u8981\u8d4b\u7ed9\u6570\u636e\u5e93\u8d85\u7ea7\u7528\u6237\u7684\u5bc6\u7801\u3002\u5982\u679c\u4e0d\u6253\u7b97\u4f7f\u7528\u5bc6\u7801\u8ba4\u8bc1\uff0c\u8fd9\u4e00\u70b9\u5e76\u4e0d\u91cd\u8981\u3002\u5426\u5219\uff0c\u5728\u8bbe\u7f6e\u5bc6\u7801\u4e4b\u524d\u5c06\u65e0\u6cd5\u4f7f\u7528\u5bc6\u7801\u8ba4\u8bc1\u3002", "signature": {"url": "/docs/10/app-initdb.html", "text": "-W --pwprompt"}}, {"summary": "\u8be5\u9009\u9879\u6307\u5b9a\u9884\u5199\u5f0f\u65e5\u5fd7\uff08WAL\uff09\u5e94\u5b58\u653e\u7684\u76ee\u5f55\u3002", "signature": {"url": "/docs/10/app-initdb.html", "text": "-X directory --waldir= directory"}}, {"summary": "\u6253\u5370\u5f15\u5bfc\u540e\u7aef\u7684\u8c03\u8bd5\u8f93\u51fa\uff0c\u4ee5\u53ca\u5c11\u91cf\u666e\u901a\u7528\u6237\u901a\u5e38\u4e0d\u611f\u5174\u8da3\u7684\u5176\u4ed6\u6d88\u606f\u3002\u5f15\u5bfc\u540e\u7aef\u662f initdb \u7528\u6765\u521b\u5efa\u7cfb\u7edf\u76ee\u5f55\u8868\u7684\u7a0b\u5e8f\u3002\u8be5\u9009\u9879\u4f1a\u4ea7\u751f\u5927\u91cf\u6781\u5176\u4e4f\u5473\u7684\u8f93\u51fa\u3002", "signature": {"url": "/docs/10/app-initdb.html", "text": "-d --debug"}}, {"summary": "\u6307\u5b9a initdb \u521d\u59cb\u5316\u6570\u636e\u5e93\u96c6\u7c07\u65f6\u5e94\u5230\u54ea\u91cc\u67e5\u627e\u5176\u8f93\u5165\u6587\u4ef6\u3002\u901a\u5e38\u4e0d\u9700\u8981\u8fd9\u6837\u505a\u3002\u82e5\u9700\u8981\u663e\u5f0f\u6307\u5b9a\u5176\u4f4d\u7f6e\uff0c\u7cfb\u7edf\u4f1a\u63d0\u793a\u3002", "signature": {"url": "/docs/10/app-initdb.html", "text": "-L directory"}}, {"summary": "\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c\u5982\u679c initdb \u53d1\u73b0\u67d0\u4e2a\u9519\u8bef\u4f7f\u5176\u65e0\u6cd5\u5b8c\u6574\u521b\u5efa\u6570\u636e\u5e93\u96c6\u7c07\uff0c\u5c31\u4f1a\u5220\u9664\u5b83\u5728\u53d1\u73b0\u65e0\u6cd5\u5b8c\u6210\u4efb\u52a1\u4e4b\u524d\u53ef\u80fd\u5df2\u521b\u5efa\u7684\u6240\u6709\u6587\u4ef6\u3002\u8be5\u9009\u9879\u4f1a\u7981\u6b62\u8fd9\u79cd\u6e05\u7406\uff0c\u56e0\u6b64\u5bf9\u8c03\u8bd5\u6709\u7528\u3002", "signature": {"url": "/docs/10/app-initdb.html", "text": "-n --no-clean"}}, {"summary": "\u6253\u5370 initdb \u7248\u672c\u5e76\u9000\u51fa\u3002", "signature": {"url": "/docs/10/app-initdb.html", "text": "-V --version"}}, {"summary": "\u663e\u793a\u6709\u5173 initdb \u547d\u4ee4\u884c\u53c2\u6570\u7684\u5e2e\u52a9\u5e76\u9000\u51fa\u3002", "signature": {"url": "/docs/10/app-initdb.html", "text": "-? --help"}}], "title": "\u624b\u518c\u4e2d\u7684\u9009\u9879", "columns": [{"key": "signature", "label": "\u9009\u9879\u4e0e\u53c2\u6570"}, {"key": "summary", "label": "\u8bf4\u660e"}]}, {"key": "environment", "rows": [{"name": "PGDATA", "description": "\u6307\u5b9a\u6570\u636e\u5e93\u96c6\u7c07\u5e94\u5b58\u653e\u7684\u76ee\u5f55\uff1b\u53ef\u4f7f\u7528 -D \u9009\u9879\u8986\u76d6\u3002"}, {"name": "TZ", "description": "\u6307\u5b9a\u6240\u521b\u5efa\u6570\u636e\u5e93\u96c6\u7c07\u7684\u9ed8\u8ba4\u65f6\u533a\u3002\u8be5\u503c\u5e94\u4e3a\u5b8c\u6574\u7684\u65f6\u533a\u540d\u79f0\uff08\u89c1 \u7b2c 8.5.3 \u8282 \uff09\u3002"}], "title": "\u73af\u5883\u53d8\u91cf", "columns": [{"key": "name", "label": "\u53d8\u91cf"}, {"key": "description", "label": "\u542b\u4e49"}]}], "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": "https://pg.center/docs/10/app-initdb.html", "file": "app-initdb.html", "label": "10.23 English manual \u00b7 app-initdb.html", "anchor": "", "sha256": "ca0e86b1e5c9356e5d4d7753e9e179ab92796eead67d049397b4f2a7183110d1", "language": "en", "original_url": "/docs/10/app-initdb.html"}, {"url": "https://pg.center/docs/10/reference-server.html", "file": "reference-server.html", "label": "Server applications inventory", "anchor": "", "sha256": "2a6043b88501763a31348758a370a42cd7f9a179c7fdf3ef0e353c82e95b33e9", "language": "en", "original_url": "/docs/10/reference-server.html"}], "sections": [], "synopsis": ["initdb [ option ...] [ --pgdata | -D ] directory"], "signature": "initdb [ option ...] [ --pgdata | -D ] directory", "description": ["initdb \u2014 \u521b\u5efa\u4e00\u4e2a\u65b0\u7684 PostgreSQL \u6570\u636e\u5e93\u96c6\u7c07"], "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 lang=\"zh\">initdb \u2014 \u521b\u5efa\u4e00\u4e2a\u65b0\u7684<span class=\"productname\">PostgreSQL</span>\u6570\u636e\u5e93\u96c6\u7c07</p>\n</div>\n<div class=\"refsynopsisdiv\">\n<h2 lang=\"zh\">\u5927\u7eb2</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 lang=\"zh\">\u8bf4\u660e</h2>\n<p lang=\"zh\"><code class=\"command\">initdb</code>\u521b\u5efa\u4e00\u4e2a\u65b0\u7684<span class=\"productname\">PostgreSQL</span>\u6570\u636e\u5e93\u96c6\u7c07\u3002\u6570\u636e\u5e93\u96c6\u7c07\u662f\u7531\u5355\u4e2a\u670d\u52a1\u5668\u5b9e\u4f8b\u7ba1\u7406\u7684\u4e00\u7ec4\u6570\u636e\u5e93\u3002</p>\n<p lang=\"zh\">\u521b\u5efa\u6570\u636e\u5e93\u96c6\u7c07\u5305\u62ec\u521b\u5efa\u7528\u4e8e\u5b58\u653e\u6570\u636e\u5e93\u6570\u636e\u7684\u76ee\u5f55\uff0c\u751f\u6210\u5171\u4eab\u7cfb\u7edf\u76ee\u5f55\u8868\uff08\u5c5e\u4e8e\u6574\u4e2a\u96c6\u7c07\u800c\u4e0d\u662f\u67d0\u4e2a\u7279\u5b9a\u6570\u636e\u5e93\u7684\u8868\uff09\uff0c\u4ee5\u53ca\u521b\u5efa<code class=\"literal\">template1</code>\u548c<code class=\"literal\">postgres</code>\u6570\u636e\u5e93\u3002\u4ee5\u540e\u521b\u5efa\u65b0\u6570\u636e\u5e93\u65f6\uff0c\u4f1a\u590d\u5236<code class=\"literal\">template1</code>\u6570\u636e\u5e93\u4e2d\u7684\u6240\u6709\u5185\u5bb9\u3002\uff08\u56e0\u6b64\uff0c\u5b89\u88c5\u5728<code class=\"literal\">template1</code>\u4e2d\u7684\u4efb\u4f55\u4e1c\u897f\u90fd\u4f1a\u81ea\u52a8\u590d\u5236\u5230\u4ee5\u540e\u521b\u5efa\u7684\u6bcf\u4e2a\u6570\u636e\u5e93\u4e2d\u3002\uff09<code class=\"literal\">postgres</code>\u6570\u636e\u5e93\u662f\u4e00\u4e2a\u9ed8\u8ba4\u6570\u636e\u5e93\uff0c\u4f9b\u7528\u6237\u3001\u5de5\u5177\u7a0b\u5e8f\u548c\u7b2c\u4e09\u65b9\u5e94\u7528\u7a0b\u5e8f\u4f7f\u7528\u3002</p>\n<p lang=\"zh\">\u867d\u7136<code class=\"command\">initdb</code>\u4f1a\u5c1d\u8bd5\u521b\u5efa\u6307\u5b9a\u7684\u6570\u636e\u76ee\u5f55\uff0c\u4f46\u5982\u679c\u6240\u9700\u6570\u636e\u76ee\u5f55\u7684\u7236\u76ee\u5f55\u5f52 root \u6240\u6709\uff0c\u5b83\u53ef\u80fd\u6ca1\u6709\u8db3\u591f\u7684\u6743\u9650\u3002\u8981\u5728\u8fd9\u79cd\u73af\u5883\u4e2d\u521d\u59cb\u5316\uff0c\u53ef\u5148\u7531 root \u521b\u5efa\u4e00\u4e2a\u7a7a\u7684\u6570\u636e\u76ee\u5f55\uff0c\u7136\u540e\u7528<code class=\"command\">chown</code>\u5c06\u8be5\u76ee\u5f55\u7684\u6240\u6709\u6743\u8d4b\u4e88\u6570\u636e\u5e93\u7528\u6237\u8d26\u6237\uff0c\u518d\u7528 <code class=\"command\">su</code>\u5207\u6362\u4e3a\u8be5\u6570\u636e\u5e93\u7528\u6237\u6765\u8fd0\u884c<code class=\"command\">initdb</code>\u3002</p>\n<p lang=\"zh\"><code class=\"command\">initdb</code>\u5fc5\u987b\u4ee5\u5c06\u62e5\u6709\u670d\u52a1\u5668\u8fdb\u7a0b\u7684\u7528\u6237\u8eab\u4efd\u8fd0\u884c\uff0c\u56e0\u4e3a\u670d\u52a1\u5668\u9700\u8981\u8bbf\u95ee <code class=\"command\">initdb</code>\u521b\u5efa\u7684\u6587\u4ef6\u548c\u76ee\u5f55\u3002\u7531\u4e8e\u670d\u52a1\u5668\u4e0d\u80fd\u4ee5 root \u8eab\u4efd\u8fd0\u884c\uff0c\u56e0\u6b64\u4e5f\u7edd\u4e0d\u80fd\u4ee5 root \u8eab\u4efd\u8fd0\u884c<code class=\"command\">initdb</code>\u3002\uff08\u5b9e\u9645\u4e0a\u5b83\u4f1a\u62d2\u7edd\u8fd9\u6837\u505a\u3002\uff09</p>\n<p lang=\"zh\"><code class=\"command\">initdb</code>\u4f1a\u521d\u59cb\u5316\u6570\u636e\u5e93\u96c6\u7c07\u7684\u9ed8\u8ba4\u533a\u57df\u8bbe\u7f6e\u548c\u5b57\u7b26\u96c6\u7f16\u7801\u3002\u5b57\u7b26\u96c6\u7f16\u7801\u3001\u6392\u5e8f\u987a\u5e8f\uff08<code class=\"literal\">LC_COLLATE</code>\uff09\u548c\u5b57\u7b26\u96c6\u5206\u7c7b\uff08<code class=\"literal\">LC_CTYPE</code>\uff0c\u4f8b\u5982\u5927\u5199\u3001\u5c0f\u5199\u3001\u6570\u5b57\uff09\u53ef\u4ee5\u5728\u521b\u5efa\u6570\u636e\u5e93\u65f6\u5355\u72ec\u8bbe\u7f6e\u3002<code class=\"command\">initdb</code>\u4e3a<code class=\"literal\">template1</code>\u6570\u636e\u5e93\u786e\u5b9a\u8fd9\u4e9b\u8bbe\u7f6e\uff0c\u5b83\u4eec\u5c06\u4f5c\u4e3a\u6240\u6709\u5176\u4ed6\u6570\u636e\u5e93\u7684\u9ed8\u8ba4\u503c\u3002</p>\n<p lang=\"zh\">\u8981\u66f4\u6539\u9ed8\u8ba4\u6392\u5e8f\u987a\u5e8f\u6216\u5b57\u7b26\u96c6\u5206\u7c7b\uff0c\u8bf7\u4f7f\u7528<code class=\"option\">--lc-collate</code>\u548c<code class=\"option\">--lc-ctype</code>\u9009\u9879\u3002\u4f7f\u7528<code class=\"literal\">C</code>\u6216<code class=\"literal\">POSIX</code>\u4e4b\u5916\u7684\u6392\u5e8f\u987a\u5e8f\u4e5f\u4f1a\u5e26\u6765\u6027\u80fd\u635f\u5931\u3002\u56e0\u6b64\uff0c\u5728\u8fd0\u884c<code class=\"command\">initdb</code>\u65f6\u9009\u62e9\u6b63\u786e\u7684\u533a\u57df\u8bbe\u7f6e\u5f88\u91cd\u8981\u3002</p>\n<p lang=\"zh\">\u5176\u4f59\u533a\u57df\u8bbe\u7f6e\u7c7b\u522b\u53ef\u4ee5\u5728\u4ee5\u540e\u542f\u52a8\u670d\u52a1\u5668\u65f6\u66f4\u6539\u3002\u8fd8\u53ef\u4ee5\u4f7f\u7528<code class=\"option\">--locale</code>\u8bbe\u7f6e\u6240\u6709\u533a\u57df\u8bbe\u7f6e\u7c7b\u522b\u7684\u9ed8\u8ba4\u503c\uff0c\u5305\u62ec\u6392\u5e8f\u987a\u5e8f\u548c\u5b57\u7b26\u96c6\u5206\u7c7b\u3002\u6240\u6709\u670d\u52a1\u5668\u533a\u57df\u8bbe\u7f6e\u503c\uff08<code class=\"literal\">lc_*</code>\uff09\u90fd\u53ef\u4ee5\u901a\u8fc7<code class=\"command\">SHOW ALL</code>\u663e\u793a\u3002\u66f4\u591a\u7ec6\u8282\u89c1<a class=\"xref\" href=\"/docs/10/charset.html#LOCALE\" title=\"23.1.\u00a0\u533a\u57df\u8bbe\u7f6e\u652f\u6301\">\u7b2c\u00a023.1\u00a0\u8282</a>\u3002</p>\n<p lang=\"zh\">\u8981\u4fee\u6539\u9ed8\u8ba4\u7f16\u7801\uff0c\u8bf7\u4f7f\u7528<code class=\"option\">--encoding</code>\u3002\u66f4\u591a\u7ec6\u8282\u89c1<a class=\"xref\" href=\"/docs/10/multibyte.html\" title=\"23.3.\u00a0\u5b57\u7b26\u96c6\u652f\u6301\">\u7b2c\u00a023.3\u00a0\u8282</a>\u3002</p>\n</div>\n<div class=\"refsect1\" id=\"id-1.9.5.3.6\">\n<h2 lang=\"zh\">\u9009\u9879</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 lang=\"zh\">\u6b64\u9009\u9879\u6307\u5b9a<code class=\"filename\">pg_hba.conf</code>\u4e2d\u672c\u5730\u7528\u6237\u4f7f\u7528\u7684\u9ed8\u8ba4\u8ba4\u8bc1\u65b9\u6cd5\uff08<code class=\"literal\">host</code>\u548c<code class=\"literal\">local</code>\u884c\uff09\u3002<code class=\"command\">initdb</code>\u4f1a\u4f7f\u7528\u6307\u5b9a\u7684\u8ba4\u8bc1\u65b9\u6cd5\uff0c\u4e3a\u975e\u590d\u5236\u8fde\u63a5\u548c\u590d\u5236\u8fde\u63a5\u9884\u5148\u586b\u5145<code class=\"filename\">pg_hba.conf</code>\u6761\u76ee\u3002</p>\n<p lang=\"zh\">\u9664\u975e\u4fe1\u4efb\u7cfb\u7edf\u4e0a\u7684\u6240\u6709\u672c\u5730\u7528\u6237\uff0c\u5426\u5219\u4e0d\u8981\u4f7f\u7528<code class=\"literal\">trust</code>\u3002\u4e3a\u4fbf\u4e8e\u5b89\u88c5\uff0c\u9ed8\u8ba4\u503c\u4e3a<code class=\"literal\">trust</code>\u3002</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 lang=\"zh\">\n<p>\u8be5\u9009\u9879\u6307\u5b9a<code class=\"filename\">pg_hba.conf</code>\u4e2d\u672c\u5730\u7528\u6237\u901a\u8fc7 TCP/IP \u8fde\u63a5\u65f6\uff08<code class=\"literal\">host</code> \u884c\uff09\u4f7f\u7528\u7684\u8ba4\u8bc1\u65b9\u6cd5\u3002</p>\n</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 lang=\"zh\">\n<p>\u8be5\u9009\u9879\u6307\u5b9a<code class=\"filename\">pg_hba.conf</code>\u4e2d\u672c\u5730\u7528\u6237\u901a\u8fc7 Unix \u57df\u5957\u63a5\u5b57\u8fde\u63a5\u65f6\uff08<code class=\"literal\">local</code> \u884c\uff09\u4f7f\u7528\u7684\u8ba4\u8bc1\u65b9\u6cd5\u3002</p>\n</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 lang=\"zh\">\n<p>\u8be5\u9009\u9879\u6307\u5b9a\u6570\u636e\u5e93\u96c6\u7c07\u5e94\u5b58\u653e\u7684\u76ee\u5f55\u3002\u8fd9\u662f<code class=\"command\">initdb</code>\u6240\u9700\u7684\u552f\u4e00\u4fe1\u606f\uff0c\u4f46\u4e5f\u53ef\u4ee5\u901a\u8fc7\u8bbe\u7f6e<code class=\"envar\">PGDATA</code>\u73af\u5883\u53d8\u91cf\u6765\u7701\u53bb\u663e\u5f0f\u5199\u51fa\u5b83\uff1b\u8fd9\u901a\u5e38\u66f4\u65b9\u4fbf\uff0c\u56e0\u4e3a\u6570\u636e\u5e93\u670d\u52a1\u5668\uff08<code class=\"command\">postgres</code>\uff09\u4e4b\u540e\u4e5f\u53ef\u4ee5\u901a\u8fc7\u540c\u4e00\u53d8\u91cf\u627e\u5230\u6570\u636e\u76ee\u5f55\u3002</p>\n</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 lang=\"zh\">\n<p>\u9009\u62e9\u6a21\u677f\u6570\u636e\u5e93\u7684\u7f16\u7801\u3002\u8fd9\u4e5f\u4f1a\u6210\u4e3a\u4ee5\u540e\u521b\u5efa\u7684\u4efb\u4f55\u6570\u636e\u5e93\u7684\u9ed8\u8ba4\u7f16\u7801\uff0c\u9664\u975e\u5728\u521b\u5efa\u65f6\u8986\u76d6\u5b83\u3002\u9ed8\u8ba4\u503c\u7531\u533a\u57df\u8bbe\u7f6e\u63a8\u5bfc\u800c\u6765\uff0c\u5982\u679c\u65e0\u6cd5\u63a8\u5bfc\uff0c\u5219\u4f7f\u7528<code class=\"literal\">SQL_ASCII</code>\u3002<span class=\"productname\">PostgreSQL</span>\u670d\u52a1\u5668\u652f\u6301\u7684\u5b57\u7b26\u96c6\u5728<a class=\"xref\" href=\"/docs/10/multibyte.html#MULTIBYTE-CHARSET-SUPPORTED\" title=\"23.3.1.\u00a0\u652f\u6301\u7684\u5b57\u7b26\u96c6\">\u7b2c\u00a023.3.1\u00a0\u8282</a>\u4e2d\u4ecb\u7ecd\u3002</p>\n</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 lang=\"zh\">\n<p>\u5728\u6570\u636e\u9875\u4e0a\u4f7f\u7528\u6821\u9a8c\u548c\uff0c\u5e2e\u52a9\u68c0\u6d4b I/O \u7cfb\u7edf\u9020\u6210\u7684\u3001\u5426\u5219\u53ef\u80fd\u6084\u65e0\u58f0\u606f\u7684\u6570\u636e\u635f\u574f\u3002\u542f\u7528\u6821\u9a8c\u548c\u53ef\u80fd\u4f1a\u5e26\u6765\u660e\u663e\u7684\u6027\u80fd\u635f\u5931\u3002\u6b64\u9009\u9879\u53ea\u80fd\u5728\u521d\u59cb\u5316\u65f6\u8bbe\u7f6e\uff0c\u4ee5\u540e\u4e0d\u80fd\u66f4\u6539\u3002\u5982\u679c\u542f\u7528\uff0c\u5c31\u4f1a\u4e3a\u6240\u6709\u6570\u636e\u5e93\u4e2d\u7684\u6240\u6709\u5bf9\u8c61\u8ba1\u7b97\u6821\u9a8c\u548c\u3002</p>\n</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 lang=\"zh\">\n<p>\u8bbe\u7f6e\u6570\u636e\u5e93\u96c6\u7c07\u7684\u9ed8\u8ba4\u533a\u57df\u8bbe\u7f6e\u3002\u5982\u679c\u672a\u6307\u5b9a\u8be5\u9009\u9879\uff0c\u533a\u57df\u8bbe\u7f6e\u5c06\u7ee7\u627f\u81ea <code class=\"command\">initdb</code>\u8fd0\u884c\u65f6\u6240\u5728\u7684\u73af\u5883\u3002\u533a\u57df\u8bbe\u7f6e\u652f\u6301\u89c1<a class=\"xref\" href=\"/docs/10/charset.html#LOCALE\" title=\"23.1.\u00a0\u533a\u57df\u8bbe\u7f6e\u652f\u6301\">\u7b2c\u00a023.1\u00a0\u8282</a>\u3002</p>\n</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 lang=\"zh\">\n<p>\u7c7b\u4f3c\u4e8e<code class=\"option\">--locale</code>\uff0c\u4f46\u53ea\u5728\u6307\u5b9a\u7684\u7c7b\u522b\u4e2d\u8bbe\u7f6e\u533a\u57df\u8bbe\u7f6e\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--no-locale</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u7b49\u4ef7\u4e8e<code class=\"option\">--locale=C</code>\u3002</p>\n</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 lang=\"zh\">\n<p>\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c<code class=\"command\">initdb</code>\u4f1a\u7b49\u5f85\u6240\u6709\u6587\u4ef6\u5b89\u5168\u5199\u5165\u78c1\u76d8\u3002\u6b64\u9009\u9879\u4f7f<code class=\"command\">initdb</code>\u4e0d\u7b49\u5f85\u5c31\u8fd4\u56de\uff0c\u901f\u5ea6\u66f4\u5feb\uff0c\u4f46\u610f\u5473\u7740\u6b64\u540e\u64cd\u4f5c\u7cfb\u7edf\u5d29\u6e83\u53ef\u80fd\u4f1a\u9020\u6210\u6570\u636e\u76ee\u5f55\u635f\u574f\u3002\u901a\u5e38\uff0c\u6b64\u9009\u9879\u9002\u7528\u4e8e\u6d4b\u8bd5\uff0c\u4f46\u4e0d\u5e94\u5728\u521b\u5efa\u751f\u4ea7\u5b89\u88c5\u65f6\u4f7f\u7528\u3002</p>\n</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 lang=\"zh\">\n<p>\u4f7f<code class=\"command\">initdb</code>\u4ece\u6587\u4ef6\u4e2d\u8bfb\u53d6\u6570\u636e\u5e93\u8d85\u7ea7\u7528\u6237\u7684\u5bc6\u7801\u3002\u6587\u4ef6\u7684\u7b2c\u4e00\u884c\u4f1a\u88ab\u5f53\u4f5c\u5bc6\u7801\u3002</p>\n</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 lang=\"zh\">\n<p>\u5c06\u6240\u6709\u6570\u636e\u5e93\u6587\u4ef6\u5b89\u5168\u5199\u5165\u78c1\u76d8\uff0c\u7136\u540e\u9000\u51fa\u3002\u8fd9\u4e0d\u4f1a\u6267\u884c\u4efb\u4f55\u5e38\u89c4<span class=\"application\">initdb</span>\u64cd\u4f5c\u3002</p>\n</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 lang=\"zh\">\n<p>\u8bbe\u7f6e\u9ed8\u8ba4\u6587\u672c\u68c0\u7d22\u914d\u7f6e\u3002\u66f4\u591a\u4fe1\u606f\u89c1<a class=\"xref\" href=\"/docs/10/runtime-config-client.html#GUC-DEFAULT-TEXT-SEARCH-CONFIG\">default_text_search_config</a>\u3002</p>\n</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 lang=\"zh\">\n<p>\u9009\u62e9\u6570\u636e\u5e93\u8d85\u7ea7\u7528\u6237\u7684\u7528\u6237\u540d\u3002\u9ed8\u8ba4\u503c\u662f\u8fd0\u884c<code class=\"command\">initdb</code>\u7684\u6709\u6548\u7528\u6237\u7684\u540d\u79f0\u3002\u8d85\u7ea7\u7528\u6237\u7684\u540d\u79f0\u672c\u8eab\u5e76\u4e0d\u91cd\u8981\uff0c\u4e0d\u8fc7\u5373\u4f7f\u64cd\u4f5c\u7cfb\u7edf\u7528\u6237\u540d\u79f0\u4e0d\u540c\uff0c\u4e5f\u53ef\u4ee5\u9009\u62e9\u6cbf\u7528\u60ef\u5e38\u7684\u540d\u79f0 <span class=\"systemitem\">postgres</span>\u3002</p>\n</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 lang=\"zh\">\n<p>\u4f7f<code class=\"command\">initdb</code>\u63d0\u793a\u8f93\u5165\u8981\u8d4b\u7ed9\u6570\u636e\u5e93\u8d85\u7ea7\u7528\u6237\u7684\u5bc6\u7801\u3002\u5982\u679c\u4e0d\u6253\u7b97\u4f7f\u7528\u5bc6\u7801\u8ba4\u8bc1\uff0c\u8fd9\u4e00\u70b9\u5e76\u4e0d\u91cd\u8981\u3002\u5426\u5219\uff0c\u5728\u8bbe\u7f6e\u5bc6\u7801\u4e4b\u524d\u5c06\u65e0\u6cd5\u4f7f\u7528\u5bc6\u7801\u8ba4\u8bc1\u3002</p>\n</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 lang=\"zh\">\n<p>\u8be5\u9009\u9879\u6307\u5b9a\u9884\u5199\u5f0f\u65e5\u5fd7\uff08WAL\uff09\u5e94\u5b58\u653e\u7684\u76ee\u5f55\u3002</p>\n</p>\n</dd>\n</dl>\n</div>\n<p lang=\"zh\">\u8fd8\u53ef\u4ee5\u4f7f\u7528\u4ee5\u4e0b\u8f83\u5c11\u7528\u5230\u7684\u9009\u9879\uff1a</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 lang=\"zh\">\n<p>\u6253\u5370\u5f15\u5bfc\u540e\u7aef\u7684\u8c03\u8bd5\u8f93\u51fa\uff0c\u4ee5\u53ca\u5c11\u91cf\u666e\u901a\u7528\u6237\u901a\u5e38\u4e0d\u611f\u5174\u8da3\u7684\u5176\u4ed6\u6d88\u606f\u3002\u5f15\u5bfc\u540e\u7aef\u662f <code class=\"command\">initdb</code>\u7528\u6765\u521b\u5efa\u7cfb\u7edf\u76ee\u5f55\u8868\u7684\u7a0b\u5e8f\u3002\u8be5\u9009\u9879\u4f1a\u4ea7\u751f\u5927\u91cf\u6781\u5176\u4e4f\u5473\u7684\u8f93\u51fa\u3002</p>\n</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 lang=\"zh\">\n<p>\u6307\u5b9a<code class=\"command\">initdb</code>\u521d\u59cb\u5316\u6570\u636e\u5e93\u96c6\u7c07\u65f6\u5e94\u5230\u54ea\u91cc\u67e5\u627e\u5176\u8f93\u5165\u6587\u4ef6\u3002\u901a\u5e38\u4e0d\u9700\u8981\u8fd9\u6837\u505a\u3002\u82e5\u9700\u8981\u663e\u5f0f\u6307\u5b9a\u5176\u4f4d\u7f6e\uff0c\u7cfb\u7edf\u4f1a\u63d0\u793a\u3002</p>\n</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 lang=\"zh\">\n<p>\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c\u5982\u679c<code class=\"command\">initdb</code>\u53d1\u73b0\u67d0\u4e2a\u9519\u8bef\u4f7f\u5176\u65e0\u6cd5\u5b8c\u6574\u521b\u5efa\u6570\u636e\u5e93\u96c6\u7c07\uff0c\u5c31\u4f1a\u5220\u9664\u5b83\u5728\u53d1\u73b0\u65e0\u6cd5\u5b8c\u6210\u4efb\u52a1\u4e4b\u524d\u53ef\u80fd\u5df2\u521b\u5efa\u7684\u6240\u6709\u6587\u4ef6\u3002\u8be5\u9009\u9879\u4f1a\u7981\u6b62\u8fd9\u79cd\u6e05\u7406\uff0c\u56e0\u6b64\u5bf9\u8c03\u8bd5\u6709\u7528\u3002</p>\n</p>\n</dd>\n</dl>\n</div>\n<p lang=\"zh\">\u5176\u4ed6\u9009\u9879\uff1a</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 lang=\"zh\">\n<p>\u6253\u5370<span class=\"application\">initdb</span>\u7248\u672c\u5e76\u9000\u51fa\u3002</p>\n</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 lang=\"zh\">\n<p>\u663e\u793a\u6709\u5173<span class=\"application\">initdb</span>\u547d\u4ee4\u884c\u53c2\u6570\u7684\u5e2e\u52a9\u5e76\u9000\u51fa\u3002</p>\n</p>\n</dd>\n</dl>\n</div>\n</div>\n<div class=\"refsect1\" id=\"id-1.9.5.3.7\">\n<h2 lang=\"zh\">\u73af\u5883</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 lang=\"zh\">\n<p>\u6307\u5b9a\u6570\u636e\u5e93\u96c6\u7c07\u5e94\u5b58\u653e\u7684\u76ee\u5f55\uff1b\u53ef\u4f7f\u7528<code class=\"option\">-D</code>\u9009\u9879\u8986\u76d6\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"envar\">TZ</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6307\u5b9a\u6240\u521b\u5efa\u6570\u636e\u5e93\u96c6\u7c07\u7684\u9ed8\u8ba4\u65f6\u533a\u3002\u8be5\u503c\u5e94\u4e3a\u5b8c\u6574\u7684\u65f6\u533a\u540d\u79f0\uff08\u89c1<a class=\"xref\" href=\"/docs/10/datatype-datetime.html#DATATYPE-TIMEZONES\" title=\"8.5.3.\u00a0\u65f6\u533a\">\u7b2c\u00a08.5.3\u00a0\u8282</a>\uff09\u3002</p>\n</p>\n</dd>\n</dl>\n</div>\n<p lang=\"zh\">\u4e0e\u5927\u591a\u6570\u5176\u4ed6<span class=\"productname\">PostgreSQL</span>\u5de5\u5177\u7a0b\u5e8f\u4e00\u6837\uff0c\u6b64\u5de5\u5177\u4e5f\u4f7f\u7528<span class=\"application\">libpq</span>\u652f\u6301\u7684\u73af\u5883\u53d8\u91cf\uff08\u53c2\u89c1<a class=\"xref\" href=\"/docs/10/libpq-envars.html\" title=\"33.14.\u00a0\u73af\u5883\u53d8\u91cf\">\u7b2c\u00a033.14\u00a0\u8282</a>\uff09\u3002</p>\n</div>\n<div class=\"refsect1\" id=\"id-1.9.5.3.8\">\n<h2 lang=\"zh\">\u6ce8\u89e3</h2>\n<p lang=\"zh\">\u4e5f\u53ef\u4ee5\u901a\u8fc7 pg_ctl initdb \u8c03\u7528 initdb\u3002</p>\n</div>\n<div class=\"refsect1\" id=\"id-1.9.5.3.9\">\n<h2 lang=\"zh\">\u53c2\u89c1</h2>\n<span class=\"simplelist\"><a class=\"xref\" href=\"https://pg.center/docs/10/app-pg-ctl.html\" title=\"pg_ctl\"><span class=\"refentrytitle\"><span class=\"application\">pg_ctl</span></span></a>, <a class=\"xref\" href=\"https://pg.center/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", "localization": {"status": "complete", "sources": [{"url": "/docs/10/app-initdb.html", "method": "same-major semantic node", "sha256": "bde5a41ee73ccaaec21477daf40ab17910adbbfe581f8254ac5c6d2279ab9e74", "language": "zh", "matched_nodes": ["#APP-INITDB/div[2]/p[1]", "#APP-INITDB/div[3]/h2[0]", "#APP-INITDB/div[4]/p[1]", "#APP-INITDB/div[4]/p[2]", "#APP-INITDB/div[4]/p[3]", "#APP-INITDB/div[4]/p[4]", "#APP-INITDB/div[4]/p[5]", "#APP-INITDB/div[4]/p[6]", "#APP-INITDB/div[4]/p[7]", "#APP-INITDB/div[4]/p[8]", "#APP-INITDB/div[5]/div[1]/dl[0]/dd[11]", "#APP-INITDB/div[5]/div[1]/dl[0]/dd[13]", "#APP-INITDB/div[5]/div[1]/dl[0]/dd[15]", "#APP-INITDB/div[5]/div[1]/dl[0]/dd[17]", "#APP-INITDB/div[5]/div[1]/dl[0]/dd[19]", "#APP-INITDB/div[5]/div[1]/dl[0]/dd[1]/p[0]", "#APP-INITDB/div[5]/div[1]/dl[0]/dd[1]/p[1]", "#APP-INITDB/div[5]/div[1]/dl[0]/dd[21]", "#APP-INITDB/div[5]/div[1]/dl[0]/dd[23]", "#APP-INITDB/div[5]/div[1]/dl[0]/dd[25]", "#APP-INITDB/div[5]/div[1]/dl[0]/dd[27]", "#APP-INITDB/div[5]/div[1]/dl[0]/dd[29]", "#APP-INITDB/div[5]/div[1]/dl[0]/dd[31]", "#APP-INITDB/div[5]/div[1]/dl[0]/dd[3]", "#APP-INITDB/div[5]/div[1]/dl[0]/dd[5]", "#APP-INITDB/div[5]/div[1]/dl[0]/dd[7]", "#APP-INITDB/div[5]/div[1]/dl[0]/dd[9]", "#APP-INITDB/div[5]/div[3]/dl[0]/dd[1]", "#APP-INITDB/div[5]/div[3]/dl[0]/dd[3]", "#APP-INITDB/div[5]/div[3]/dl[0]/dd[5]", "#APP-INITDB/div[5]/div[5]/dl[0]/dd[1]", "#APP-INITDB/div[5]/div[5]/dl[0]/dd[3]", "#APP-INITDB/div[5]/p[2]", "#APP-INITDB/div[5]/p[4]", "#APP-INITDB/div[6]/div[1]/dl[0]/dd[1]", "#APP-INITDB/div[6]/div[1]/dl[0]/dd[3]", "#APP-INITDB/div[6]/h2[0]", "#APP-INITDB/div[6]/p[2]", "#APP-INITDB/div[7]/h2[0]", "#APP-INITDB/div[8]/h2[0]"]}], "language": "zh", "original_text": {"/versions/10/description/0": "initdb \u2014 create a new PostgreSQL database cluster", "/versions/10/facts/0/label": "Documented executable", "/versions/10/facts/1/label": "Executable version", "/versions/10/facts/2/label": "Reference inventory", "/versions/10/facts/2/value": "Server applications", "/versions/10/facts/3/label": "Option definition groups", "/versions/10/tables/0/title": "Documented options", "/versions/10/tables/1/title": "Environment variables", "/versions/10/tables/0/rows/0/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.", "/versions/10/tables/0/rows/1/summary": "This option specifies the authentication method for local users via TCP/IP connections used in pg_hba.conf ( host lines).", "/versions/10/tables/0/rows/2/summary": "This option specifies the authentication method for local users via Unix-domain socket connections used in pg_hba.conf ( local lines).", "/versions/10/tables/0/rows/3/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.", "/versions/10/tables/0/rows/4/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 .", "/versions/10/tables/0/rows/5/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.", "/versions/10/tables/0/rows/6/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 .", "/versions/10/tables/0/rows/7/summary": "Like --locale , but only sets the locale in the specified category.", "/versions/10/tables/0/rows/8/summary": "Equivalent to --locale=C .", "/versions/10/tables/0/rows/9/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.", "/versions/10/tables/0/columns/0/label": "Option and arguments", "/versions/10/tables/0/columns/1/label": "Description", "/versions/10/tables/0/rows/10/summary": "Makes initdb read the database superuser's password from a file. The first line of the file is taken as the password.", "/versions/10/tables/0/rows/11/summary": "Safely write all database files to disk and exit. This does not perform any of the normal initdb operations.", "/versions/10/tables/0/rows/12/summary": "Sets the default text search configuration. See default_text_search_config for further information.", "/versions/10/tables/0/rows/13/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.", "/versions/10/tables/0/rows/14/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.", "/versions/10/tables/0/rows/15/summary": "This option specifies the directory where the write-ahead log should be stored.", "/versions/10/tables/0/rows/16/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.", "/versions/10/tables/0/rows/17/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.", "/versions/10/tables/0/rows/18/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.", "/versions/10/tables/0/rows/19/summary": "Print the initdb version and exit.", "/versions/10/tables/0/rows/20/summary": "Show help about initdb command line arguments, and exit.", "/versions/10/tables/1/columns/0/label": "Variable", "/versions/10/tables/1/columns/1/label": "Meaning", "/versions/10/tables/1/rows/0/description": "Specifies the directory where the database cluster is to be stored; can be overridden using the -D option.", "/versions/10/tables/1/rows/1/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 )."}, "fallback_fields": [], "source_language": "en", "original_snapshot_sha256": "90dc7a74192bf5da00eaa3464df3894de19501257be1b970db3746a2e9f49c11"}, "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", "manual_language": "zh"}, "11": {"facts": [{"label": "\u624b\u518c\u4e2d\u7684\u53ef\u6267\u884c\u7a0b\u5e8f", "value": "initdb"}, {"label": "\u7a0b\u5e8f\u7248\u672c", "value": "11.22"}, {"label": "\u53c2\u8003\u6e05\u5355", "value": "\u670d\u52a1\u7aef\u7a0b\u5e8f"}, {"label": "\u9009\u9879\u5b9a\u4e49\u7ec4", "value": "23"}], "tables": [{"key": "options", "rows": [{"summary": "\u6b64\u9009\u9879\u6307\u5b9a pg_hba.conf \u4e2d\u672c\u5730\u7528\u6237\u4f7f\u7528\u7684\u9ed8\u8ba4\u8ba4\u8bc1\u65b9\u6cd5\uff08 host \u548c local \u884c\uff09\u3002 initdb \u4f1a\u4f7f\u7528\u6307\u5b9a\u7684\u8ba4\u8bc1\u65b9\u6cd5\uff0c\u4e3a\u975e\u590d\u5236\u8fde\u63a5\u548c\u590d\u5236\u8fde\u63a5\u9884\u5148\u586b\u5145 pg_hba.conf \u6761\u76ee\u3002", "signature": {"url": "/docs/11/app-initdb.html", "text": "-A authmethod --auth= authmethod"}}, {"summary": "\u8be5\u9009\u9879\u6307\u5b9a pg_hba.conf \u4e2d\u672c\u5730\u7528\u6237\u901a\u8fc7 TCP/IP \u8fde\u63a5\u65f6\uff08 host \u884c\uff09\u4f7f\u7528\u7684\u8ba4\u8bc1\u65b9\u6cd5\u3002", "signature": {"url": "/docs/11/app-initdb.html", "text": "--auth-host= authmethod"}}, {"summary": "\u8be5\u9009\u9879\u6307\u5b9a pg_hba.conf \u4e2d\u672c\u5730\u7528\u6237\u901a\u8fc7 Unix \u57df\u5957\u63a5\u5b57\u8fde\u63a5\u65f6\uff08 local \u884c\uff09\u4f7f\u7528\u7684\u8ba4\u8bc1\u65b9\u6cd5\u3002", "signature": {"url": "/docs/11/app-initdb.html", "text": "--auth-local= authmethod"}}, {"summary": "\u8be5\u9009\u9879\u6307\u5b9a\u6570\u636e\u5e93\u96c6\u7c07\u5e94\u5b58\u653e\u7684\u76ee\u5f55\u3002\u8fd9\u662f initdb \u6240\u9700\u7684\u552f\u4e00\u4fe1\u606f\uff0c\u4f46\u4e5f\u53ef\u4ee5\u901a\u8fc7\u8bbe\u7f6e PGDATA \u73af\u5883\u53d8\u91cf\u6765\u7701\u53bb\u663e\u5f0f\u5199\u51fa\u5b83\uff1b\u8fd9\u901a\u5e38\u66f4\u65b9\u4fbf\uff0c\u56e0\u4e3a\u6570\u636e\u5e93\u670d\u52a1\u5668\uff08 postgres \uff09\u4e4b\u540e\u4e5f\u53ef\u4ee5\u901a\u8fc7\u540c\u4e00\u53d8\u91cf\u627e\u5230\u6570\u636e\u76ee\u5f55\u3002", "signature": {"url": "/docs/11/app-initdb.html", "text": "-D directory --pgdata= directory"}}, {"summary": "\u9009\u62e9\u6a21\u677f\u6570\u636e\u5e93\u7684\u7f16\u7801\u3002\u8fd9\u4e5f\u4f1a\u6210\u4e3a\u4ee5\u540e\u521b\u5efa\u7684\u4efb\u4f55\u6570\u636e\u5e93\u7684\u9ed8\u8ba4\u7f16\u7801\uff0c\u9664\u975e\u5728\u521b\u5efa\u65f6\u8986\u76d6\u5b83\u3002\u9ed8\u8ba4\u503c\u7531\u533a\u57df\u8bbe\u7f6e\u63a8\u5bfc\u800c\u6765\uff0c\u5982\u679c\u65e0\u6cd5\u63a8\u5bfc\uff0c\u5219\u4f7f\u7528 SQL_ASCII \u3002 PostgreSQL \u670d\u52a1\u5668\u652f\u6301\u7684\u5b57\u7b26\u96c6\u5728 \u7b2c 23.3.1 \u8282 \u4e2d\u4ecb\u7ecd\u3002", "signature": {"url": "/docs/11/app-initdb.html", "text": "-E encoding --encoding= encoding"}}, {"summary": "\u5141\u8bb8\u4e0e\u96c6\u7c07\u62e5\u6709\u8005\u540c\u7ec4\u7684\u7528\u6237\u8bfb\u53d6\u7531 initdb \u521b\u5efa\u7684\u6240\u6709\u96c6\u7c07\u6587\u4ef6\u3002\u8be5\u9009\u9879\u5728 Windows \u4e0a\u4f1a\u88ab\u5ffd\u7565\uff0c\u56e0\u4e3a\u5b83\u4e0d\u652f\u6301 POSIX \u98ce\u683c\u7684\u7ec4\u6743\u9650\u3002", "signature": {"url": "/docs/11/app-initdb.html#APP-INITDB-ALLOW-GROUP-ACCESS", "text": "-g --allow-group-access"}}, {"summary": "\u5728\u6570\u636e\u9875\u4e0a\u4f7f\u7528\u6821\u9a8c\u548c\uff0c\u5e2e\u52a9\u68c0\u6d4b I/O \u7cfb\u7edf\u9020\u6210\u7684\u3001\u5426\u5219\u53ef\u80fd\u6084\u65e0\u58f0\u606f\u7684\u6570\u636e\u635f\u574f\u3002\u542f\u7528\u6821\u9a8c\u548c\u53ef\u80fd\u4f1a\u5e26\u6765\u660e\u663e\u7684\u6027\u80fd\u635f\u5931\u3002\u6b64\u9009\u9879\u53ea\u80fd\u5728\u521d\u59cb\u5316\u65f6\u8bbe\u7f6e\uff0c\u4ee5\u540e\u4e0d\u80fd\u66f4\u6539\u3002\u5982\u679c\u542f\u7528\uff0c\u5c31\u4f1a\u4e3a\u6240\u6709\u6570\u636e\u5e93\u4e2d\u7684\u6240\u6709\u5bf9\u8c61\u8ba1\u7b97\u6821\u9a8c\u548c\u3002", "signature": {"url": "/docs/11/app-initdb.html#APP-INITDB-DATA-CHECKSUMS", "text": "-k --data-checksums"}}, {"summary": "\u8bbe\u7f6e\u6570\u636e\u5e93\u96c6\u7c07\u7684\u9ed8\u8ba4\u533a\u57df\u8bbe\u7f6e\u3002\u5982\u679c\u672a\u6307\u5b9a\u8be5\u9009\u9879\uff0c\u533a\u57df\u8bbe\u7f6e\u5c06\u7ee7\u627f\u81ea initdb \u8fd0\u884c\u65f6\u6240\u5728\u7684\u73af\u5883\u3002\u533a\u57df\u8bbe\u7f6e\u652f\u6301\u89c1 \u7b2c 23.1 \u8282 \u3002", "signature": {"url": "/docs/11/app-initdb.html", "text": "--locale= locale"}}, {"summary": "\u7c7b\u4f3c\u4e8e --locale \uff0c\u4f46\u53ea\u5728\u6307\u5b9a\u7684\u7c7b\u522b\u4e2d\u8bbe\u7f6e\u533a\u57df\u8bbe\u7f6e\u3002", "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": "\u7b49\u4ef7\u4e8e --locale=C \u3002", "signature": {"url": "/docs/11/app-initdb.html", "text": "--no-locale"}}, {"summary": "\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c initdb \u4f1a\u7b49\u5f85\u6240\u6709\u6587\u4ef6\u5b89\u5168\u5199\u5165\u78c1\u76d8\u3002\u6b64\u9009\u9879\u4f7f initdb \u4e0d\u7b49\u5f85\u5c31\u8fd4\u56de\uff0c\u901f\u5ea6\u66f4\u5feb\uff0c\u4f46\u610f\u5473\u7740\u6b64\u540e\u64cd\u4f5c\u7cfb\u7edf\u5d29\u6e83\u53ef\u80fd\u4f1a\u9020\u6210\u6570\u636e\u76ee\u5f55\u635f\u574f\u3002\u901a\u5e38\uff0c\u6b64\u9009\u9879\u9002\u7528\u4e8e\u6d4b\u8bd5\uff0c\u4f46\u4e0d\u5e94\u5728\u521b\u5efa\u751f\u4ea7\u5b89\u88c5\u65f6\u4f7f\u7528\u3002", "signature": {"url": "/docs/11/app-initdb.html", "text": "-N --no-sync"}}, {"summary": "\u4f7f initdb \u4ece\u6587\u4ef6\u4e2d\u8bfb\u53d6\u6570\u636e\u5e93\u8d85\u7ea7\u7528\u6237\u7684\u5bc6\u7801\u3002\u6587\u4ef6\u7684\u7b2c\u4e00\u884c\u4f1a\u88ab\u5f53\u4f5c\u5bc6\u7801\u3002", "signature": {"url": "/docs/11/app-initdb.html", "text": "--pwfile= filename"}}, {"summary": "\u5c06\u6240\u6709\u6570\u636e\u5e93\u6587\u4ef6\u5b89\u5168\u5199\u5165\u78c1\u76d8\uff0c\u7136\u540e\u9000\u51fa\u3002\u8fd9\u4e0d\u4f1a\u6267\u884c\u4efb\u4f55\u5e38\u89c4 initdb \u64cd\u4f5c\u3002", "signature": {"url": "/docs/11/app-initdb.html", "text": "-S --sync-only"}}, {"summary": "\u8bbe\u7f6e\u9ed8\u8ba4\u6587\u672c\u68c0\u7d22\u914d\u7f6e\u3002\u66f4\u591a\u4fe1\u606f\u89c1 default_text_search_config \u3002", "signature": {"url": "/docs/11/app-initdb.html", "text": "-T config --text-search-config= config"}}, {"summary": "\u9009\u62e9\u6570\u636e\u5e93\u8d85\u7ea7\u7528\u6237\u7684\u7528\u6237\u540d\u3002\u9ed8\u8ba4\u503c\u662f\u8fd0\u884c initdb \u7684\u6709\u6548\u7528\u6237\u7684\u540d\u79f0\u3002\u8d85\u7ea7\u7528\u6237\u7684\u540d\u79f0\u672c\u8eab\u5e76\u4e0d\u91cd\u8981\uff0c\u4e0d\u8fc7\u5373\u4f7f\u64cd\u4f5c\u7cfb\u7edf\u7528\u6237\u540d\u79f0\u4e0d\u540c\uff0c\u4e5f\u53ef\u4ee5\u9009\u62e9\u6cbf\u7528\u60ef\u5e38\u7684\u540d\u79f0 postgres \u3002", "signature": {"url": "/docs/11/app-initdb.html", "text": "-U username --username= username"}}, {"summary": "\u4f7f initdb \u63d0\u793a\u8f93\u5165\u8981\u8d4b\u7ed9\u6570\u636e\u5e93\u8d85\u7ea7\u7528\u6237\u7684\u5bc6\u7801\u3002\u5982\u679c\u4e0d\u6253\u7b97\u4f7f\u7528\u5bc6\u7801\u8ba4\u8bc1\uff0c\u8fd9\u4e00\u70b9\u5e76\u4e0d\u91cd\u8981\u3002\u5426\u5219\uff0c\u5728\u8bbe\u7f6e\u5bc6\u7801\u4e4b\u524d\u5c06\u65e0\u6cd5\u4f7f\u7528\u5bc6\u7801\u8ba4\u8bc1\u3002", "signature": {"url": "/docs/11/app-initdb.html", "text": "-W --pwprompt"}}, {"summary": "\u8be5\u9009\u9879\u6307\u5b9a\u9884\u5199\u5f0f\u65e5\u5fd7\uff08WAL\uff09\u5e94\u5b58\u653e\u7684\u76ee\u5f55\u3002", "signature": {"url": "/docs/11/app-initdb.html", "text": "-X directory --waldir= directory"}}, {"summary": "\u8bbe\u7f6e WAL \u6bb5\u5927\u5c0f\uff0c\u5355\u4f4d\u4e3a\u5146\u5b57\u8282\u3002\u8fd9\u662f WAL \u65e5\u5fd7\u4e2d\u6bcf\u4e2a\u72ec\u7acb\u6587\u4ef6\u7684\u5927\u5c0f\u3002\u9ed8\u8ba4\u5927\u5c0f\u4e3a 16 \u5146\u5b57\u8282\u3002\u53d6\u503c\u5fc5\u987b\u662f 1 \u5230 1024\uff08\u5146\u5b57\u8282\uff09\u4e4b\u95f4\u7684 2 \u7684\u5e42\u3002\u6b64\u9009\u9879\u53ea\u80fd\u5728\u521d\u59cb\u5316\u65f6\u8bbe\u7f6e\uff0c\u4e4b\u540e\u65e0\u6cd5\u66f4\u6539\u3002", "signature": {"url": "/docs/11/app-initdb.html", "text": "--wal-segsize= size"}}, {"summary": "\u6253\u5370\u5f15\u5bfc\u540e\u7aef\u7684\u8c03\u8bd5\u8f93\u51fa\uff0c\u4ee5\u53ca\u5c11\u91cf\u666e\u901a\u7528\u6237\u901a\u5e38\u4e0d\u611f\u5174\u8da3\u7684\u5176\u4ed6\u6d88\u606f\u3002\u5f15\u5bfc\u540e\u7aef\u662f initdb \u7528\u6765\u521b\u5efa\u7cfb\u7edf\u76ee\u5f55\u8868\u7684\u7a0b\u5e8f\u3002\u8be5\u9009\u9879\u4f1a\u4ea7\u751f\u5927\u91cf\u6781\u5176\u4e4f\u5473\u7684\u8f93\u51fa\u3002", "signature": {"url": "/docs/11/app-initdb.html", "text": "-d --debug"}}, {"summary": "\u6307\u5b9a initdb \u521d\u59cb\u5316\u6570\u636e\u5e93\u96c6\u7c07\u65f6\u5e94\u5230\u54ea\u91cc\u67e5\u627e\u5176\u8f93\u5165\u6587\u4ef6\u3002\u901a\u5e38\u4e0d\u9700\u8981\u8fd9\u6837\u505a\u3002\u82e5\u9700\u8981\u663e\u5f0f\u6307\u5b9a\u5176\u4f4d\u7f6e\uff0c\u7cfb\u7edf\u4f1a\u63d0\u793a\u3002", "signature": {"url": "/docs/11/app-initdb.html", "text": "-L directory"}}, {"summary": "\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c\u5982\u679c initdb \u53d1\u73b0\u67d0\u4e2a\u9519\u8bef\u4f7f\u5176\u65e0\u6cd5\u5b8c\u6574\u521b\u5efa\u6570\u636e\u5e93\u96c6\u7c07\uff0c\u5c31\u4f1a\u5220\u9664\u5b83\u5728\u53d1\u73b0\u65e0\u6cd5\u5b8c\u6210\u4efb\u52a1\u4e4b\u524d\u53ef\u80fd\u5df2\u521b\u5efa\u7684\u6240\u6709\u6587\u4ef6\u3002\u8be5\u9009\u9879\u4f1a\u7981\u6b62\u8fd9\u79cd\u6e05\u7406\uff0c\u56e0\u6b64\u5bf9\u8c03\u8bd5\u6709\u7528\u3002", "signature": {"url": "/docs/11/app-initdb.html", "text": "-n --no-clean"}}, {"summary": "\u6253\u5370 initdb \u7248\u672c\u5e76\u9000\u51fa\u3002", "signature": {"url": "/docs/11/app-initdb.html", "text": "-V --version"}}, {"summary": "\u663e\u793a\u6709\u5173 initdb \u547d\u4ee4\u884c\u53c2\u6570\u7684\u5e2e\u52a9\u5e76\u9000\u51fa\u3002", "signature": {"url": "/docs/11/app-initdb.html", "text": "-? --help"}}], "title": "\u624b\u518c\u4e2d\u7684\u9009\u9879", "columns": [{"key": "signature", "label": "\u9009\u9879\u4e0e\u53c2\u6570"}, {"key": "summary", "label": "\u8bf4\u660e"}]}, {"key": "environment", "rows": [{"name": "PGDATA", "description": "\u6307\u5b9a\u6570\u636e\u5e93\u96c6\u7c07\u5e94\u5b58\u653e\u7684\u76ee\u5f55\uff1b\u53ef\u4f7f\u7528 -D \u9009\u9879\u8986\u76d6\u3002"}, {"name": "TZ", "description": "\u6307\u5b9a\u6240\u521b\u5efa\u6570\u636e\u5e93\u96c6\u7c07\u7684\u9ed8\u8ba4\u65f6\u533a\u3002\u8be5\u503c\u5e94\u4e3a\u5b8c\u6574\u7684\u65f6\u533a\u540d\u79f0\uff08\u89c1 \u7b2c 8.5.3 \u8282 \uff09\u3002"}], "title": "\u73af\u5883\u53d8\u91cf", "columns": [{"key": "name", "label": "\u53d8\u91cf"}, {"key": "description", "label": "\u542b\u4e49"}]}], "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": "https://pg.center/docs/11/app-initdb.html", "file": "app-initdb.html", "label": "11.22 English manual \u00b7 app-initdb.html", "anchor": "", "sha256": "7691fcbcb372037aa62767669c66e9650515d881e9f07ce4c2b675ee4dcee18e", "language": "en", "original_url": "/docs/11/app-initdb.html"}, {"url": "https://pg.center/docs/11/reference-server.html", "file": "reference-server.html", "label": "Server applications inventory", "anchor": "", "sha256": "e940a8505b6742c717a1683d19bf8f759aad245633a59db9e83a345ae7c5709a", "language": "en", "original_url": "/docs/11/reference-server.html"}], "sections": [], "synopsis": ["initdb [ option ...] [ --pgdata | -D ] directory"], "signature": "initdb [ option ...] [ --pgdata | -D ] directory", "description": ["initdb \u2014 \u521b\u5efa\u4e00\u4e2a\u65b0\u7684 PostgreSQL \u6570\u636e\u5e93\u96c6\u7c07"], "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 lang=\"zh\">initdb \u2014 \u521b\u5efa\u4e00\u4e2a\u65b0\u7684<span class=\"productname\">PostgreSQL</span>\u6570\u636e\u5e93\u96c6\u7c07</p>\n</div>\n<div class=\"refsynopsisdiv\">\n<h2 lang=\"zh\">\u5927\u7eb2</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 lang=\"zh\">\u8bf4\u660e</h2>\n<p lang=\"zh\"><code class=\"command\">initdb</code>\u521b\u5efa\u4e00\u4e2a\u65b0\u7684<span class=\"productname\">PostgreSQL</span>\u6570\u636e\u5e93\u96c6\u7c07\u3002\u6570\u636e\u5e93\u96c6\u7c07\u662f\u7531\u5355\u4e2a\u670d\u52a1\u5668\u5b9e\u4f8b\u7ba1\u7406\u7684\u4e00\u7ec4\u6570\u636e\u5e93\u3002</p>\n<p lang=\"zh\">\u521b\u5efa\u6570\u636e\u5e93\u96c6\u7c07\u5305\u62ec\u521b\u5efa\u7528\u4e8e\u5b58\u653e\u6570\u636e\u5e93\u6570\u636e\u7684\u76ee\u5f55\uff0c\u751f\u6210\u5171\u4eab\u7cfb\u7edf\u76ee\u5f55\u8868\uff08\u5c5e\u4e8e\u6574\u4e2a\u96c6\u7c07\u800c\u4e0d\u662f\u67d0\u4e2a\u7279\u5b9a\u6570\u636e\u5e93\u7684\u8868\uff09\uff0c\u4ee5\u53ca\u521b\u5efa<code class=\"literal\">template1</code>\u548c<code class=\"literal\">postgres</code>\u6570\u636e\u5e93\u3002\u4ee5\u540e\u521b\u5efa\u65b0\u6570\u636e\u5e93\u65f6\uff0c\u4f1a\u590d\u5236<code class=\"literal\">template1</code>\u6570\u636e\u5e93\u4e2d\u7684\u6240\u6709\u5185\u5bb9\u3002\uff08\u56e0\u6b64\uff0c\u5b89\u88c5\u5728<code class=\"literal\">template1</code>\u4e2d\u7684\u4efb\u4f55\u4e1c\u897f\u90fd\u4f1a\u81ea\u52a8\u590d\u5236\u5230\u4ee5\u540e\u521b\u5efa\u7684\u6bcf\u4e2a\u6570\u636e\u5e93\u4e2d\u3002\uff09<code class=\"literal\">postgres</code>\u6570\u636e\u5e93\u662f\u4e00\u4e2a\u9ed8\u8ba4\u6570\u636e\u5e93\uff0c\u4f9b\u7528\u6237\u3001\u5de5\u5177\u7a0b\u5e8f\u548c\u7b2c\u4e09\u65b9\u5e94\u7528\u7a0b\u5e8f\u4f7f\u7528\u3002</p>\n<p lang=\"zh\">\u867d\u7136<code class=\"command\">initdb</code>\u4f1a\u5c1d\u8bd5\u521b\u5efa\u6307\u5b9a\u7684\u6570\u636e\u76ee\u5f55\uff0c\u4f46\u5982\u679c\u6240\u9700\u6570\u636e\u76ee\u5f55\u7684\u7236\u76ee\u5f55\u5f52 root \u6240\u6709\uff0c\u5b83\u53ef\u80fd\u6ca1\u6709\u8db3\u591f\u7684\u6743\u9650\u3002\u8981\u5728\u8fd9\u79cd\u73af\u5883\u4e2d\u521d\u59cb\u5316\uff0c\u53ef\u5148\u7531 root \u521b\u5efa\u4e00\u4e2a\u7a7a\u7684\u6570\u636e\u76ee\u5f55\uff0c\u7136\u540e\u7528<code class=\"command\">chown</code>\u5c06\u8be5\u76ee\u5f55\u7684\u6240\u6709\u6743\u8d4b\u4e88\u6570\u636e\u5e93\u7528\u6237\u8d26\u6237\uff0c\u518d\u7528 <code class=\"command\">su</code>\u5207\u6362\u4e3a\u8be5\u6570\u636e\u5e93\u7528\u6237\u6765\u8fd0\u884c<code class=\"command\">initdb</code>\u3002</p>\n<p lang=\"zh\"><code class=\"command\">initdb</code>\u5fc5\u987b\u4ee5\u5c06\u62e5\u6709\u670d\u52a1\u5668\u8fdb\u7a0b\u7684\u7528\u6237\u8eab\u4efd\u8fd0\u884c\uff0c\u56e0\u4e3a\u670d\u52a1\u5668\u9700\u8981\u8bbf\u95ee <code class=\"command\">initdb</code>\u521b\u5efa\u7684\u6587\u4ef6\u548c\u76ee\u5f55\u3002\u7531\u4e8e\u670d\u52a1\u5668\u4e0d\u80fd\u4ee5 root \u8eab\u4efd\u8fd0\u884c\uff0c\u56e0\u6b64\u4e5f\u7edd\u4e0d\u80fd\u4ee5 root \u8eab\u4efd\u8fd0\u884c<code class=\"command\">initdb</code>\u3002\uff08\u5b9e\u9645\u4e0a\u5b83\u4f1a\u62d2\u7edd\u8fd9\u6837\u505a\u3002\uff09</p>\n<p lang=\"zh\">\u51fa\u4e8e\u5b89\u5168\u539f\u56e0\uff0c<code class=\"command\">initdb</code>\u521b\u5efa\u7684\u65b0\u96c6\u7c07\u9ed8\u8ba4\u53ea\u6709\u96c6\u7c07\u62e5\u6709\u8005\u53ef\u4ee5\u8bbf\u95ee\u3002<code class=\"option\">--allow-group-access</code> \u9009\u9879\u5141\u8bb8\u4e0e\u96c6\u7c07\u62e5\u6709\u8005\u540c\u7ec4\u7684\u4efb\u4f55\u7528\u6237\u8bfb\u53d6\u96c6\u7c07\u4e2d\u7684\u6587\u4ef6\u3002\u8fd9\u5bf9\u7531\u975e\u7279\u6743\u7528\u6237\u6267\u884c\u5907\u4efd\u5f88\u6709\u7528\u3002</p>\n<p lang=\"zh\"><code class=\"command\">initdb</code>\u4f1a\u521d\u59cb\u5316\u6570\u636e\u5e93\u96c6\u7c07\u7684\u9ed8\u8ba4\u533a\u57df\u8bbe\u7f6e\u548c\u5b57\u7b26\u96c6\u7f16\u7801\u3002\u5b57\u7b26\u96c6\u7f16\u7801\u3001\u6392\u5e8f\u987a\u5e8f\uff08<code class=\"literal\">LC_COLLATE</code>\uff09\u548c\u5b57\u7b26\u96c6\u5206\u7c7b\uff08<code class=\"literal\">LC_CTYPE</code>\uff0c\u4f8b\u5982\u5927\u5199\u3001\u5c0f\u5199\u3001\u6570\u5b57\uff09\u53ef\u4ee5\u5728\u521b\u5efa\u6570\u636e\u5e93\u65f6\u5355\u72ec\u8bbe\u7f6e\u3002<code class=\"command\">initdb</code>\u4e3a<code class=\"literal\">template1</code>\u6570\u636e\u5e93\u786e\u5b9a\u8fd9\u4e9b\u8bbe\u7f6e\uff0c\u5b83\u4eec\u5c06\u4f5c\u4e3a\u6240\u6709\u5176\u4ed6\u6570\u636e\u5e93\u7684\u9ed8\u8ba4\u503c\u3002</p>\n<p lang=\"zh\">\u8981\u66f4\u6539\u9ed8\u8ba4\u6392\u5e8f\u987a\u5e8f\u6216\u5b57\u7b26\u96c6\u5206\u7c7b\uff0c\u8bf7\u4f7f\u7528<code class=\"option\">--lc-collate</code>\u548c<code class=\"option\">--lc-ctype</code>\u9009\u9879\u3002\u4f7f\u7528<code class=\"literal\">C</code>\u6216<code class=\"literal\">POSIX</code>\u4e4b\u5916\u7684\u6392\u5e8f\u987a\u5e8f\u4e5f\u4f1a\u5e26\u6765\u6027\u80fd\u635f\u5931\u3002\u56e0\u6b64\uff0c\u5728\u8fd0\u884c<code class=\"command\">initdb</code>\u65f6\u9009\u62e9\u6b63\u786e\u7684\u533a\u57df\u8bbe\u7f6e\u5f88\u91cd\u8981\u3002</p>\n<p lang=\"zh\">\u5176\u4f59\u533a\u57df\u8bbe\u7f6e\u7c7b\u522b\u53ef\u4ee5\u5728\u4ee5\u540e\u542f\u52a8\u670d\u52a1\u5668\u65f6\u66f4\u6539\u3002\u8fd8\u53ef\u4ee5\u4f7f\u7528<code class=\"option\">--locale</code>\u8bbe\u7f6e\u6240\u6709\u533a\u57df\u8bbe\u7f6e\u7c7b\u522b\u7684\u9ed8\u8ba4\u503c\uff0c\u5305\u62ec\u6392\u5e8f\u987a\u5e8f\u548c\u5b57\u7b26\u96c6\u5206\u7c7b\u3002\u6240\u6709\u670d\u52a1\u5668\u533a\u57df\u8bbe\u7f6e\u503c\uff08<code class=\"literal\">lc_*</code>\uff09\u90fd\u53ef\u4ee5\u901a\u8fc7<code class=\"command\">SHOW ALL</code>\u663e\u793a\u3002\u66f4\u591a\u7ec6\u8282\u89c1<a class=\"xref\" href=\"/docs/11/charset.html#LOCALE\" title=\"23.1.\u00a0\u533a\u57df\u8bbe\u7f6e\u652f\u6301\">\u7b2c\u00a023.1\u00a0\u8282</a>\u3002</p>\n<p lang=\"zh\">\u8981\u4fee\u6539\u9ed8\u8ba4\u7f16\u7801\uff0c\u8bf7\u4f7f\u7528<code class=\"option\">--encoding</code>\u3002\u66f4\u591a\u7ec6\u8282\u89c1<a class=\"xref\" href=\"/docs/11/multibyte.html\" title=\"23.3.\u00a0\u5b57\u7b26\u96c6\u652f\u6301\">\u7b2c\u00a023.3\u00a0\u8282</a>\u3002</p>\n</div>\n<div class=\"refsect1\" id=\"id-1.9.5.3.6\">\n<h2 lang=\"zh\">\u9009\u9879</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 lang=\"zh\">\u6b64\u9009\u9879\u6307\u5b9a<code class=\"filename\">pg_hba.conf</code>\u4e2d\u672c\u5730\u7528\u6237\u4f7f\u7528\u7684\u9ed8\u8ba4\u8ba4\u8bc1\u65b9\u6cd5\uff08<code class=\"literal\">host</code>\u548c<code class=\"literal\">local</code>\u884c\uff09\u3002<code class=\"command\">initdb</code>\u4f1a\u4f7f\u7528\u6307\u5b9a\u7684\u8ba4\u8bc1\u65b9\u6cd5\uff0c\u4e3a\u975e\u590d\u5236\u8fde\u63a5\u548c\u590d\u5236\u8fde\u63a5\u9884\u5148\u586b\u5145<code class=\"filename\">pg_hba.conf</code>\u6761\u76ee\u3002</p>\n<p lang=\"zh\">\u9664\u975e\u4fe1\u4efb\u7cfb\u7edf\u4e0a\u7684\u6240\u6709\u672c\u5730\u7528\u6237\uff0c\u5426\u5219\u4e0d\u8981\u4f7f\u7528<code class=\"literal\">trust</code>\u3002\u4e3a\u4fbf\u4e8e\u5b89\u88c5\uff0c\u9ed8\u8ba4\u503c\u4e3a<code class=\"literal\">trust</code>\u3002</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 lang=\"zh\">\n<p>\u8be5\u9009\u9879\u6307\u5b9a<code class=\"filename\">pg_hba.conf</code>\u4e2d\u672c\u5730\u7528\u6237\u901a\u8fc7 TCP/IP \u8fde\u63a5\u65f6\uff08<code class=\"literal\">host</code> \u884c\uff09\u4f7f\u7528\u7684\u8ba4\u8bc1\u65b9\u6cd5\u3002</p>\n</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 lang=\"zh\">\n<p>\u8be5\u9009\u9879\u6307\u5b9a<code class=\"filename\">pg_hba.conf</code>\u4e2d\u672c\u5730\u7528\u6237\u901a\u8fc7 Unix \u57df\u5957\u63a5\u5b57\u8fde\u63a5\u65f6\uff08<code class=\"literal\">local</code> \u884c\uff09\u4f7f\u7528\u7684\u8ba4\u8bc1\u65b9\u6cd5\u3002</p>\n</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 lang=\"zh\">\n<p>\u8be5\u9009\u9879\u6307\u5b9a\u6570\u636e\u5e93\u96c6\u7c07\u5e94\u5b58\u653e\u7684\u76ee\u5f55\u3002\u8fd9\u662f<code class=\"command\">initdb</code>\u6240\u9700\u7684\u552f\u4e00\u4fe1\u606f\uff0c\u4f46\u4e5f\u53ef\u4ee5\u901a\u8fc7\u8bbe\u7f6e<code class=\"envar\">PGDATA</code>\u73af\u5883\u53d8\u91cf\u6765\u7701\u53bb\u663e\u5f0f\u5199\u51fa\u5b83\uff1b\u8fd9\u901a\u5e38\u66f4\u65b9\u4fbf\uff0c\u56e0\u4e3a\u6570\u636e\u5e93\u670d\u52a1\u5668\uff08<code class=\"command\">postgres</code>\uff09\u4e4b\u540e\u4e5f\u53ef\u4ee5\u901a\u8fc7\u540c\u4e00\u53d8\u91cf\u627e\u5230\u6570\u636e\u76ee\u5f55\u3002</p>\n</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 lang=\"zh\">\n<p>\u9009\u62e9\u6a21\u677f\u6570\u636e\u5e93\u7684\u7f16\u7801\u3002\u8fd9\u4e5f\u4f1a\u6210\u4e3a\u4ee5\u540e\u521b\u5efa\u7684\u4efb\u4f55\u6570\u636e\u5e93\u7684\u9ed8\u8ba4\u7f16\u7801\uff0c\u9664\u975e\u5728\u521b\u5efa\u65f6\u8986\u76d6\u5b83\u3002\u9ed8\u8ba4\u503c\u7531\u533a\u57df\u8bbe\u7f6e\u63a8\u5bfc\u800c\u6765\uff0c\u5982\u679c\u65e0\u6cd5\u63a8\u5bfc\uff0c\u5219\u4f7f\u7528<code class=\"literal\">SQL_ASCII</code>\u3002<span class=\"productname\">PostgreSQL</span>\u670d\u52a1\u5668\u652f\u6301\u7684\u5b57\u7b26\u96c6\u5728<a class=\"xref\" href=\"/docs/11/multibyte.html#MULTIBYTE-CHARSET-SUPPORTED\" title=\"23.3.1.\u00a0\u652f\u6301\u7684\u5b57\u7b26\u96c6\">\u7b2c\u00a023.3.1\u00a0\u8282</a>\u4e2d\u4ecb\u7ecd\u3002</p>\n</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 lang=\"zh\">\u5141\u8bb8\u4e0e\u96c6\u7fa4\u6240\u6709\u8005\u540c\u7ec4\u7684\u7528\u6237\u8bfb\u53d6 initdb \u521b\u5efa\u7684\u6240\u6709\u96c6\u7fa4\u6587\u4ef6\u3002Windows \u4e0d\u652f\u6301 POSIX \u98ce\u683c\u7684\u7ec4\u6743\u9650\uff0c\u56e0\u6b64\u4f1a\u5ffd\u7565\u6b64\u9009\u9879\u3002</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 lang=\"zh\">\n<p>\u5728\u6570\u636e\u9875\u4e0a\u4f7f\u7528\u6821\u9a8c\u548c\uff0c\u5e2e\u52a9\u68c0\u6d4b I/O \u7cfb\u7edf\u9020\u6210\u7684\u3001\u5426\u5219\u53ef\u80fd\u6084\u65e0\u58f0\u606f\u7684\u6570\u636e\u635f\u574f\u3002\u542f\u7528\u6821\u9a8c\u548c\u53ef\u80fd\u4f1a\u5e26\u6765\u660e\u663e\u7684\u6027\u80fd\u635f\u5931\u3002\u6b64\u9009\u9879\u53ea\u80fd\u5728\u521d\u59cb\u5316\u65f6\u8bbe\u7f6e\uff0c\u4ee5\u540e\u4e0d\u80fd\u66f4\u6539\u3002\u5982\u679c\u542f\u7528\uff0c\u5c31\u4f1a\u4e3a\u6240\u6709\u6570\u636e\u5e93\u4e2d\u7684\u6240\u6709\u5bf9\u8c61\u8ba1\u7b97\u6821\u9a8c\u548c\u3002</p>\n</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 lang=\"zh\">\n<p>\u8bbe\u7f6e\u6570\u636e\u5e93\u96c6\u7c07\u7684\u9ed8\u8ba4\u533a\u57df\u8bbe\u7f6e\u3002\u5982\u679c\u672a\u6307\u5b9a\u8be5\u9009\u9879\uff0c\u533a\u57df\u8bbe\u7f6e\u5c06\u7ee7\u627f\u81ea <code class=\"command\">initdb</code>\u8fd0\u884c\u65f6\u6240\u5728\u7684\u73af\u5883\u3002\u533a\u57df\u8bbe\u7f6e\u652f\u6301\u89c1<a class=\"xref\" href=\"/docs/11/charset.html#LOCALE\" title=\"23.1.\u00a0\u533a\u57df\u8bbe\u7f6e\u652f\u6301\">\u7b2c\u00a023.1\u00a0\u8282</a>\u3002</p>\n</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 lang=\"zh\">\n<p>\u7c7b\u4f3c\u4e8e<code class=\"option\">--locale</code>\uff0c\u4f46\u53ea\u5728\u6307\u5b9a\u7684\u7c7b\u522b\u4e2d\u8bbe\u7f6e\u533a\u57df\u8bbe\u7f6e\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--no-locale</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u7b49\u4ef7\u4e8e<code class=\"option\">--locale=C</code>\u3002</p>\n</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 lang=\"zh\">\n<p>\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c<code class=\"command\">initdb</code>\u4f1a\u7b49\u5f85\u6240\u6709\u6587\u4ef6\u5b89\u5168\u5199\u5165\u78c1\u76d8\u3002\u6b64\u9009\u9879\u4f7f<code class=\"command\">initdb</code>\u4e0d\u7b49\u5f85\u5c31\u8fd4\u56de\uff0c\u901f\u5ea6\u66f4\u5feb\uff0c\u4f46\u610f\u5473\u7740\u6b64\u540e\u64cd\u4f5c\u7cfb\u7edf\u5d29\u6e83\u53ef\u80fd\u4f1a\u9020\u6210\u6570\u636e\u76ee\u5f55\u635f\u574f\u3002\u901a\u5e38\uff0c\u6b64\u9009\u9879\u9002\u7528\u4e8e\u6d4b\u8bd5\uff0c\u4f46\u4e0d\u5e94\u5728\u521b\u5efa\u751f\u4ea7\u5b89\u88c5\u65f6\u4f7f\u7528\u3002</p>\n</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 lang=\"zh\">\n<p>\u4f7f<code class=\"command\">initdb</code>\u4ece\u6587\u4ef6\u4e2d\u8bfb\u53d6\u6570\u636e\u5e93\u8d85\u7ea7\u7528\u6237\u7684\u5bc6\u7801\u3002\u6587\u4ef6\u7684\u7b2c\u4e00\u884c\u4f1a\u88ab\u5f53\u4f5c\u5bc6\u7801\u3002</p>\n</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 lang=\"zh\">\n<p>\u5c06\u6240\u6709\u6570\u636e\u5e93\u6587\u4ef6\u5b89\u5168\u5199\u5165\u78c1\u76d8\uff0c\u7136\u540e\u9000\u51fa\u3002\u8fd9\u4e0d\u4f1a\u6267\u884c\u4efb\u4f55\u5e38\u89c4<span class=\"application\">initdb</span>\u64cd\u4f5c\u3002</p>\n</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 lang=\"zh\">\n<p>\u8bbe\u7f6e\u9ed8\u8ba4\u6587\u672c\u68c0\u7d22\u914d\u7f6e\u3002\u66f4\u591a\u4fe1\u606f\u89c1<a class=\"xref\" href=\"/docs/11/runtime-config-client.html#GUC-DEFAULT-TEXT-SEARCH-CONFIG\">default_text_search_config</a>\u3002</p>\n</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 lang=\"zh\">\n<p>\u9009\u62e9\u6570\u636e\u5e93\u8d85\u7ea7\u7528\u6237\u7684\u7528\u6237\u540d\u3002\u9ed8\u8ba4\u503c\u662f\u8fd0\u884c<code class=\"command\">initdb</code>\u7684\u6709\u6548\u7528\u6237\u7684\u540d\u79f0\u3002\u8d85\u7ea7\u7528\u6237\u7684\u540d\u79f0\u672c\u8eab\u5e76\u4e0d\u91cd\u8981\uff0c\u4e0d\u8fc7\u5373\u4f7f\u64cd\u4f5c\u7cfb\u7edf\u7528\u6237\u540d\u79f0\u4e0d\u540c\uff0c\u4e5f\u53ef\u4ee5\u9009\u62e9\u6cbf\u7528\u60ef\u5e38\u7684\u540d\u79f0 <span class=\"systemitem\">postgres</span>\u3002</p>\n</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 lang=\"zh\">\n<p>\u4f7f<code class=\"command\">initdb</code>\u63d0\u793a\u8f93\u5165\u8981\u8d4b\u7ed9\u6570\u636e\u5e93\u8d85\u7ea7\u7528\u6237\u7684\u5bc6\u7801\u3002\u5982\u679c\u4e0d\u6253\u7b97\u4f7f\u7528\u5bc6\u7801\u8ba4\u8bc1\uff0c\u8fd9\u4e00\u70b9\u5e76\u4e0d\u91cd\u8981\u3002\u5426\u5219\uff0c\u5728\u8bbe\u7f6e\u5bc6\u7801\u4e4b\u524d\u5c06\u65e0\u6cd5\u4f7f\u7528\u5bc6\u7801\u8ba4\u8bc1\u3002</p>\n</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 lang=\"zh\">\n<p>\u8be5\u9009\u9879\u6307\u5b9a\u9884\u5199\u5f0f\u65e5\u5fd7\uff08WAL\uff09\u5e94\u5b58\u653e\u7684\u76ee\u5f55\u3002</p>\n</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 lang=\"zh\">\u8bbe\u7f6e WAL \u6bb5\u5927\u5c0f\uff0c\u5355\u4f4d\u4e3a\u5146\u5b57\u8282\u3002\u8fd9\u662f WAL \u65e5\u5fd7\u4e2d\u6bcf\u4e2a\u72ec\u7acb\u6587\u4ef6\u7684\u5927\u5c0f\u3002\u9ed8\u8ba4\u5927\u5c0f\u4e3a 16 \u5146\u5b57\u8282\u3002\u53d6\u503c\u5fc5\u987b\u662f 1 \u5230 1024\uff08\u5146\u5b57\u8282\uff09\u4e4b\u95f4\u7684 2 \u7684\u5e42\u3002\u6b64\u9009\u9879\u53ea\u80fd\u5728\u521d\u59cb\u5316\u65f6\u8bbe\u7f6e\uff0c\u4e4b\u540e\u65e0\u6cd5\u66f4\u6539\u3002</p>\n<p lang=\"zh\">\u8c03\u6574\u8be5\u5927\u5c0f\u53ef\u80fd\u6709\u52a9\u4e8e\u63a7\u5236 WAL \u65e5\u5fd7\u4f20\u9001\u6216\u5f52\u6863\u7684\u7c92\u5ea6\u3002\u6b64\u5916\uff0c\u5728 WAL \u91cf\u5f88\u5927\u7684\u6570\u636e\u5e93\u4e2d\uff0c\u6bcf\u4e2a\u76ee\u5f55\u4e2d\u7684 WAL \u6587\u4ef6\u6570\u91cf\u53ef\u80fd\u4f1a\u6210\u4e3a\u6027\u80fd\u548c\u7ba1\u7406\u95ee\u9898\u3002\u589e\u5927 WAL \u6587\u4ef6\u5927\u5c0f\u4f1a\u51cf\u5c11 WAL \u6587\u4ef6\u6570\u91cf\u3002</p>\n</dd>\n</dl>\n</div>\n<p lang=\"zh\">\u8fd8\u53ef\u4ee5\u4f7f\u7528\u4ee5\u4e0b\u8f83\u5c11\u7528\u5230\u7684\u9009\u9879\uff1a</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 lang=\"zh\">\n<p>\u6253\u5370\u5f15\u5bfc\u540e\u7aef\u7684\u8c03\u8bd5\u8f93\u51fa\uff0c\u4ee5\u53ca\u5c11\u91cf\u666e\u901a\u7528\u6237\u901a\u5e38\u4e0d\u611f\u5174\u8da3\u7684\u5176\u4ed6\u6d88\u606f\u3002\u5f15\u5bfc\u540e\u7aef\u662f <code class=\"command\">initdb</code>\u7528\u6765\u521b\u5efa\u7cfb\u7edf\u76ee\u5f55\u8868\u7684\u7a0b\u5e8f\u3002\u8be5\u9009\u9879\u4f1a\u4ea7\u751f\u5927\u91cf\u6781\u5176\u4e4f\u5473\u7684\u8f93\u51fa\u3002</p>\n</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 lang=\"zh\">\n<p>\u6307\u5b9a<code class=\"command\">initdb</code>\u521d\u59cb\u5316\u6570\u636e\u5e93\u96c6\u7c07\u65f6\u5e94\u5230\u54ea\u91cc\u67e5\u627e\u5176\u8f93\u5165\u6587\u4ef6\u3002\u901a\u5e38\u4e0d\u9700\u8981\u8fd9\u6837\u505a\u3002\u82e5\u9700\u8981\u663e\u5f0f\u6307\u5b9a\u5176\u4f4d\u7f6e\uff0c\u7cfb\u7edf\u4f1a\u63d0\u793a\u3002</p>\n</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 lang=\"zh\">\n<p>\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c\u5982\u679c<code class=\"command\">initdb</code>\u53d1\u73b0\u67d0\u4e2a\u9519\u8bef\u4f7f\u5176\u65e0\u6cd5\u5b8c\u6574\u521b\u5efa\u6570\u636e\u5e93\u96c6\u7c07\uff0c\u5c31\u4f1a\u5220\u9664\u5b83\u5728\u53d1\u73b0\u65e0\u6cd5\u5b8c\u6210\u4efb\u52a1\u4e4b\u524d\u53ef\u80fd\u5df2\u521b\u5efa\u7684\u6240\u6709\u6587\u4ef6\u3002\u8be5\u9009\u9879\u4f1a\u7981\u6b62\u8fd9\u79cd\u6e05\u7406\uff0c\u56e0\u6b64\u5bf9\u8c03\u8bd5\u6709\u7528\u3002</p>\n</p>\n</dd>\n</dl>\n</div>\n<p lang=\"zh\">\u5176\u4ed6\u9009\u9879\uff1a</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 lang=\"zh\">\n<p>\u6253\u5370<span class=\"application\">initdb</span>\u7248\u672c\u5e76\u9000\u51fa\u3002</p>\n</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 lang=\"zh\">\n<p>\u663e\u793a\u6709\u5173<span class=\"application\">initdb</span>\u547d\u4ee4\u884c\u53c2\u6570\u7684\u5e2e\u52a9\u5e76\u9000\u51fa\u3002</p>\n</p>\n</dd>\n</dl>\n</div>\n</div>\n<div class=\"refsect1\" id=\"id-1.9.5.3.7\">\n<h2 lang=\"zh\">\u73af\u5883</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 lang=\"zh\">\n<p>\u6307\u5b9a\u6570\u636e\u5e93\u96c6\u7c07\u5e94\u5b58\u653e\u7684\u76ee\u5f55\uff1b\u53ef\u4f7f\u7528<code class=\"option\">-D</code>\u9009\u9879\u8986\u76d6\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"envar\">TZ</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6307\u5b9a\u6240\u521b\u5efa\u6570\u636e\u5e93\u96c6\u7c07\u7684\u9ed8\u8ba4\u65f6\u533a\u3002\u8be5\u503c\u5e94\u4e3a\u5b8c\u6574\u7684\u65f6\u533a\u540d\u79f0\uff08\u89c1<a class=\"xref\" href=\"/docs/11/datatype-datetime.html#DATATYPE-TIMEZONES\" title=\"8.5.3.\u00a0\u65f6\u533a\">\u7b2c\u00a08.5.3\u00a0\u8282</a>\uff09\u3002</p>\n</p>\n</dd>\n</dl>\n</div>\n<p lang=\"zh\">\u4e0e\u5927\u591a\u6570\u5176\u4ed6<span class=\"productname\">PostgreSQL</span>\u5de5\u5177\u7a0b\u5e8f\u4e00\u6837\uff0c\u6b64\u5de5\u5177\u4e5f\u4f7f\u7528<span class=\"application\">libpq</span>\u652f\u6301\u7684\u73af\u5883\u53d8\u91cf\uff08\u53c2\u89c1<a class=\"xref\" href=\"/docs/11/libpq-envars.html\" title=\"34.14.\u00a0\u73af\u5883\u53d8\u91cf\">\u7b2c\u00a034.14\u00a0\u8282</a>\uff09\u3002</p>\n</div>\n<div class=\"refsect1\" id=\"id-1.9.5.3.8\">\n<h2 lang=\"zh\">\u6ce8\u89e3</h2>\n<p lang=\"zh\">\u4e5f\u53ef\u4ee5\u901a\u8fc7 pg_ctl initdb \u8c03\u7528 initdb\u3002</p>\n</div>\n<div class=\"refsect1\" id=\"id-1.9.5.3.9\">\n<h2 lang=\"zh\">\u53e6\u89c1</h2><span class=\"simplelist\"><a class=\"xref\" href=\"https://pg.center/docs/11/app-pg-ctl.html\" title=\"pg_ctl\"><span class=\"refentrytitle\"><span class=\"application\">pg_ctl</span></span></a>, <a class=\"xref\" href=\"https://pg.center/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", "localization": {"status": "complete", "sources": [{"url": "/docs/11/app-initdb.html", "method": "same-major semantic node", "sha256": "57373c9b63087544d2b266b064333b5582a474f67544abdfd0ebf6bf9564eb6a", "language": "zh", "matched_nodes": ["#APP-INITDB/div[2]/p[1]", "#APP-INITDB/div[3]/h2[0]", "#APP-INITDB/div[4]/p[1]", "#APP-INITDB/div[4]/p[2]", "#APP-INITDB/div[4]/p[3]", "#APP-INITDB/div[4]/p[4]", "#APP-INITDB/div[4]/p[5]", "#APP-INITDB/div[4]/p[6]", "#APP-INITDB/div[4]/p[7]", "#APP-INITDB/div[4]/p[8]", "#APP-INITDB/div[4]/p[9]", "#APP-INITDB/div[5]/div[1]/dl[0]/dd[11]", "#APP-INITDB/div[5]/div[1]/dl[0]/dd[13]", "#APP-INITDB/div[5]/div[1]/dl[0]/dd[15]", "#APP-INITDB/div[5]/div[1]/dl[0]/dd[17]", "#APP-INITDB/div[5]/div[1]/dl[0]/dd[19]", "#APP-INITDB/div[5]/div[1]/dl[0]/dd[1]/p[0]", "#APP-INITDB/div[5]/div[1]/dl[0]/dd[1]/p[1]", "#APP-INITDB/div[5]/div[1]/dl[0]/dd[21]", "#APP-INITDB/div[5]/div[1]/dl[0]/dd[23]", "#APP-INITDB/div[5]/div[1]/dl[0]/dd[25]", "#APP-INITDB/div[5]/div[1]/dl[0]/dd[27]", "#APP-INITDB/div[5]/div[1]/dl[0]/dd[29]", "#APP-INITDB/div[5]/div[1]/dl[0]/dd[31]", "#APP-INITDB/div[5]/div[1]/dl[0]/dd[33]", "#APP-INITDB/div[5]/div[1]/dl[0]/dd[35]/p[1]", "#APP-INITDB/div[5]/div[1]/dl[0]/dd[3]", "#APP-INITDB/div[5]/div[1]/dl[0]/dd[5]", "#APP-INITDB/div[5]/div[1]/dl[0]/dd[7]", "#APP-INITDB/div[5]/div[1]/dl[0]/dd[9]", "#APP-INITDB/div[5]/div[3]/dl[0]/dd[1]", "#APP-INITDB/div[5]/div[3]/dl[0]/dd[3]", "#APP-INITDB/div[5]/div[3]/dl[0]/dd[5]", "#APP-INITDB/div[5]/div[5]/dl[0]/dd[1]", "#APP-INITDB/div[5]/div[5]/dl[0]/dd[3]", "#APP-INITDB/div[5]/p[2]", "#APP-INITDB/div[5]/p[4]", "#APP-INITDB/div[6]/div[1]/dl[0]/dd[1]", "#APP-INITDB/div[6]/div[1]/dl[0]/dd[3]", "#APP-INITDB/div[6]/h2[0]", "#APP-INITDB/div[6]/p[2]", "#APP-INITDB/div[7]/h2[0]", "#APP-INITDB/div[8]/h2[0]"]}], "language": "zh", "original_text": {"/versions/11/description/0": "initdb \u2014 create a new PostgreSQL database cluster", "/versions/11/facts/0/label": "Documented executable", "/versions/11/facts/1/label": "Executable version", "/versions/11/facts/2/label": "Reference inventory", "/versions/11/facts/2/value": "Server applications", "/versions/11/facts/3/label": "Option definition groups", "/versions/11/tables/0/title": "Documented options", "/versions/11/tables/1/title": "Environment variables", "/versions/11/tables/0/rows/0/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.", "/versions/11/tables/0/rows/1/summary": "This option specifies the authentication method for local users via TCP/IP connections used in pg_hba.conf ( host lines).", "/versions/11/tables/0/rows/2/summary": "This option specifies the authentication method for local users via Unix-domain socket connections used in pg_hba.conf ( local lines).", "/versions/11/tables/0/rows/3/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.", "/versions/11/tables/0/rows/4/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 .", "/versions/11/tables/0/rows/5/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.", "/versions/11/tables/0/rows/6/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.", "/versions/11/tables/0/rows/7/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 .", "/versions/11/tables/0/rows/8/summary": "Like --locale , but only sets the locale in the specified category.", "/versions/11/tables/0/rows/9/summary": "Equivalent to --locale=C .", "/versions/11/tables/0/columns/0/label": "Option and arguments", "/versions/11/tables/0/columns/1/label": "Description", "/versions/11/tables/0/rows/10/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.", "/versions/11/tables/0/rows/11/summary": "Makes initdb read the database superuser's password from a file. The first line of the file is taken as the password.", "/versions/11/tables/0/rows/12/summary": "Safely write all database files to disk and exit. This does not perform any of the normal initdb operations.", "/versions/11/tables/0/rows/13/summary": "Sets the default text search configuration. See default_text_search_config for further information.", "/versions/11/tables/0/rows/14/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.", "/versions/11/tables/0/rows/15/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.", "/versions/11/tables/0/rows/16/summary": "This option specifies the directory where the write-ahead log should be stored.", "/versions/11/tables/0/rows/17/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.", "/versions/11/tables/0/rows/18/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.", "/versions/11/tables/0/rows/19/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.", "/versions/11/tables/0/rows/20/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.", "/versions/11/tables/0/rows/21/summary": "Print the initdb version and exit.", "/versions/11/tables/0/rows/22/summary": "Show help about initdb command line arguments, and exit.", "/versions/11/tables/1/columns/0/label": "Variable", "/versions/11/tables/1/columns/1/label": "Meaning", "/versions/11/tables/1/rows/0/description": "Specifies the directory where the database cluster is to be stored; can be overridden using the -D option.", "/versions/11/tables/1/rows/1/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 )."}, "fallback_fields": [], "source_language": "en", "original_snapshot_sha256": "ebbdea4e2c23f1fefb6728e697b2bc89f153177d8ddae1edb06f0252e2a7688e"}, "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", "manual_language": "zh"}, "12": {"facts": [{"label": "\u624b\u518c\u4e2d\u7684\u53ef\u6267\u884c\u7a0b\u5e8f", "value": "initdb"}, {"label": "\u7a0b\u5e8f\u7248\u672c", "value": "12.22"}, {"label": "\u53c2\u8003\u6e05\u5355", "value": "\u670d\u52a1\u7aef\u7a0b\u5e8f"}, {"label": "\u9009\u9879\u5b9a\u4e49\u7ec4", "value": "23"}], "tables": [{"key": "options", "rows": [{"summary": "\u6b64\u9009\u9879\u6307\u5b9a pg_hba.conf \u4e2d\u672c\u5730\u7528\u6237\u4f7f\u7528\u7684\u9ed8\u8ba4\u8ba4\u8bc1\u65b9\u6cd5\uff08 host \u548c local \u884c\uff09\u3002 initdb \u4f1a\u4f7f\u7528\u6307\u5b9a\u7684\u8ba4\u8bc1\u65b9\u6cd5\uff0c\u4e3a\u975e\u590d\u5236\u8fde\u63a5\u548c\u590d\u5236\u8fde\u63a5\u9884\u5148\u586b\u5145 pg_hba.conf \u6761\u76ee\u3002", "signature": {"url": "/docs/12/app-initdb.html", "text": "-A authmethod --auth= authmethod"}}, {"summary": "\u8be5\u9009\u9879\u6307\u5b9a pg_hba.conf \u4e2d\u672c\u5730\u7528\u6237\u901a\u8fc7 TCP/IP \u8fde\u63a5\u65f6\uff08 host \u884c\uff09\u4f7f\u7528\u7684\u8ba4\u8bc1\u65b9\u6cd5\u3002", "signature": {"url": "/docs/12/app-initdb.html", "text": "--auth-host= authmethod"}}, {"summary": "\u8be5\u9009\u9879\u6307\u5b9a pg_hba.conf \u4e2d\u672c\u5730\u7528\u6237\u901a\u8fc7 Unix \u57df\u5957\u63a5\u5b57\u8fde\u63a5\u65f6\uff08 local \u884c\uff09\u4f7f\u7528\u7684\u8ba4\u8bc1\u65b9\u6cd5\u3002", "signature": {"url": "/docs/12/app-initdb.html", "text": "--auth-local= authmethod"}}, {"summary": "\u8be5\u9009\u9879\u6307\u5b9a\u6570\u636e\u5e93\u96c6\u7c07\u5e94\u5b58\u653e\u7684\u76ee\u5f55\u3002\u8fd9\u662f initdb \u6240\u9700\u7684\u552f\u4e00\u4fe1\u606f\uff0c\u4f46\u4e5f\u53ef\u4ee5\u901a\u8fc7\u8bbe\u7f6e PGDATA \u73af\u5883\u53d8\u91cf\u6765\u7701\u53bb\u663e\u5f0f\u5199\u51fa\u5b83\uff1b\u8fd9\u901a\u5e38\u66f4\u65b9\u4fbf\uff0c\u56e0\u4e3a\u6570\u636e\u5e93\u670d\u52a1\u5668\uff08 postgres \uff09\u4e4b\u540e\u4e5f\u53ef\u4ee5\u901a\u8fc7\u540c\u4e00\u53d8\u91cf\u627e\u5230\u6570\u636e\u76ee\u5f55\u3002", "signature": {"url": "/docs/12/app-initdb.html", "text": "-D directory --pgdata= directory"}}, {"summary": "\u9009\u62e9\u6a21\u677f\u6570\u636e\u5e93\u7684\u7f16\u7801\u3002\u8fd9\u4e5f\u4f1a\u6210\u4e3a\u4ee5\u540e\u521b\u5efa\u7684\u4efb\u4f55\u6570\u636e\u5e93\u7684\u9ed8\u8ba4\u7f16\u7801\uff0c\u9664\u975e\u5728\u521b\u5efa\u65f6\u8986\u76d6\u5b83\u3002\u9ed8\u8ba4\u503c\u7531\u533a\u57df\u8bbe\u7f6e\u63a8\u5bfc\u800c\u6765\uff0c\u5982\u679c\u65e0\u6cd5\u63a8\u5bfc\uff0c\u5219\u4f7f\u7528 SQL_ASCII \u3002 PostgreSQL \u670d\u52a1\u5668\u652f\u6301\u7684\u5b57\u7b26\u96c6\u5728 \u7b2c 23.3.1 \u8282 \u4e2d\u4ecb\u7ecd\u3002", "signature": {"url": "/docs/12/app-initdb.html", "text": "-E encoding --encoding= encoding"}}, {"summary": "\u5141\u8bb8\u4e0e\u96c6\u7c07\u62e5\u6709\u8005\u540c\u7ec4\u7684\u7528\u6237\u8bfb\u53d6\u7531 initdb \u521b\u5efa\u7684\u6240\u6709\u96c6\u7c07\u6587\u4ef6\u3002\u8be5\u9009\u9879\u5728 Windows \u4e0a\u4f1a\u88ab\u5ffd\u7565\uff0c\u56e0\u4e3a\u5b83\u4e0d\u652f\u6301 POSIX \u98ce\u683c\u7684\u7ec4\u6743\u9650\u3002", "signature": {"url": "/docs/12/app-initdb.html#APP-INITDB-ALLOW-GROUP-ACCESS", "text": "-g --allow-group-access"}}, {"summary": "\u5728\u6570\u636e\u9875\u4e0a\u4f7f\u7528\u6821\u9a8c\u548c\uff0c\u5e2e\u52a9\u68c0\u6d4b I/O \u7cfb\u7edf\u9020\u6210\u7684\u3001\u5426\u5219\u53ef\u80fd\u6084\u65e0\u58f0\u606f\u7684\u6570\u636e\u635f\u574f\u3002\u542f\u7528\u6821\u9a8c\u548c\u53ef\u80fd\u4f1a\u5e26\u6765\u660e\u663e\u7684\u6027\u80fd\u635f\u5931\u3002\u5982\u679c\u542f\u7528\uff0c\u5c31\u4f1a\u4e3a\u6240\u6709\u6570\u636e\u5e93\u4e2d\u7684\u6240\u6709\u5bf9\u8c61\u8ba1\u7b97\u6821\u9a8c\u548c\u3002\u6240\u6709\u6821\u9a8c\u548c\u5931\u8d25\u90fd\u4f1a\u5728 pg_stat_database \u89c6\u56fe\u4e2d\u62a5\u544a\u3002", "signature": {"url": "/docs/12/app-initdb.html#APP-INITDB-DATA-CHECKSUMS", "text": "-k --data-checksums"}}, {"summary": "\u8bbe\u7f6e\u6570\u636e\u5e93\u96c6\u7c07\u7684\u9ed8\u8ba4\u533a\u57df\u8bbe\u7f6e\u3002\u5982\u679c\u672a\u6307\u5b9a\u8be5\u9009\u9879\uff0c\u533a\u57df\u8bbe\u7f6e\u5c06\u7ee7\u627f\u81ea initdb \u8fd0\u884c\u65f6\u6240\u5728\u7684\u73af\u5883\u3002\u533a\u57df\u8bbe\u7f6e\u652f\u6301\u89c1 \u7b2c 23.1 \u8282 \u3002", "signature": {"url": "/docs/12/app-initdb.html", "text": "--locale= locale"}}, {"summary": "\u7c7b\u4f3c\u4e8e --locale \uff0c\u4f46\u53ea\u5728\u6307\u5b9a\u7684\u7c7b\u522b\u4e2d\u8bbe\u7f6e\u533a\u57df\u8bbe\u7f6e\u3002", "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": "\u7b49\u4ef7\u4e8e --locale=C \u3002", "signature": {"url": "/docs/12/app-initdb.html", "text": "--no-locale"}}, {"summary": "\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c initdb \u4f1a\u7b49\u5f85\u6240\u6709\u6587\u4ef6\u5b89\u5168\u5199\u5165\u78c1\u76d8\u3002\u6b64\u9009\u9879\u4f7f initdb \u4e0d\u7b49\u5f85\u5c31\u8fd4\u56de\uff0c\u901f\u5ea6\u66f4\u5feb\uff0c\u4f46\u610f\u5473\u7740\u6b64\u540e\u64cd\u4f5c\u7cfb\u7edf\u5d29\u6e83\u53ef\u80fd\u4f1a\u9020\u6210\u6570\u636e\u76ee\u5f55\u635f\u574f\u3002\u901a\u5e38\uff0c\u6b64\u9009\u9879\u9002\u7528\u4e8e\u6d4b\u8bd5\uff0c\u4f46\u4e0d\u5e94\u5728\u521b\u5efa\u751f\u4ea7\u5b89\u88c5\u65f6\u4f7f\u7528\u3002", "signature": {"url": "/docs/12/app-initdb.html", "text": "-N --no-sync"}}, {"summary": "\u4f7f initdb \u4ece\u6587\u4ef6\u4e2d\u8bfb\u53d6\u6570\u636e\u5e93\u8d85\u7ea7\u7528\u6237\u7684\u5bc6\u7801\u3002\u6587\u4ef6\u7684\u7b2c\u4e00\u884c\u4f1a\u88ab\u5f53\u4f5c\u5bc6\u7801\u3002", "signature": {"url": "/docs/12/app-initdb.html", "text": "--pwfile= filename"}}, {"summary": "\u5c06\u6240\u6709\u6570\u636e\u5e93\u6587\u4ef6\u5b89\u5168\u5199\u5165\u78c1\u76d8\uff0c\u7136\u540e\u9000\u51fa\u3002\u8fd9\u4e0d\u4f1a\u6267\u884c\u4efb\u4f55\u5e38\u89c4 initdb \u64cd\u4f5c\u3002", "signature": {"url": "/docs/12/app-initdb.html", "text": "-S --sync-only"}}, {"summary": "\u8bbe\u7f6e\u9ed8\u8ba4\u6587\u672c\u68c0\u7d22\u914d\u7f6e\u3002\u66f4\u591a\u4fe1\u606f\u89c1 default_text_search_config \u3002", "signature": {"url": "/docs/12/app-initdb.html", "text": "-T config --text-search-config= config"}}, {"summary": "\u9009\u62e9\u6570\u636e\u5e93\u8d85\u7ea7\u7528\u6237\u7684\u7528\u6237\u540d\u3002\u9ed8\u8ba4\u503c\u662f\u8fd0\u884c initdb \u7684\u6709\u6548\u7528\u6237\u7684\u540d\u79f0\u3002\u8d85\u7ea7\u7528\u6237\u7684\u540d\u79f0\u672c\u8eab\u5e76\u4e0d\u91cd\u8981\uff0c\u4e0d\u8fc7\u5373\u4f7f\u64cd\u4f5c\u7cfb\u7edf\u7528\u6237\u540d\u79f0\u4e0d\u540c\uff0c\u4e5f\u53ef\u4ee5\u9009\u62e9\u6cbf\u7528\u60ef\u5e38\u7684\u540d\u79f0 postgres \u3002", "signature": {"url": "/docs/12/app-initdb.html", "text": "-U username --username= username"}}, {"summary": "\u4f7f initdb \u63d0\u793a\u8f93\u5165\u8981\u8d4b\u7ed9\u6570\u636e\u5e93\u8d85\u7ea7\u7528\u6237\u7684\u5bc6\u7801\u3002\u5982\u679c\u4e0d\u6253\u7b97\u4f7f\u7528\u5bc6\u7801\u8ba4\u8bc1\uff0c\u8fd9\u4e00\u70b9\u5e76\u4e0d\u91cd\u8981\u3002\u5426\u5219\uff0c\u5728\u8bbe\u7f6e\u5bc6\u7801\u4e4b\u524d\u5c06\u65e0\u6cd5\u4f7f\u7528\u5bc6\u7801\u8ba4\u8bc1\u3002", "signature": {"url": "/docs/12/app-initdb.html", "text": "-W --pwprompt"}}, {"summary": "\u8be5\u9009\u9879\u6307\u5b9a\u9884\u5199\u5f0f\u65e5\u5fd7\uff08WAL\uff09\u5e94\u5b58\u653e\u7684\u76ee\u5f55\u3002", "signature": {"url": "/docs/12/app-initdb.html", "text": "-X directory --waldir= directory"}}, {"summary": "\u8bbe\u7f6e WAL \u6bb5\u5927\u5c0f\uff0c\u5355\u4f4d\u4e3a\u5146\u5b57\u8282\u3002\u8fd9\u662f WAL \u65e5\u5fd7\u4e2d\u6bcf\u4e2a\u72ec\u7acb\u6587\u4ef6\u7684\u5927\u5c0f\u3002\u9ed8\u8ba4\u5927\u5c0f\u4e3a 16 \u5146\u5b57\u8282\u3002\u53d6\u503c\u5fc5\u987b\u662f 1 \u5230 1024\uff08\u5146\u5b57\u8282\uff09\u4e4b\u95f4\u7684 2 \u7684\u5e42\u3002\u6b64\u9009\u9879\u53ea\u80fd\u5728\u521d\u59cb\u5316\u65f6\u8bbe\u7f6e\uff0c\u4e4b\u540e\u65e0\u6cd5\u66f4\u6539\u3002", "signature": {"url": "/docs/12/app-initdb.html", "text": "--wal-segsize= size"}}, {"summary": "\u6253\u5370\u5f15\u5bfc\u540e\u7aef\u7684\u8c03\u8bd5\u8f93\u51fa\uff0c\u4ee5\u53ca\u5c11\u91cf\u666e\u901a\u7528\u6237\u901a\u5e38\u4e0d\u611f\u5174\u8da3\u7684\u5176\u4ed6\u6d88\u606f\u3002\u5f15\u5bfc\u540e\u7aef\u662f initdb \u7528\u6765\u521b\u5efa\u7cfb\u7edf\u76ee\u5f55\u8868\u7684\u7a0b\u5e8f\u3002\u8be5\u9009\u9879\u4f1a\u4ea7\u751f\u5927\u91cf\u6781\u5176\u4e4f\u5473\u7684\u8f93\u51fa\u3002", "signature": {"url": "/docs/12/app-initdb.html", "text": "-d --debug"}}, {"summary": "\u6307\u5b9a initdb \u521d\u59cb\u5316\u6570\u636e\u5e93\u96c6\u7c07\u65f6\u5e94\u5230\u54ea\u91cc\u67e5\u627e\u5176\u8f93\u5165\u6587\u4ef6\u3002\u901a\u5e38\u4e0d\u9700\u8981\u8fd9\u6837\u505a\u3002\u82e5\u9700\u8981\u663e\u5f0f\u6307\u5b9a\u5176\u4f4d\u7f6e\uff0c\u7cfb\u7edf\u4f1a\u63d0\u793a\u3002", "signature": {"url": "/docs/12/app-initdb.html", "text": "-L directory"}}, {"summary": "\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c\u5982\u679c initdb \u53d1\u73b0\u67d0\u4e2a\u9519\u8bef\u4f7f\u5176\u65e0\u6cd5\u5b8c\u6574\u521b\u5efa\u6570\u636e\u5e93\u96c6\u7c07\uff0c\u5c31\u4f1a\u5220\u9664\u5b83\u5728\u53d1\u73b0\u65e0\u6cd5\u5b8c\u6210\u4efb\u52a1\u4e4b\u524d\u53ef\u80fd\u5df2\u521b\u5efa\u7684\u6240\u6709\u6587\u4ef6\u3002\u8be5\u9009\u9879\u4f1a\u7981\u6b62\u8fd9\u79cd\u6e05\u7406\uff0c\u56e0\u6b64\u5bf9\u8c03\u8bd5\u6709\u7528\u3002", "signature": {"url": "/docs/12/app-initdb.html", "text": "-n --no-clean"}}, {"summary": "\u6253\u5370 initdb \u7248\u672c\u5e76\u9000\u51fa\u3002", "signature": {"url": "/docs/12/app-initdb.html", "text": "-V --version"}}, {"summary": "\u663e\u793a\u6709\u5173 initdb \u547d\u4ee4\u884c\u53c2\u6570\u7684\u5e2e\u52a9\u5e76\u9000\u51fa\u3002", "signature": {"url": "/docs/12/app-initdb.html", "text": "-? --help"}}], "title": "\u624b\u518c\u4e2d\u7684\u9009\u9879", "columns": [{"key": "signature", "label": "\u9009\u9879\u4e0e\u53c2\u6570"}, {"key": "summary", "label": "\u8bf4\u660e"}]}, {"key": "environment", "rows": [{"name": "PGDATA", "description": "\u6307\u5b9a\u6570\u636e\u5e93\u96c6\u7c07\u5e94\u5b58\u653e\u7684\u76ee\u5f55\uff1b\u53ef\u4f7f\u7528 -D \u9009\u9879\u8986\u76d6\u3002"}, {"name": "PG_COLOR", "description": "\u6307\u5b9a\u662f\u5426\u5728\u8bca\u65ad\u6d88\u606f\u4e2d\u4f7f\u7528\u989c\u8272\u3002\u53ef\u80fd\u7684\u503c\u4e3a always \u3001 auto \u548c never \u3002"}, {"name": "TZ", "description": "\u6307\u5b9a\u6240\u521b\u5efa\u6570\u636e\u5e93\u96c6\u7c07\u7684\u9ed8\u8ba4\u65f6\u533a\u3002\u8be5\u503c\u5e94\u4e3a\u5b8c\u6574\u7684\u65f6\u533a\u540d\u79f0\uff08\u89c1 \u7b2c 8.5.3 \u8282 \uff09\u3002"}], "title": "\u73af\u5883\u53d8\u91cf", "columns": [{"key": "name", "label": "\u53d8\u91cf"}, {"key": "description", "label": "\u542b\u4e49"}]}], "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": "https://pg.center/docs/12/app-initdb.html", "file": "app-initdb.html", "label": "12.22 English manual \u00b7 app-initdb.html", "anchor": "", "sha256": "41958064734e64d5ed7faa266fcb184cd2813b1776f1c4e8901a022cabdc5869", "language": "en", "original_url": "/docs/12/app-initdb.html"}, {"url": "https://pg.center/docs/12/reference-server.html", "file": "reference-server.html", "label": "Server applications inventory", "anchor": "", "sha256": "7f6ae1fadc1b0bffa606551460e62aacdc2508a3fb66566ddae861928ca6080b", "language": "en", "original_url": "/docs/12/reference-server.html"}], "sections": [], "synopsis": ["initdb [ option ...] [ --pgdata | -D ] directory"], "signature": "initdb [ option ...] [ --pgdata | -D ] directory", "description": ["initdb \u2014 \u521b\u5efa\u4e00\u4e2a\u65b0\u7684 PostgreSQL \u6570\u636e\u5e93\u96c6\u7c07"], "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 lang=\"zh\">initdb \u2014 \u521b\u5efa\u4e00\u4e2a\u65b0\u7684<span class=\"productname\">PostgreSQL</span>\u6570\u636e\u5e93\u96c6\u7c07</p>\n</div>\n<div class=\"refsynopsisdiv\">\n<h2 lang=\"zh\">\u5927\u7eb2</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 lang=\"zh\">\u8bf4\u660e</h2>\n<p lang=\"zh\"><code class=\"command\">initdb</code>\u521b\u5efa\u4e00\u4e2a\u65b0\u7684<span class=\"productname\">PostgreSQL</span>\u6570\u636e\u5e93\u96c6\u7c07\u3002\u6570\u636e\u5e93\u96c6\u7c07\u662f\u7531\u5355\u4e2a\u670d\u52a1\u5668\u5b9e\u4f8b\u7ba1\u7406\u7684\u4e00\u7ec4\u6570\u636e\u5e93\u3002</p>\n<p lang=\"zh\">\u521b\u5efa\u6570\u636e\u5e93\u96c6\u7c07\u5305\u62ec\u521b\u5efa\u7528\u4e8e\u5b58\u653e\u6570\u636e\u5e93\u6570\u636e\u7684\u76ee\u5f55\uff0c\u751f\u6210\u5171\u4eab\u7cfb\u7edf\u76ee\u5f55\u8868\uff08\u5c5e\u4e8e\u6574\u4e2a\u96c6\u7c07\u800c\u4e0d\u662f\u67d0\u4e2a\u7279\u5b9a\u6570\u636e\u5e93\u7684\u8868\uff09\uff0c\u4ee5\u53ca\u521b\u5efa<code class=\"literal\">template1</code>\u548c<code class=\"literal\">postgres</code>\u6570\u636e\u5e93\u3002\u4ee5\u540e\u521b\u5efa\u65b0\u6570\u636e\u5e93\u65f6\uff0c\u4f1a\u590d\u5236<code class=\"literal\">template1</code>\u6570\u636e\u5e93\u4e2d\u7684\u6240\u6709\u5185\u5bb9\u3002\uff08\u56e0\u6b64\uff0c\u5b89\u88c5\u5728<code class=\"literal\">template1</code>\u4e2d\u7684\u4efb\u4f55\u4e1c\u897f\u90fd\u4f1a\u81ea\u52a8\u590d\u5236\u5230\u4ee5\u540e\u521b\u5efa\u7684\u6bcf\u4e2a\u6570\u636e\u5e93\u4e2d\u3002\uff09<code class=\"literal\">postgres</code>\u6570\u636e\u5e93\u662f\u4e00\u4e2a\u9ed8\u8ba4\u6570\u636e\u5e93\uff0c\u4f9b\u7528\u6237\u3001\u5de5\u5177\u7a0b\u5e8f\u548c\u7b2c\u4e09\u65b9\u5e94\u7528\u7a0b\u5e8f\u4f7f\u7528\u3002</p>\n<p lang=\"zh\">\u867d\u7136<code class=\"command\">initdb</code>\u4f1a\u5c1d\u8bd5\u521b\u5efa\u6307\u5b9a\u7684\u6570\u636e\u76ee\u5f55\uff0c\u4f46\u5982\u679c\u6240\u9700\u6570\u636e\u76ee\u5f55\u7684\u7236\u76ee\u5f55\u5f52 root \u6240\u6709\uff0c\u5b83\u53ef\u80fd\u6ca1\u6709\u8db3\u591f\u7684\u6743\u9650\u3002\u8981\u5728\u8fd9\u79cd\u73af\u5883\u4e2d\u521d\u59cb\u5316\uff0c\u53ef\u5148\u7531 root \u521b\u5efa\u4e00\u4e2a\u7a7a\u7684\u6570\u636e\u76ee\u5f55\uff0c\u7136\u540e\u7528<code class=\"command\">chown</code>\u5c06\u8be5\u76ee\u5f55\u7684\u6240\u6709\u6743\u8d4b\u4e88\u6570\u636e\u5e93\u7528\u6237\u8d26\u6237\uff0c\u518d\u7528 <code class=\"command\">su</code>\u5207\u6362\u4e3a\u8be5\u6570\u636e\u5e93\u7528\u6237\u6765\u8fd0\u884c<code class=\"command\">initdb</code>\u3002</p>\n<p lang=\"zh\"><code class=\"command\">initdb</code>\u5fc5\u987b\u4ee5\u5c06\u62e5\u6709\u670d\u52a1\u5668\u8fdb\u7a0b\u7684\u7528\u6237\u8eab\u4efd\u8fd0\u884c\uff0c\u56e0\u4e3a\u670d\u52a1\u5668\u9700\u8981\u8bbf\u95ee <code class=\"command\">initdb</code>\u521b\u5efa\u7684\u6587\u4ef6\u548c\u76ee\u5f55\u3002\u7531\u4e8e\u670d\u52a1\u5668\u4e0d\u80fd\u4ee5 root \u8eab\u4efd\u8fd0\u884c\uff0c\u56e0\u6b64\u4e5f\u7edd\u4e0d\u80fd\u4ee5 root \u8eab\u4efd\u8fd0\u884c<code class=\"command\">initdb</code>\u3002\uff08\u5b9e\u9645\u4e0a\u5b83\u4f1a\u62d2\u7edd\u8fd9\u6837\u505a\u3002\uff09</p>\n<p lang=\"zh\">\u51fa\u4e8e\u5b89\u5168\u539f\u56e0\uff0c<code class=\"command\">initdb</code>\u521b\u5efa\u7684\u65b0\u96c6\u7c07\u9ed8\u8ba4\u53ea\u6709\u96c6\u7c07\u62e5\u6709\u8005\u53ef\u4ee5\u8bbf\u95ee\u3002<code class=\"option\">--allow-group-access</code> \u9009\u9879\u5141\u8bb8\u4e0e\u96c6\u7c07\u62e5\u6709\u8005\u540c\u7ec4\u7684\u4efb\u4f55\u7528\u6237\u8bfb\u53d6\u96c6\u7c07\u4e2d\u7684\u6587\u4ef6\u3002\u8fd9\u5bf9\u7531\u975e\u7279\u6743\u7528\u6237\u6267\u884c\u5907\u4efd\u5f88\u6709\u7528\u3002</p>\n<p lang=\"zh\"><code class=\"command\">initdb</code>\u4f1a\u521d\u59cb\u5316\u6570\u636e\u5e93\u96c6\u7c07\u7684\u9ed8\u8ba4\u533a\u57df\u8bbe\u7f6e\u548c\u5b57\u7b26\u96c6\u7f16\u7801\u3002\u5b57\u7b26\u96c6\u7f16\u7801\u3001\u6392\u5e8f\u987a\u5e8f\uff08<code class=\"literal\">LC_COLLATE</code>\uff09\u548c\u5b57\u7b26\u96c6\u5206\u7c7b\uff08<code class=\"literal\">LC_CTYPE</code>\uff0c\u4f8b\u5982\u5927\u5199\u3001\u5c0f\u5199\u3001\u6570\u5b57\uff09\u53ef\u4ee5\u5728\u521b\u5efa\u6570\u636e\u5e93\u65f6\u5355\u72ec\u8bbe\u7f6e\u3002<code class=\"command\">initdb</code>\u4e3a<code class=\"literal\">template1</code>\u6570\u636e\u5e93\u786e\u5b9a\u8fd9\u4e9b\u8bbe\u7f6e\uff0c\u5b83\u4eec\u5c06\u4f5c\u4e3a\u6240\u6709\u5176\u4ed6\u6570\u636e\u5e93\u7684\u9ed8\u8ba4\u503c\u3002</p>\n<p lang=\"zh\">\u8981\u66f4\u6539\u9ed8\u8ba4\u6392\u5e8f\u987a\u5e8f\u6216\u5b57\u7b26\u96c6\u5206\u7c7b\uff0c\u8bf7\u4f7f\u7528<code class=\"option\">--lc-collate</code>\u548c<code class=\"option\">--lc-ctype</code>\u9009\u9879\u3002\u4f7f\u7528<code class=\"literal\">C</code>\u6216<code class=\"literal\">POSIX</code>\u4e4b\u5916\u7684\u6392\u5e8f\u987a\u5e8f\u4e5f\u4f1a\u5e26\u6765\u6027\u80fd\u635f\u5931\u3002\u56e0\u6b64\uff0c\u5728\u8fd0\u884c<code class=\"command\">initdb</code>\u65f6\u9009\u62e9\u6b63\u786e\u7684\u533a\u57df\u8bbe\u7f6e\u5f88\u91cd\u8981\u3002</p>\n<p lang=\"zh\">\u5176\u4f59\u533a\u57df\u8bbe\u7f6e\u7c7b\u522b\u53ef\u4ee5\u5728\u4ee5\u540e\u542f\u52a8\u670d\u52a1\u5668\u65f6\u66f4\u6539\u3002\u8fd8\u53ef\u4ee5\u4f7f\u7528<code class=\"option\">--locale</code>\u8bbe\u7f6e\u6240\u6709\u533a\u57df\u8bbe\u7f6e\u7c7b\u522b\u7684\u9ed8\u8ba4\u503c\uff0c\u5305\u62ec\u6392\u5e8f\u987a\u5e8f\u548c\u5b57\u7b26\u96c6\u5206\u7c7b\u3002\u6240\u6709\u670d\u52a1\u5668\u533a\u57df\u8bbe\u7f6e\u503c\uff08<code class=\"literal\">lc_*</code>\uff09\u90fd\u53ef\u4ee5\u901a\u8fc7<code class=\"command\">SHOW ALL</code>\u663e\u793a\u3002\u66f4\u591a\u7ec6\u8282\u89c1<a class=\"xref\" href=\"/docs/12/charset.html#LOCALE\" title=\"23.1.\u00a0\u533a\u57df\u8bbe\u7f6e\u652f\u6301\">\u7b2c\u00a023.1\u00a0\u8282</a>\u3002</p>\n<p lang=\"zh\">\u8981\u4fee\u6539\u9ed8\u8ba4\u7f16\u7801\uff0c\u8bf7\u4f7f\u7528<code class=\"option\">--encoding</code>\u3002\u66f4\u591a\u7ec6\u8282\u89c1<a class=\"xref\" href=\"/docs/12/multibyte.html\" title=\"23.3.\u00a0\u5b57\u7b26\u96c6\u652f\u6301\">\u7b2c\u00a023.3\u00a0\u8282</a>\u3002</p>\n</div>\n<div class=\"refsect1\" id=\"id-1.9.5.3.6\">\n<h2 lang=\"zh\">\u9009\u9879</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 lang=\"zh\">\u6b64\u9009\u9879\u6307\u5b9a<code class=\"filename\">pg_hba.conf</code>\u4e2d\u672c\u5730\u7528\u6237\u4f7f\u7528\u7684\u9ed8\u8ba4\u8ba4\u8bc1\u65b9\u6cd5\uff08<code class=\"literal\">host</code>\u548c<code class=\"literal\">local</code>\u884c\uff09\u3002<code class=\"command\">initdb</code>\u4f1a\u4f7f\u7528\u6307\u5b9a\u7684\u8ba4\u8bc1\u65b9\u6cd5\uff0c\u4e3a\u975e\u590d\u5236\u8fde\u63a5\u548c\u590d\u5236\u8fde\u63a5\u9884\u5148\u586b\u5145<code class=\"filename\">pg_hba.conf</code>\u6761\u76ee\u3002</p>\n<p lang=\"zh\">\u9664\u975e\u4fe1\u4efb\u7cfb\u7edf\u4e0a\u7684\u6240\u6709\u672c\u5730\u7528\u6237\uff0c\u5426\u5219\u4e0d\u8981\u4f7f\u7528<code class=\"literal\">trust</code>\u3002\u4e3a\u4fbf\u4e8e\u5b89\u88c5\uff0c\u9ed8\u8ba4\u503c\u4e3a<code class=\"literal\">trust</code>\u3002</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 lang=\"zh\">\n<p>\u8be5\u9009\u9879\u6307\u5b9a<code class=\"filename\">pg_hba.conf</code>\u4e2d\u672c\u5730\u7528\u6237\u901a\u8fc7 TCP/IP \u8fde\u63a5\u65f6\uff08<code class=\"literal\">host</code> \u884c\uff09\u4f7f\u7528\u7684\u8ba4\u8bc1\u65b9\u6cd5\u3002</p>\n</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 lang=\"zh\">\n<p>\u8be5\u9009\u9879\u6307\u5b9a<code class=\"filename\">pg_hba.conf</code>\u4e2d\u672c\u5730\u7528\u6237\u901a\u8fc7 Unix \u57df\u5957\u63a5\u5b57\u8fde\u63a5\u65f6\uff08<code class=\"literal\">local</code> \u884c\uff09\u4f7f\u7528\u7684\u8ba4\u8bc1\u65b9\u6cd5\u3002</p>\n</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 lang=\"zh\">\n<p>\u8be5\u9009\u9879\u6307\u5b9a\u6570\u636e\u5e93\u96c6\u7c07\u5e94\u5b58\u653e\u7684\u76ee\u5f55\u3002\u8fd9\u662f<code class=\"command\">initdb</code>\u6240\u9700\u7684\u552f\u4e00\u4fe1\u606f\uff0c\u4f46\u4e5f\u53ef\u4ee5\u901a\u8fc7\u8bbe\u7f6e<code class=\"envar\">PGDATA</code>\u73af\u5883\u53d8\u91cf\u6765\u7701\u53bb\u663e\u5f0f\u5199\u51fa\u5b83\uff1b\u8fd9\u901a\u5e38\u66f4\u65b9\u4fbf\uff0c\u56e0\u4e3a\u6570\u636e\u5e93\u670d\u52a1\u5668\uff08<code class=\"command\">postgres</code>\uff09\u4e4b\u540e\u4e5f\u53ef\u4ee5\u901a\u8fc7\u540c\u4e00\u53d8\u91cf\u627e\u5230\u6570\u636e\u76ee\u5f55\u3002</p>\n</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 lang=\"zh\">\n<p>\u9009\u62e9\u6a21\u677f\u6570\u636e\u5e93\u7684\u7f16\u7801\u3002\u8fd9\u4e5f\u4f1a\u6210\u4e3a\u4ee5\u540e\u521b\u5efa\u7684\u4efb\u4f55\u6570\u636e\u5e93\u7684\u9ed8\u8ba4\u7f16\u7801\uff0c\u9664\u975e\u5728\u521b\u5efa\u65f6\u8986\u76d6\u5b83\u3002\u9ed8\u8ba4\u503c\u7531\u533a\u57df\u8bbe\u7f6e\u63a8\u5bfc\u800c\u6765\uff0c\u5982\u679c\u65e0\u6cd5\u63a8\u5bfc\uff0c\u5219\u4f7f\u7528<code class=\"literal\">SQL_ASCII</code>\u3002<span class=\"productname\">PostgreSQL</span>\u670d\u52a1\u5668\u652f\u6301\u7684\u5b57\u7b26\u96c6\u5728<a class=\"xref\" href=\"/docs/12/multibyte.html#MULTIBYTE-CHARSET-SUPPORTED\" title=\"23.3.1.\u00a0\u652f\u6301\u7684\u5b57\u7b26\u96c6\">\u7b2c\u00a023.3.1\u00a0\u8282</a>\u4e2d\u4ecb\u7ecd\u3002</p>\n</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 lang=\"zh\">\u5141\u8bb8\u4e0e\u96c6\u7fa4\u6240\u6709\u8005\u540c\u7ec4\u7684\u7528\u6237\u8bfb\u53d6 initdb \u521b\u5efa\u7684\u6240\u6709\u96c6\u7fa4\u6587\u4ef6\u3002Windows \u4e0d\u652f\u6301 POSIX \u98ce\u683c\u7684\u7ec4\u6743\u9650\uff0c\u56e0\u6b64\u4f1a\u5ffd\u7565\u6b64\u9009\u9879\u3002</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 lang=\"zh\">\n<p>\u5728\u6570\u636e\u9875\u4e0a\u4f7f\u7528\u6821\u9a8c\u548c\uff0c\u5e2e\u52a9\u68c0\u6d4b I/O \u7cfb\u7edf\u9020\u6210\u7684\u3001\u5426\u5219\u53ef\u80fd\u6084\u65e0\u58f0\u606f\u7684\u6570\u636e\u635f\u574f\u3002\u542f\u7528\u6821\u9a8c\u548c\u53ef\u80fd\u4f1a\u5e26\u6765\u660e\u663e\u7684\u6027\u80fd\u635f\u5931\u3002\u5982\u679c\u542f\u7528\uff0c\u5c31\u4f1a\u4e3a\u6240\u6709\u6570\u636e\u5e93\u4e2d\u7684\u6240\u6709\u5bf9\u8c61\u8ba1\u7b97\u6821\u9a8c\u548c\u3002\u6240\u6709\u6821\u9a8c\u548c\u5931\u8d25\u90fd\u4f1a\u5728<a class=\"xref\" href=\"/docs/12/monitoring-stats.html#PG-STAT-DATABASE-VIEW\" title=\"\u8868\u00a027.12.\u00a0pg_stat_database \u89c6\u56fe\">pg_stat_database</a>\u89c6\u56fe\u4e2d\u62a5\u544a\u3002</p>\n</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 lang=\"zh\">\n<p>\u8bbe\u7f6e\u6570\u636e\u5e93\u96c6\u7c07\u7684\u9ed8\u8ba4\u533a\u57df\u8bbe\u7f6e\u3002\u5982\u679c\u672a\u6307\u5b9a\u8be5\u9009\u9879\uff0c\u533a\u57df\u8bbe\u7f6e\u5c06\u7ee7\u627f\u81ea <code class=\"command\">initdb</code>\u8fd0\u884c\u65f6\u6240\u5728\u7684\u73af\u5883\u3002\u533a\u57df\u8bbe\u7f6e\u652f\u6301\u89c1<a class=\"xref\" href=\"/docs/12/charset.html#LOCALE\" title=\"23.1.\u00a0\u533a\u57df\u8bbe\u7f6e\u652f\u6301\">\u7b2c\u00a023.1\u00a0\u8282</a>\u3002</p>\n</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 lang=\"zh\">\n<p>\u7c7b\u4f3c\u4e8e<code class=\"option\">--locale</code>\uff0c\u4f46\u53ea\u5728\u6307\u5b9a\u7684\u7c7b\u522b\u4e2d\u8bbe\u7f6e\u533a\u57df\u8bbe\u7f6e\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--no-locale</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u7b49\u4ef7\u4e8e<code class=\"option\">--locale=C</code>\u3002</p>\n</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 lang=\"zh\">\n<p>\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c<code class=\"command\">initdb</code>\u4f1a\u7b49\u5f85\u6240\u6709\u6587\u4ef6\u5b89\u5168\u5199\u5165\u78c1\u76d8\u3002\u6b64\u9009\u9879\u4f7f<code class=\"command\">initdb</code>\u4e0d\u7b49\u5f85\u5c31\u8fd4\u56de\uff0c\u901f\u5ea6\u66f4\u5feb\uff0c\u4f46\u610f\u5473\u7740\u6b64\u540e\u64cd\u4f5c\u7cfb\u7edf\u5d29\u6e83\u53ef\u80fd\u4f1a\u9020\u6210\u6570\u636e\u76ee\u5f55\u635f\u574f\u3002\u901a\u5e38\uff0c\u6b64\u9009\u9879\u9002\u7528\u4e8e\u6d4b\u8bd5\uff0c\u4f46\u4e0d\u5e94\u5728\u521b\u5efa\u751f\u4ea7\u5b89\u88c5\u65f6\u4f7f\u7528\u3002</p>\n</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 lang=\"zh\">\n<p>\u4f7f<code class=\"command\">initdb</code>\u4ece\u6587\u4ef6\u4e2d\u8bfb\u53d6\u6570\u636e\u5e93\u8d85\u7ea7\u7528\u6237\u7684\u5bc6\u7801\u3002\u6587\u4ef6\u7684\u7b2c\u4e00\u884c\u4f1a\u88ab\u5f53\u4f5c\u5bc6\u7801\u3002</p>\n</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 lang=\"zh\">\n<p>\u5c06\u6240\u6709\u6570\u636e\u5e93\u6587\u4ef6\u5b89\u5168\u5199\u5165\u78c1\u76d8\uff0c\u7136\u540e\u9000\u51fa\u3002\u8fd9\u4e0d\u4f1a\u6267\u884c\u4efb\u4f55\u5e38\u89c4<span class=\"application\">initdb</span>\u64cd\u4f5c\u3002</p>\n</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 lang=\"zh\">\n<p>\u8bbe\u7f6e\u9ed8\u8ba4\u6587\u672c\u68c0\u7d22\u914d\u7f6e\u3002\u66f4\u591a\u4fe1\u606f\u89c1<a class=\"xref\" href=\"/docs/12/runtime-config-client.html#GUC-DEFAULT-TEXT-SEARCH-CONFIG\">default_text_search_config</a>\u3002</p>\n</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 lang=\"zh\">\n<p>\u9009\u62e9\u6570\u636e\u5e93\u8d85\u7ea7\u7528\u6237\u7684\u7528\u6237\u540d\u3002\u9ed8\u8ba4\u503c\u662f\u8fd0\u884c<code class=\"command\">initdb</code>\u7684\u6709\u6548\u7528\u6237\u7684\u540d\u79f0\u3002\u8d85\u7ea7\u7528\u6237\u7684\u540d\u79f0\u672c\u8eab\u5e76\u4e0d\u91cd\u8981\uff0c\u4e0d\u8fc7\u5373\u4f7f\u64cd\u4f5c\u7cfb\u7edf\u7528\u6237\u540d\u79f0\u4e0d\u540c\uff0c\u4e5f\u53ef\u4ee5\u9009\u62e9\u6cbf\u7528\u60ef\u5e38\u7684\u540d\u79f0 <span class=\"systemitem\">postgres</span>\u3002</p>\n</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 lang=\"zh\">\n<p>\u4f7f<code class=\"command\">initdb</code>\u63d0\u793a\u8f93\u5165\u8981\u8d4b\u7ed9\u6570\u636e\u5e93\u8d85\u7ea7\u7528\u6237\u7684\u5bc6\u7801\u3002\u5982\u679c\u4e0d\u6253\u7b97\u4f7f\u7528\u5bc6\u7801\u8ba4\u8bc1\uff0c\u8fd9\u4e00\u70b9\u5e76\u4e0d\u91cd\u8981\u3002\u5426\u5219\uff0c\u5728\u8bbe\u7f6e\u5bc6\u7801\u4e4b\u524d\u5c06\u65e0\u6cd5\u4f7f\u7528\u5bc6\u7801\u8ba4\u8bc1\u3002</p>\n</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 lang=\"zh\">\n<p>\u8be5\u9009\u9879\u6307\u5b9a\u9884\u5199\u5f0f\u65e5\u5fd7\uff08WAL\uff09\u5e94\u5b58\u653e\u7684\u76ee\u5f55\u3002</p>\n</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 lang=\"zh\">\u8bbe\u7f6e WAL \u6bb5\u5927\u5c0f\uff0c\u5355\u4f4d\u4e3a\u5146\u5b57\u8282\u3002\u8fd9\u662f WAL \u65e5\u5fd7\u4e2d\u6bcf\u4e2a\u72ec\u7acb\u6587\u4ef6\u7684\u5927\u5c0f\u3002\u9ed8\u8ba4\u5927\u5c0f\u4e3a 16 \u5146\u5b57\u8282\u3002\u53d6\u503c\u5fc5\u987b\u662f 1 \u5230 1024\uff08\u5146\u5b57\u8282\uff09\u4e4b\u95f4\u7684 2 \u7684\u5e42\u3002\u6b64\u9009\u9879\u53ea\u80fd\u5728\u521d\u59cb\u5316\u65f6\u8bbe\u7f6e\uff0c\u4e4b\u540e\u65e0\u6cd5\u66f4\u6539\u3002</p>\n<p lang=\"zh\">\u8c03\u6574\u8be5\u5927\u5c0f\u53ef\u80fd\u6709\u52a9\u4e8e\u63a7\u5236 WAL \u65e5\u5fd7\u4f20\u9001\u6216\u5f52\u6863\u7684\u7c92\u5ea6\u3002\u6b64\u5916\uff0c\u5728 WAL \u91cf\u5f88\u5927\u7684\u6570\u636e\u5e93\u4e2d\uff0c\u6bcf\u4e2a\u76ee\u5f55\u4e2d\u7684 WAL \u6587\u4ef6\u6570\u91cf\u53ef\u80fd\u4f1a\u6210\u4e3a\u6027\u80fd\u548c\u7ba1\u7406\u95ee\u9898\u3002\u589e\u5927 WAL \u6587\u4ef6\u5927\u5c0f\u4f1a\u51cf\u5c11 WAL \u6587\u4ef6\u6570\u91cf\u3002</p>\n</dd>\n</dl>\n</div>\n<p lang=\"zh\">\u8fd8\u53ef\u4ee5\u4f7f\u7528\u4ee5\u4e0b\u8f83\u5c11\u7528\u5230\u7684\u9009\u9879\uff1a</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 lang=\"zh\">\n<p>\u6253\u5370\u5f15\u5bfc\u540e\u7aef\u7684\u8c03\u8bd5\u8f93\u51fa\uff0c\u4ee5\u53ca\u5c11\u91cf\u666e\u901a\u7528\u6237\u901a\u5e38\u4e0d\u611f\u5174\u8da3\u7684\u5176\u4ed6\u6d88\u606f\u3002\u5f15\u5bfc\u540e\u7aef\u662f <code class=\"command\">initdb</code>\u7528\u6765\u521b\u5efa\u7cfb\u7edf\u76ee\u5f55\u8868\u7684\u7a0b\u5e8f\u3002\u8be5\u9009\u9879\u4f1a\u4ea7\u751f\u5927\u91cf\u6781\u5176\u4e4f\u5473\u7684\u8f93\u51fa\u3002</p>\n</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 lang=\"zh\">\n<p>\u6307\u5b9a<code class=\"command\">initdb</code>\u521d\u59cb\u5316\u6570\u636e\u5e93\u96c6\u7c07\u65f6\u5e94\u5230\u54ea\u91cc\u67e5\u627e\u5176\u8f93\u5165\u6587\u4ef6\u3002\u901a\u5e38\u4e0d\u9700\u8981\u8fd9\u6837\u505a\u3002\u82e5\u9700\u8981\u663e\u5f0f\u6307\u5b9a\u5176\u4f4d\u7f6e\uff0c\u7cfb\u7edf\u4f1a\u63d0\u793a\u3002</p>\n</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 lang=\"zh\">\n<p>\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c\u5982\u679c<code class=\"command\">initdb</code>\u53d1\u73b0\u67d0\u4e2a\u9519\u8bef\u4f7f\u5176\u65e0\u6cd5\u5b8c\u6574\u521b\u5efa\u6570\u636e\u5e93\u96c6\u7c07\uff0c\u5c31\u4f1a\u5220\u9664\u5b83\u5728\u53d1\u73b0\u65e0\u6cd5\u5b8c\u6210\u4efb\u52a1\u4e4b\u524d\u53ef\u80fd\u5df2\u521b\u5efa\u7684\u6240\u6709\u6587\u4ef6\u3002\u8be5\u9009\u9879\u4f1a\u7981\u6b62\u8fd9\u79cd\u6e05\u7406\uff0c\u56e0\u6b64\u5bf9\u8c03\u8bd5\u6709\u7528\u3002</p>\n</p>\n</dd>\n</dl>\n</div>\n<p lang=\"zh\">\u5176\u4ed6\u9009\u9879\uff1a</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 lang=\"zh\">\n<p>\u6253\u5370<span class=\"application\">initdb</span>\u7248\u672c\u5e76\u9000\u51fa\u3002</p>\n</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 lang=\"zh\">\n<p>\u663e\u793a\u6709\u5173<span class=\"application\">initdb</span>\u547d\u4ee4\u884c\u53c2\u6570\u7684\u5e2e\u52a9\u5e76\u9000\u51fa\u3002</p>\n</p>\n</dd>\n</dl>\n</div>\n</div>\n<div class=\"refsect1\" id=\"id-1.9.5.3.7\">\n<h2 lang=\"zh\">\u73af\u5883</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 lang=\"zh\">\n<p>\u6307\u5b9a\u6570\u636e\u5e93\u96c6\u7c07\u5e94\u5b58\u653e\u7684\u76ee\u5f55\uff1b\u53ef\u4f7f\u7528<code class=\"option\">-D</code>\u9009\u9879\u8986\u76d6\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"envar\">PG_COLOR</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6307\u5b9a\u662f\u5426\u5728\u8bca\u65ad\u6d88\u606f\u4e2d\u4f7f\u7528\u989c\u8272\u3002\u53ef\u80fd\u7684\u503c\u4e3a<code class=\"literal\">always</code>\u3001<code class=\"literal\">auto</code>\u548c<code class=\"literal\">never</code>\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"envar\">TZ</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6307\u5b9a\u6240\u521b\u5efa\u6570\u636e\u5e93\u96c6\u7c07\u7684\u9ed8\u8ba4\u65f6\u533a\u3002\u8be5\u503c\u5e94\u4e3a\u5b8c\u6574\u7684\u65f6\u533a\u540d\u79f0\uff08\u89c1<a class=\"xref\" href=\"/docs/12/datatype-datetime.html#DATATYPE-TIMEZONES\" title=\"8.5.3.\u00a0\u65f6\u533a\">\u7b2c\u00a08.5.3\u00a0\u8282</a>\uff09\u3002</p>\n</p>\n</dd>\n</dl>\n</div>\n</div>\n<div class=\"refsect1\" id=\"id-1.9.5.3.8\">\n<h2 lang=\"zh\">\u6ce8\u89e3</h2>\n<p lang=\"zh\">\u4e5f\u53ef\u4ee5\u901a\u8fc7 pg_ctl initdb \u8c03\u7528 initdb\u3002</p>\n</div>\n<div class=\"refsect1\" id=\"id-1.9.5.3.9\">\n<h2 lang=\"zh\">\u53e6\u89c1</h2><span class=\"simplelist\"><a class=\"xref\" href=\"https://pg.center/docs/12/app-pg-ctl.html\" title=\"pg_ctl\"><span class=\"refentrytitle\"><span class=\"application\">pg_ctl</span></span></a>, <a class=\"xref\" href=\"https://pg.center/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", "localization": {"status": "complete", "sources": [{"url": "/docs/12/app-initdb.html", "method": "same-major semantic node", "sha256": "5d64af8fd306a202c5237d1f6089619a590109fcb1fc59ff156a077f3695ef1e", "language": "zh", "matched_nodes": ["#APP-INITDB/div[2]/p[1]", "#APP-INITDB/div[3]/h2[0]", "#APP-INITDB/div[4]/p[1]", "#APP-INITDB/div[4]/p[2]", "#APP-INITDB/div[4]/p[3]", "#APP-INITDB/div[4]/p[4]", "#APP-INITDB/div[4]/p[5]", "#APP-INITDB/div[4]/p[6]", "#APP-INITDB/div[4]/p[7]", "#APP-INITDB/div[4]/p[8]", "#APP-INITDB/div[4]/p[9]", "#APP-INITDB/div[5]/div[1]/dl[0]/dd[11]", "#APP-INITDB/div[5]/div[1]/dl[0]/dd[13]", "#APP-INITDB/div[5]/div[1]/dl[0]/dd[15]", "#APP-INITDB/div[5]/div[1]/dl[0]/dd[17]", "#APP-INITDB/div[5]/div[1]/dl[0]/dd[19]", "#APP-INITDB/div[5]/div[1]/dl[0]/dd[1]/p[0]", "#APP-INITDB/div[5]/div[1]/dl[0]/dd[1]/p[1]", "#APP-INITDB/div[5]/div[1]/dl[0]/dd[21]", "#APP-INITDB/div[5]/div[1]/dl[0]/dd[23]", "#APP-INITDB/div[5]/div[1]/dl[0]/dd[25]", "#APP-INITDB/div[5]/div[1]/dl[0]/dd[27]", "#APP-INITDB/div[5]/div[1]/dl[0]/dd[29]", "#APP-INITDB/div[5]/div[1]/dl[0]/dd[31]", "#APP-INITDB/div[5]/div[1]/dl[0]/dd[33]", "#APP-INITDB/div[5]/div[1]/dl[0]/dd[35]/p[1]", "#APP-INITDB/div[5]/div[1]/dl[0]/dd[3]", "#APP-INITDB/div[5]/div[1]/dl[0]/dd[5]", "#APP-INITDB/div[5]/div[1]/dl[0]/dd[7]", "#APP-INITDB/div[5]/div[1]/dl[0]/dd[9]", "#APP-INITDB/div[5]/div[3]/dl[0]/dd[1]", "#APP-INITDB/div[5]/div[3]/dl[0]/dd[3]", "#APP-INITDB/div[5]/div[3]/dl[0]/dd[5]", "#APP-INITDB/div[5]/div[5]/dl[0]/dd[1]", "#APP-INITDB/div[5]/div[5]/dl[0]/dd[3]", "#APP-INITDB/div[5]/p[2]", "#APP-INITDB/div[5]/p[4]", "#APP-INITDB/div[6]/div[1]/dl[0]/dd[1]", "#APP-INITDB/div[6]/div[1]/dl[0]/dd[3]", "#APP-INITDB/div[6]/div[1]/dl[0]/dd[5]", "#APP-INITDB/div[6]/h2[0]", "#APP-INITDB/div[7]/h2[0]", "#APP-INITDB/div[8]/h2[0]"]}], "language": "zh", "original_text": {"/versions/12/description/0": "initdb \u2014 create a new PostgreSQL database cluster", "/versions/12/facts/0/label": "Documented executable", "/versions/12/facts/1/label": "Executable version", "/versions/12/facts/2/label": "Reference inventory", "/versions/12/facts/2/value": "Server applications", "/versions/12/facts/3/label": "Option definition groups", "/versions/12/tables/0/title": "Documented options", "/versions/12/tables/1/title": "Environment variables", "/versions/12/tables/0/rows/0/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.", "/versions/12/tables/0/rows/1/summary": "This option specifies the authentication method for local users via TCP/IP connections used in pg_hba.conf ( host lines).", "/versions/12/tables/0/rows/2/summary": "This option specifies the authentication method for local users via Unix-domain socket connections used in pg_hba.conf ( local lines).", "/versions/12/tables/0/rows/3/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.", "/versions/12/tables/0/rows/4/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 .", "/versions/12/tables/0/rows/5/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.", "/versions/12/tables/0/rows/6/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.", "/versions/12/tables/0/rows/7/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 .", "/versions/12/tables/0/rows/8/summary": "Like --locale , but only sets the locale in the specified category.", "/versions/12/tables/0/rows/9/summary": "Equivalent to --locale=C .", "/versions/12/tables/0/columns/0/label": "Option and arguments", "/versions/12/tables/0/columns/1/label": "Description", "/versions/12/tables/0/rows/10/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.", "/versions/12/tables/0/rows/11/summary": "Makes initdb read the database superuser's password from a file. The first line of the file is taken as the password.", "/versions/12/tables/0/rows/12/summary": "Safely write all database files to disk and exit. This does not perform any of the normal initdb operations.", "/versions/12/tables/0/rows/13/summary": "Sets the default text search configuration. See default_text_search_config for further information.", "/versions/12/tables/0/rows/14/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.", "/versions/12/tables/0/rows/15/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.", "/versions/12/tables/0/rows/16/summary": "This option specifies the directory where the write-ahead log should be stored.", "/versions/12/tables/0/rows/17/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.", "/versions/12/tables/0/rows/18/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.", "/versions/12/tables/0/rows/19/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.", "/versions/12/tables/0/rows/20/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.", "/versions/12/tables/0/rows/21/summary": "Print the initdb version and exit.", "/versions/12/tables/0/rows/22/summary": "Show help about initdb command line arguments, and exit.", "/versions/12/tables/1/columns/0/label": "Variable", "/versions/12/tables/1/columns/1/label": "Meaning", "/versions/12/tables/1/rows/0/description": "Specifies the directory where the database cluster is to be stored; can be overridden using the -D option.", "/versions/12/tables/1/rows/1/description": "Specifies whether to use color in diagnostic messages. Possible values are always , auto and never .", "/versions/12/tables/1/rows/2/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 )."}, "fallback_fields": [], "source_language": "en", "original_snapshot_sha256": "c5fb5f2d69aad8deb156005ed406ae039e4599c927d8783e375974247dd34944"}, "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", "manual_language": "zh"}, "13": {"facts": [{"label": "\u624b\u518c\u4e2d\u7684\u53ef\u6267\u884c\u7a0b\u5e8f", "value": "initdb"}, {"label": "\u7a0b\u5e8f\u7248\u672c", "value": "13.23"}, {"label": "\u53c2\u8003\u6e05\u5355", "value": "\u670d\u52a1\u7aef\u7a0b\u5e8f"}, {"label": "\u9009\u9879\u5b9a\u4e49\u7ec4", "value": "23"}], "tables": [{"key": "options", "rows": [{"summary": "\u6b64\u9009\u9879\u6307\u5b9a pg_hba.conf \u4e2d\u672c\u5730\u7528\u6237\u4f7f\u7528\u7684\u9ed8\u8ba4\u8ba4\u8bc1\u65b9\u6cd5\uff08 host \u548c local \u884c\uff09\u3002 initdb \u4f1a\u4f7f\u7528\u6307\u5b9a\u7684\u8ba4\u8bc1\u65b9\u6cd5\uff0c\u4e3a\u975e\u590d\u5236\u8fde\u63a5\u548c\u590d\u5236\u8fde\u63a5\u9884\u5148\u586b\u5145 pg_hba.conf \u6761\u76ee\u3002", "signature": {"url": "/docs/13/app-initdb.html", "text": "-A authmethod --auth= authmethod"}}, {"summary": "\u8be5\u9009\u9879\u6307\u5b9a pg_hba.conf \u4e2d\u672c\u5730\u7528\u6237\u901a\u8fc7 TCP/IP \u8fde\u63a5\u65f6\uff08 host \u884c\uff09\u4f7f\u7528\u7684\u8ba4\u8bc1\u65b9\u6cd5\u3002", "signature": {"url": "/docs/13/app-initdb.html", "text": "--auth-host= authmethod"}}, {"summary": "\u8be5\u9009\u9879\u6307\u5b9a pg_hba.conf \u4e2d\u672c\u5730\u7528\u6237\u901a\u8fc7 Unix \u57df\u5957\u63a5\u5b57\u8fde\u63a5\u65f6\uff08 local \u884c\uff09\u4f7f\u7528\u7684\u8ba4\u8bc1\u65b9\u6cd5\u3002", "signature": {"url": "/docs/13/app-initdb.html", "text": "--auth-local= authmethod"}}, {"summary": "\u8be5\u9009\u9879\u6307\u5b9a\u6570\u636e\u5e93\u96c6\u7c07\u5e94\u5b58\u653e\u7684\u76ee\u5f55\u3002\u8fd9\u662f initdb \u6240\u9700\u7684\u552f\u4e00\u4fe1\u606f\uff0c\u4f46\u4e5f\u53ef\u4ee5\u901a\u8fc7\u8bbe\u7f6e PGDATA \u73af\u5883\u53d8\u91cf\u6765\u7701\u53bb\u663e\u5f0f\u5199\u51fa\u5b83\uff1b\u8fd9\u901a\u5e38\u66f4\u65b9\u4fbf\uff0c\u56e0\u4e3a\u6570\u636e\u5e93\u670d\u52a1\u5668\uff08 postgres \uff09\u4e4b\u540e\u4e5f\u53ef\u4ee5\u901a\u8fc7\u540c\u4e00\u53d8\u91cf\u627e\u5230\u6570\u636e\u76ee\u5f55\u3002", "signature": {"url": "/docs/13/app-initdb.html", "text": "-D directory --pgdata= directory"}}, {"summary": "\u9009\u62e9\u6a21\u677f\u6570\u636e\u5e93\u7684\u7f16\u7801\u3002\u8fd9\u4e5f\u4f1a\u6210\u4e3a\u4ee5\u540e\u521b\u5efa\u7684\u4efb\u4f55\u6570\u636e\u5e93\u7684\u9ed8\u8ba4\u7f16\u7801\uff0c\u9664\u975e\u5728\u521b\u5efa\u65f6\u8986\u76d6\u5b83\u3002\u9ed8\u8ba4\u503c\u7531\u533a\u57df\u8bbe\u7f6e\u63a8\u5bfc\u800c\u6765\uff0c\u5982\u679c\u65e0\u6cd5\u63a8\u5bfc\uff0c\u5219\u4f7f\u7528 SQL_ASCII \u3002 PostgreSQL \u670d\u52a1\u5668\u652f\u6301\u7684\u5b57\u7b26\u96c6\u5728 \u7b2c 23.3.1 \u8282 \u4e2d\u4ecb\u7ecd\u3002", "signature": {"url": "/docs/13/app-initdb.html", "text": "-E encoding --encoding= encoding"}}, {"summary": "\u5141\u8bb8\u4e0e\u96c6\u7c07\u62e5\u6709\u8005\u540c\u7ec4\u7684\u7528\u6237\u8bfb\u53d6\u7531 initdb \u521b\u5efa\u7684\u6240\u6709\u96c6\u7c07\u6587\u4ef6\u3002\u8be5\u9009\u9879\u5728 Windows \u4e0a\u4f1a\u88ab\u5ffd\u7565\uff0c\u56e0\u4e3a\u5b83\u4e0d\u652f\u6301 POSIX \u98ce\u683c\u7684\u7ec4\u6743\u9650\u3002", "signature": {"url": "/docs/13/app-initdb.html#APP-INITDB-ALLOW-GROUP-ACCESS", "text": "-g --allow-group-access"}}, {"summary": "\u5728\u6570\u636e\u9875\u4e0a\u4f7f\u7528\u6821\u9a8c\u548c\uff0c\u5e2e\u52a9\u68c0\u6d4b I/O \u7cfb\u7edf\u9020\u6210\u7684\u3001\u5426\u5219\u53ef\u80fd\u6084\u65e0\u58f0\u606f\u7684\u6570\u636e\u635f\u574f\u3002\u542f\u7528\u6821\u9a8c\u548c\u53ef\u80fd\u4f1a\u5e26\u6765\u660e\u663e\u7684\u6027\u80fd\u635f\u5931\u3002\u5982\u679c\u542f\u7528\uff0c\u5c31\u4f1a\u4e3a\u6240\u6709\u6570\u636e\u5e93\u4e2d\u7684\u6240\u6709\u5bf9\u8c61\u8ba1\u7b97\u6821\u9a8c\u548c\u3002\u6240\u6709\u6821\u9a8c\u548c\u5931\u8d25\u90fd\u4f1a\u5728 pg_stat_database \u89c6\u56fe\u4e2d\u62a5\u544a\u3002", "signature": {"url": "/docs/13/app-initdb.html#APP-INITDB-DATA-CHECKSUMS", "text": "-k --data-checksums"}}, {"summary": "\u8bbe\u7f6e\u6570\u636e\u5e93\u96c6\u7c07\u7684\u9ed8\u8ba4\u533a\u57df\u8bbe\u7f6e\u3002\u5982\u679c\u672a\u6307\u5b9a\u8be5\u9009\u9879\uff0c\u533a\u57df\u8bbe\u7f6e\u5c06\u7ee7\u627f\u81ea initdb \u8fd0\u884c\u65f6\u6240\u5728\u7684\u73af\u5883\u3002\u533a\u57df\u8bbe\u7f6e\u652f\u6301\u89c1 \u7b2c 23.1 \u8282 \u3002", "signature": {"url": "/docs/13/app-initdb.html", "text": "--locale= locale"}}, {"summary": "\u7c7b\u4f3c\u4e8e --locale \uff0c\u4f46\u53ea\u5728\u6307\u5b9a\u7684\u7c7b\u522b\u4e2d\u8bbe\u7f6e\u533a\u57df\u8bbe\u7f6e\u3002", "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": "\u7b49\u4ef7\u4e8e --locale=C \u3002", "signature": {"url": "/docs/13/app-initdb.html", "text": "--no-locale"}}, {"summary": "\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c initdb \u4f1a\u7b49\u5f85\u6240\u6709\u6587\u4ef6\u5b89\u5168\u5199\u5165\u78c1\u76d8\u3002\u6b64\u9009\u9879\u4f7f initdb \u4e0d\u7b49\u5f85\u5c31\u8fd4\u56de\uff0c\u901f\u5ea6\u66f4\u5feb\uff0c\u4f46\u610f\u5473\u7740\u6b64\u540e\u64cd\u4f5c\u7cfb\u7edf\u5d29\u6e83\u53ef\u80fd\u4f1a\u9020\u6210\u6570\u636e\u76ee\u5f55\u635f\u574f\u3002\u901a\u5e38\uff0c\u6b64\u9009\u9879\u9002\u7528\u4e8e\u6d4b\u8bd5\uff0c\u4f46\u4e0d\u5e94\u5728\u521b\u5efa\u751f\u4ea7\u5b89\u88c5\u65f6\u4f7f\u7528\u3002", "signature": {"url": "/docs/13/app-initdb.html", "text": "-N --no-sync"}}, {"summary": "\u4f7f initdb \u4ece\u6587\u4ef6\u4e2d\u8bfb\u53d6\u6570\u636e\u5e93\u8d85\u7ea7\u7528\u6237\u7684\u5bc6\u7801\u3002\u6587\u4ef6\u7684\u7b2c\u4e00\u884c\u4f1a\u88ab\u5f53\u4f5c\u5bc6\u7801\u3002", "signature": {"url": "/docs/13/app-initdb.html", "text": "--pwfile= filename"}}, {"summary": "\u5c06\u6240\u6709\u6570\u636e\u5e93\u6587\u4ef6\u5b89\u5168\u5199\u5165\u78c1\u76d8\uff0c\u7136\u540e\u9000\u51fa\u3002\u8fd9\u4e0d\u4f1a\u6267\u884c\u4efb\u4f55\u5e38\u89c4 initdb \u64cd\u4f5c\u3002", "signature": {"url": "/docs/13/app-initdb.html", "text": "-S --sync-only"}}, {"summary": "\u8bbe\u7f6e\u9ed8\u8ba4\u6587\u672c\u68c0\u7d22\u914d\u7f6e\u3002\u66f4\u591a\u4fe1\u606f\u89c1 default_text_search_config \u3002", "signature": {"url": "/docs/13/app-initdb.html", "text": "-T config --text-search-config= config"}}, {"summary": "\u9009\u62e9\u6570\u636e\u5e93\u8d85\u7ea7\u7528\u6237\u7684\u7528\u6237\u540d\u3002\u9ed8\u8ba4\u503c\u662f\u8fd0\u884c initdb \u7684\u6709\u6548\u7528\u6237\u7684\u540d\u79f0\u3002\u8d85\u7ea7\u7528\u6237\u7684\u540d\u79f0\u672c\u8eab\u5e76\u4e0d\u91cd\u8981\uff0c\u4e0d\u8fc7\u5373\u4f7f\u64cd\u4f5c\u7cfb\u7edf\u7528\u6237\u540d\u79f0\u4e0d\u540c\uff0c\u4e5f\u53ef\u4ee5\u9009\u62e9\u6cbf\u7528\u60ef\u5e38\u7684\u540d\u79f0 postgres \u3002", "signature": {"url": "/docs/13/app-initdb.html", "text": "-U username --username= username"}}, {"summary": "\u4f7f initdb \u63d0\u793a\u8f93\u5165\u8981\u8d4b\u7ed9\u6570\u636e\u5e93\u8d85\u7ea7\u7528\u6237\u7684\u5bc6\u7801\u3002\u5982\u679c\u4e0d\u6253\u7b97\u4f7f\u7528\u5bc6\u7801\u8ba4\u8bc1\uff0c\u8fd9\u4e00\u70b9\u5e76\u4e0d\u91cd\u8981\u3002\u5426\u5219\uff0c\u5728\u8bbe\u7f6e\u5bc6\u7801\u4e4b\u524d\u5c06\u65e0\u6cd5\u4f7f\u7528\u5bc6\u7801\u8ba4\u8bc1\u3002", "signature": {"url": "/docs/13/app-initdb.html", "text": "-W --pwprompt"}}, {"summary": "\u8be5\u9009\u9879\u6307\u5b9a\u9884\u5199\u5f0f\u65e5\u5fd7\uff08WAL\uff09\u5e94\u5b58\u653e\u7684\u76ee\u5f55\u3002", "signature": {"url": "/docs/13/app-initdb.html", "text": "-X directory --waldir= directory"}}, {"summary": "\u8bbe\u7f6e WAL \u6bb5\u5927\u5c0f\uff0c\u5355\u4f4d\u4e3a\u5146\u5b57\u8282\u3002\u8fd9\u662f WAL \u65e5\u5fd7\u4e2d\u6bcf\u4e2a\u72ec\u7acb\u6587\u4ef6\u7684\u5927\u5c0f\u3002\u9ed8\u8ba4\u5927\u5c0f\u4e3a 16 \u5146\u5b57\u8282\u3002\u53d6\u503c\u5fc5\u987b\u662f 1 \u5230 1024\uff08\u5146\u5b57\u8282\uff09\u4e4b\u95f4\u7684 2 \u7684\u5e42\u3002\u6b64\u9009\u9879\u53ea\u80fd\u5728\u521d\u59cb\u5316\u65f6\u8bbe\u7f6e\uff0c\u4e4b\u540e\u65e0\u6cd5\u66f4\u6539\u3002", "signature": {"url": "/docs/13/app-initdb.html", "text": "--wal-segsize= size"}}, {"summary": "\u6253\u5370\u5f15\u5bfc\u540e\u7aef\u7684\u8c03\u8bd5\u8f93\u51fa\uff0c\u4ee5\u53ca\u5c11\u91cf\u666e\u901a\u7528\u6237\u901a\u5e38\u4e0d\u611f\u5174\u8da3\u7684\u5176\u4ed6\u6d88\u606f\u3002\u5f15\u5bfc\u540e\u7aef\u662f initdb \u7528\u6765\u521b\u5efa\u7cfb\u7edf\u76ee\u5f55\u8868\u7684\u7a0b\u5e8f\u3002\u8be5\u9009\u9879\u4f1a\u4ea7\u751f\u5927\u91cf\u6781\u5176\u4e4f\u5473\u7684\u8f93\u51fa\u3002", "signature": {"url": "/docs/13/app-initdb.html", "text": "-d --debug"}}, {"summary": "\u6307\u5b9a initdb \u521d\u59cb\u5316\u6570\u636e\u5e93\u96c6\u7c07\u65f6\u5e94\u5230\u54ea\u91cc\u67e5\u627e\u5176\u8f93\u5165\u6587\u4ef6\u3002\u901a\u5e38\u4e0d\u9700\u8981\u8fd9\u6837\u505a\u3002\u82e5\u9700\u8981\u663e\u5f0f\u6307\u5b9a\u5176\u4f4d\u7f6e\uff0c\u7cfb\u7edf\u4f1a\u63d0\u793a\u3002", "signature": {"url": "/docs/13/app-initdb.html", "text": "-L directory"}}, {"summary": "\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c\u5982\u679c initdb \u53d1\u73b0\u67d0\u4e2a\u9519\u8bef\u4f7f\u5176\u65e0\u6cd5\u5b8c\u6574\u521b\u5efa\u6570\u636e\u5e93\u96c6\u7c07\uff0c\u5c31\u4f1a\u5220\u9664\u5b83\u5728\u53d1\u73b0\u65e0\u6cd5\u5b8c\u6210\u4efb\u52a1\u4e4b\u524d\u53ef\u80fd\u5df2\u521b\u5efa\u7684\u6240\u6709\u6587\u4ef6\u3002\u8be5\u9009\u9879\u4f1a\u7981\u6b62\u8fd9\u79cd\u6e05\u7406\uff0c\u56e0\u6b64\u5bf9\u8c03\u8bd5\u6709\u7528\u3002", "signature": {"url": "/docs/13/app-initdb.html", "text": "-n --no-clean"}}, {"summary": "\u6253\u5370 initdb \u7248\u672c\u5e76\u9000\u51fa\u3002", "signature": {"url": "/docs/13/app-initdb.html", "text": "-V --version"}}, {"summary": "\u663e\u793a\u6709\u5173 initdb \u547d\u4ee4\u884c\u53c2\u6570\u7684\u5e2e\u52a9\u5e76\u9000\u51fa\u3002", "signature": {"url": "/docs/13/app-initdb.html", "text": "-? --help"}}], "title": "\u624b\u518c\u4e2d\u7684\u9009\u9879", "columns": [{"key": "signature", "label": "\u9009\u9879\u4e0e\u53c2\u6570"}, {"key": "summary", "label": "\u8bf4\u660e"}]}, {"key": "environment", "rows": [{"name": "PGDATA", "description": "\u6307\u5b9a\u6570\u636e\u5e93\u96c6\u7c07\u5e94\u5b58\u653e\u7684\u76ee\u5f55\uff1b\u53ef\u4f7f\u7528 -D \u9009\u9879\u8986\u76d6\u3002"}, {"name": "PG_COLOR", "description": "\u6307\u5b9a\u662f\u5426\u5728\u8bca\u65ad\u6d88\u606f\u4e2d\u4f7f\u7528\u989c\u8272\u3002\u53ef\u80fd\u7684\u503c\u4e3a always \u3001 auto \u548c never \u3002"}, {"name": "TZ", "description": "\u6307\u5b9a\u6240\u521b\u5efa\u6570\u636e\u5e93\u96c6\u7c07\u7684\u9ed8\u8ba4\u65f6\u533a\u3002\u8be5\u503c\u5e94\u4e3a\u5b8c\u6574\u7684\u65f6\u533a\u540d\u79f0\uff08\u89c1 \u7b2c 8.5.3 \u8282 \uff09\u3002"}], "title": "\u73af\u5883\u53d8\u91cf", "columns": [{"key": "name", "label": "\u53d8\u91cf"}, {"key": "description", "label": "\u542b\u4e49"}]}], "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": "https://pg.center/docs/13/app-initdb.html", "file": "app-initdb.html", "label": "13.23 English manual \u00b7 app-initdb.html", "anchor": "", "sha256": "4f0926cfb1d27eca883b7a69e33d2d24ffe5ef8b49ec15b2637e9ec5e9664009", "language": "en", "original_url": "/docs/13/app-initdb.html"}, {"url": "https://pg.center/docs/13/reference-server.html", "file": "reference-server.html", "label": "Server applications inventory", "anchor": "", "sha256": "074ef8577fd368272a2360309e1226e2d0b1e570a3e1da62dfcca63ac9ee5539", "language": "en", "original_url": "/docs/13/reference-server.html"}], "sections": [], "synopsis": ["initdb [ option ...] [ --pgdata | -D ] directory"], "signature": "initdb [ option ...] [ --pgdata | -D ] directory", "description": ["initdb \u2014 \u521b\u5efa\u4e00\u4e2a\u65b0\u7684 PostgreSQL \u6570\u636e\u5e93\u96c6\u7c07"], "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 lang=\"zh\">initdb \u2014 \u521b\u5efa\u4e00\u4e2a\u65b0\u7684<span class=\"productname\">PostgreSQL</span>\u6570\u636e\u5e93\u96c6\u7c07</p>\n</div>\n<div class=\"refsynopsisdiv\">\n<h2 lang=\"zh\">\u5927\u7eb2</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 lang=\"zh\">\u8bf4\u660e</h2>\n<p lang=\"zh\"><code class=\"command\">initdb</code>\u521b\u5efa\u4e00\u4e2a\u65b0\u7684<span class=\"productname\">PostgreSQL</span>\u6570\u636e\u5e93\u96c6\u7c07\u3002\u6570\u636e\u5e93\u96c6\u7c07\u662f\u7531\u5355\u4e2a\u670d\u52a1\u5668\u5b9e\u4f8b\u7ba1\u7406\u7684\u4e00\u7ec4\u6570\u636e\u5e93\u3002</p>\n<p lang=\"zh\">\u521b\u5efa\u6570\u636e\u5e93\u96c6\u7c07\u5305\u62ec\u521b\u5efa\u7528\u4e8e\u5b58\u653e\u6570\u636e\u5e93\u6570\u636e\u7684\u76ee\u5f55\uff0c\u751f\u6210\u5171\u4eab\u7cfb\u7edf\u76ee\u5f55\u8868\uff08\u5c5e\u4e8e\u6574\u4e2a\u96c6\u7c07\u800c\u4e0d\u662f\u67d0\u4e2a\u7279\u5b9a\u6570\u636e\u5e93\u7684\u8868\uff09\uff0c\u4ee5\u53ca\u521b\u5efa<code class=\"literal\">template1</code>\u548c<code class=\"literal\">postgres</code>\u6570\u636e\u5e93\u3002\u4ee5\u540e\u521b\u5efa\u65b0\u6570\u636e\u5e93\u65f6\uff0c\u4f1a\u590d\u5236<code class=\"literal\">template1</code>\u6570\u636e\u5e93\u4e2d\u7684\u6240\u6709\u5185\u5bb9\u3002\uff08\u56e0\u6b64\uff0c\u5b89\u88c5\u5728<code class=\"literal\">template1</code>\u4e2d\u7684\u4efb\u4f55\u4e1c\u897f\u90fd\u4f1a\u81ea\u52a8\u590d\u5236\u5230\u4ee5\u540e\u521b\u5efa\u7684\u6bcf\u4e2a\u6570\u636e\u5e93\u4e2d\u3002\uff09<code class=\"literal\">postgres</code>\u6570\u636e\u5e93\u662f\u4e00\u4e2a\u9ed8\u8ba4\u6570\u636e\u5e93\uff0c\u4f9b\u7528\u6237\u3001\u5de5\u5177\u7a0b\u5e8f\u548c\u7b2c\u4e09\u65b9\u5e94\u7528\u7a0b\u5e8f\u4f7f\u7528\u3002</p>\n<p lang=\"zh\">\u867d\u7136<code class=\"command\">initdb</code>\u4f1a\u5c1d\u8bd5\u521b\u5efa\u6307\u5b9a\u7684\u6570\u636e\u76ee\u5f55\uff0c\u4f46\u5982\u679c\u6240\u9700\u6570\u636e\u76ee\u5f55\u7684\u7236\u76ee\u5f55\u5f52 root \u6240\u6709\uff0c\u5b83\u53ef\u80fd\u6ca1\u6709\u8db3\u591f\u7684\u6743\u9650\u3002\u8981\u5728\u8fd9\u79cd\u73af\u5883\u4e2d\u521d\u59cb\u5316\uff0c\u53ef\u5148\u7531 root \u521b\u5efa\u4e00\u4e2a\u7a7a\u7684\u6570\u636e\u76ee\u5f55\uff0c\u7136\u540e\u7528<code class=\"command\">chown</code>\u5c06\u8be5\u76ee\u5f55\u7684\u6240\u6709\u6743\u8d4b\u4e88\u6570\u636e\u5e93\u7528\u6237\u8d26\u6237\uff0c\u518d\u7528 <code class=\"command\">su</code>\u5207\u6362\u4e3a\u8be5\u6570\u636e\u5e93\u7528\u6237\u6765\u8fd0\u884c<code class=\"command\">initdb</code>\u3002</p>\n<p lang=\"zh\"><code class=\"command\">initdb</code>\u5fc5\u987b\u4ee5\u5c06\u62e5\u6709\u670d\u52a1\u5668\u8fdb\u7a0b\u7684\u7528\u6237\u8eab\u4efd\u8fd0\u884c\uff0c\u56e0\u4e3a\u670d\u52a1\u5668\u9700\u8981\u8bbf\u95ee <code class=\"command\">initdb</code>\u521b\u5efa\u7684\u6587\u4ef6\u548c\u76ee\u5f55\u3002\u7531\u4e8e\u670d\u52a1\u5668\u4e0d\u80fd\u4ee5 root \u8eab\u4efd\u8fd0\u884c\uff0c\u56e0\u6b64\u4e5f\u7edd\u4e0d\u80fd\u4ee5 root \u8eab\u4efd\u8fd0\u884c<code class=\"command\">initdb</code>\u3002\uff08\u5b9e\u9645\u4e0a\u5b83\u4f1a\u62d2\u7edd\u8fd9\u6837\u505a\u3002\uff09</p>\n<p lang=\"zh\">\u51fa\u4e8e\u5b89\u5168\u539f\u56e0\uff0c<code class=\"command\">initdb</code>\u521b\u5efa\u7684\u65b0\u96c6\u7c07\u9ed8\u8ba4\u53ea\u6709\u96c6\u7c07\u62e5\u6709\u8005\u53ef\u4ee5\u8bbf\u95ee\u3002<code class=\"option\">--allow-group-access</code> \u9009\u9879\u5141\u8bb8\u4e0e\u96c6\u7c07\u62e5\u6709\u8005\u540c\u7ec4\u7684\u4efb\u4f55\u7528\u6237\u8bfb\u53d6\u96c6\u7c07\u4e2d\u7684\u6587\u4ef6\u3002\u8fd9\u5bf9\u7531\u975e\u7279\u6743\u7528\u6237\u6267\u884c\u5907\u4efd\u5f88\u6709\u7528\u3002</p>\n<p lang=\"zh\"><code class=\"command\">initdb</code>\u4f1a\u521d\u59cb\u5316\u6570\u636e\u5e93\u96c6\u7c07\u7684\u9ed8\u8ba4\u533a\u57df\u8bbe\u7f6e\u548c\u5b57\u7b26\u96c6\u7f16\u7801\u3002\u5b57\u7b26\u96c6\u7f16\u7801\u3001\u6392\u5e8f\u987a\u5e8f\uff08<code class=\"literal\">LC_COLLATE</code>\uff09\u548c\u5b57\u7b26\u96c6\u5206\u7c7b\uff08<code class=\"literal\">LC_CTYPE</code>\uff0c\u4f8b\u5982\u5927\u5199\u3001\u5c0f\u5199\u3001\u6570\u5b57\uff09\u53ef\u4ee5\u5728\u521b\u5efa\u6570\u636e\u5e93\u65f6\u5355\u72ec\u8bbe\u7f6e\u3002<code class=\"command\">initdb</code>\u4e3a<code class=\"literal\">template1</code>\u6570\u636e\u5e93\u786e\u5b9a\u8fd9\u4e9b\u8bbe\u7f6e\uff0c\u5b83\u4eec\u5c06\u4f5c\u4e3a\u6240\u6709\u5176\u4ed6\u6570\u636e\u5e93\u7684\u9ed8\u8ba4\u503c\u3002</p>\n<p lang=\"zh\">\u8981\u66f4\u6539\u9ed8\u8ba4\u6392\u5e8f\u987a\u5e8f\u6216\u5b57\u7b26\u96c6\u5206\u7c7b\uff0c\u8bf7\u4f7f\u7528<code class=\"option\">--lc-collate</code>\u548c<code class=\"option\">--lc-ctype</code>\u9009\u9879\u3002\u4f7f\u7528<code class=\"literal\">C</code>\u6216<code class=\"literal\">POSIX</code>\u4e4b\u5916\u7684\u6392\u5e8f\u987a\u5e8f\u4e5f\u4f1a\u5e26\u6765\u6027\u80fd\u635f\u5931\u3002\u56e0\u6b64\uff0c\u5728\u8fd0\u884c<code class=\"command\">initdb</code>\u65f6\u9009\u62e9\u6b63\u786e\u7684\u533a\u57df\u8bbe\u7f6e\u5f88\u91cd\u8981\u3002</p>\n<p lang=\"zh\">\u5176\u4f59\u533a\u57df\u8bbe\u7f6e\u7c7b\u522b\u53ef\u4ee5\u5728\u4ee5\u540e\u542f\u52a8\u670d\u52a1\u5668\u65f6\u66f4\u6539\u3002\u8fd8\u53ef\u4ee5\u4f7f\u7528<code class=\"option\">--locale</code>\u8bbe\u7f6e\u6240\u6709\u533a\u57df\u8bbe\u7f6e\u7c7b\u522b\u7684\u9ed8\u8ba4\u503c\uff0c\u5305\u62ec\u6392\u5e8f\u987a\u5e8f\u548c\u5b57\u7b26\u96c6\u5206\u7c7b\u3002\u6240\u6709\u670d\u52a1\u5668\u533a\u57df\u8bbe\u7f6e\u503c\uff08<code class=\"literal\">lc_*</code>\uff09\u90fd\u53ef\u4ee5\u901a\u8fc7<code class=\"command\">SHOW ALL</code>\u663e\u793a\u3002\u66f4\u591a\u7ec6\u8282\u89c1<a class=\"xref\" href=\"/docs/13/charset.html#LOCALE\" title=\"23.1.\u00a0\u533a\u57df\u8bbe\u7f6e\u652f\u6301\">\u7b2c\u00a023.1\u00a0\u8282</a>\u3002</p>\n<p lang=\"zh\">\u8981\u4fee\u6539\u9ed8\u8ba4\u7f16\u7801\uff0c\u8bf7\u4f7f\u7528<code class=\"option\">--encoding</code>\u3002\u66f4\u591a\u7ec6\u8282\u89c1<a class=\"xref\" href=\"/docs/13/multibyte.html\" title=\"23.3.\u00a0\u5b57\u7b26\u96c6\u652f\u6301\">\u7b2c\u00a023.3\u00a0\u8282</a>\u3002</p>\n</div>\n<div class=\"refsect1\" id=\"id-1.9.5.3.6\">\n<h2 lang=\"zh\">\u9009\u9879</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 lang=\"zh\">\u6b64\u9009\u9879\u6307\u5b9a<code class=\"filename\">pg_hba.conf</code>\u4e2d\u672c\u5730\u7528\u6237\u4f7f\u7528\u7684\u9ed8\u8ba4\u8ba4\u8bc1\u65b9\u6cd5\uff08<code class=\"literal\">host</code>\u548c<code class=\"literal\">local</code>\u884c\uff09\u3002<code class=\"command\">initdb</code>\u4f1a\u4f7f\u7528\u6307\u5b9a\u7684\u8ba4\u8bc1\u65b9\u6cd5\uff0c\u4e3a\u975e\u590d\u5236\u8fde\u63a5\u548c\u590d\u5236\u8fde\u63a5\u9884\u5148\u586b\u5145<code class=\"filename\">pg_hba.conf</code>\u6761\u76ee\u3002</p>\n<p lang=\"zh\">\u9664\u975e\u4fe1\u4efb\u7cfb\u7edf\u4e0a\u7684\u6240\u6709\u672c\u5730\u7528\u6237\uff0c\u5426\u5219\u4e0d\u8981\u4f7f\u7528<code class=\"literal\">trust</code>\u3002\u4e3a\u4fbf\u4e8e\u5b89\u88c5\uff0c\u9ed8\u8ba4\u503c\u4e3a<code class=\"literal\">trust</code>\u3002</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 lang=\"zh\">\n<p>\u8be5\u9009\u9879\u6307\u5b9a<code class=\"filename\">pg_hba.conf</code>\u4e2d\u672c\u5730\u7528\u6237\u901a\u8fc7 TCP/IP \u8fde\u63a5\u65f6\uff08<code class=\"literal\">host</code> \u884c\uff09\u4f7f\u7528\u7684\u8ba4\u8bc1\u65b9\u6cd5\u3002</p>\n</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 lang=\"zh\">\n<p>\u8be5\u9009\u9879\u6307\u5b9a<code class=\"filename\">pg_hba.conf</code>\u4e2d\u672c\u5730\u7528\u6237\u901a\u8fc7 Unix \u57df\u5957\u63a5\u5b57\u8fde\u63a5\u65f6\uff08<code class=\"literal\">local</code> \u884c\uff09\u4f7f\u7528\u7684\u8ba4\u8bc1\u65b9\u6cd5\u3002</p>\n</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 lang=\"zh\">\n<p>\u8be5\u9009\u9879\u6307\u5b9a\u6570\u636e\u5e93\u96c6\u7c07\u5e94\u5b58\u653e\u7684\u76ee\u5f55\u3002\u8fd9\u662f<code class=\"command\">initdb</code>\u6240\u9700\u7684\u552f\u4e00\u4fe1\u606f\uff0c\u4f46\u4e5f\u53ef\u4ee5\u901a\u8fc7\u8bbe\u7f6e<code class=\"envar\">PGDATA</code>\u73af\u5883\u53d8\u91cf\u6765\u7701\u53bb\u663e\u5f0f\u5199\u51fa\u5b83\uff1b\u8fd9\u901a\u5e38\u66f4\u65b9\u4fbf\uff0c\u56e0\u4e3a\u6570\u636e\u5e93\u670d\u52a1\u5668\uff08<code class=\"command\">postgres</code>\uff09\u4e4b\u540e\u4e5f\u53ef\u4ee5\u901a\u8fc7\u540c\u4e00\u53d8\u91cf\u627e\u5230\u6570\u636e\u76ee\u5f55\u3002</p>\n</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 lang=\"zh\">\n<p>\u9009\u62e9\u6a21\u677f\u6570\u636e\u5e93\u7684\u7f16\u7801\u3002\u8fd9\u4e5f\u4f1a\u6210\u4e3a\u4ee5\u540e\u521b\u5efa\u7684\u4efb\u4f55\u6570\u636e\u5e93\u7684\u9ed8\u8ba4\u7f16\u7801\uff0c\u9664\u975e\u5728\u521b\u5efa\u65f6\u8986\u76d6\u5b83\u3002\u9ed8\u8ba4\u503c\u7531\u533a\u57df\u8bbe\u7f6e\u63a8\u5bfc\u800c\u6765\uff0c\u5982\u679c\u65e0\u6cd5\u63a8\u5bfc\uff0c\u5219\u4f7f\u7528<code class=\"literal\">SQL_ASCII</code>\u3002<span class=\"productname\">PostgreSQL</span>\u670d\u52a1\u5668\u652f\u6301\u7684\u5b57\u7b26\u96c6\u5728<a class=\"xref\" href=\"/docs/13/multibyte.html#MULTIBYTE-CHARSET-SUPPORTED\" title=\"23.3.1.\u00a0\u652f\u6301\u7684\u5b57\u7b26\u96c6\">\u7b2c\u00a023.3.1\u00a0\u8282</a>\u4e2d\u4ecb\u7ecd\u3002</p>\n</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 lang=\"zh\">\u5141\u8bb8\u4e0e\u96c6\u7fa4\u6240\u6709\u8005\u540c\u7ec4\u7684\u7528\u6237\u8bfb\u53d6 initdb \u521b\u5efa\u7684\u6240\u6709\u96c6\u7fa4\u6587\u4ef6\u3002Windows \u4e0d\u652f\u6301 POSIX \u98ce\u683c\u7684\u7ec4\u6743\u9650\uff0c\u56e0\u6b64\u4f1a\u5ffd\u7565\u6b64\u9009\u9879\u3002</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 lang=\"zh\">\n<p>\u5728\u6570\u636e\u9875\u4e0a\u4f7f\u7528\u6821\u9a8c\u548c\uff0c\u5e2e\u52a9\u68c0\u6d4b I/O \u7cfb\u7edf\u9020\u6210\u7684\u3001\u5426\u5219\u53ef\u80fd\u6084\u65e0\u58f0\u606f\u7684\u6570\u636e\u635f\u574f\u3002\u542f\u7528\u6821\u9a8c\u548c\u53ef\u80fd\u4f1a\u5e26\u6765\u660e\u663e\u7684\u6027\u80fd\u635f\u5931\u3002\u5982\u679c\u542f\u7528\uff0c\u5c31\u4f1a\u4e3a\u6240\u6709\u6570\u636e\u5e93\u4e2d\u7684\u6240\u6709\u5bf9\u8c61\u8ba1\u7b97\u6821\u9a8c\u548c\u3002\u6240\u6709\u6821\u9a8c\u548c\u5931\u8d25\u90fd\u4f1a\u5728 <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>\u89c6\u56fe\u4e2d\u62a5\u544a\u3002</p>\n</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 lang=\"zh\">\n<p>\u8bbe\u7f6e\u6570\u636e\u5e93\u96c6\u7c07\u7684\u9ed8\u8ba4\u533a\u57df\u8bbe\u7f6e\u3002\u5982\u679c\u672a\u6307\u5b9a\u8be5\u9009\u9879\uff0c\u533a\u57df\u8bbe\u7f6e\u5c06\u7ee7\u627f\u81ea <code class=\"command\">initdb</code>\u8fd0\u884c\u65f6\u6240\u5728\u7684\u73af\u5883\u3002\u533a\u57df\u8bbe\u7f6e\u652f\u6301\u89c1<a class=\"xref\" href=\"/docs/13/charset.html#LOCALE\" title=\"23.1.\u00a0\u533a\u57df\u8bbe\u7f6e\u652f\u6301\">\u7b2c\u00a023.1\u00a0\u8282</a>\u3002</p>\n</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 lang=\"zh\">\n<p>\u7c7b\u4f3c\u4e8e<code class=\"option\">--locale</code>\uff0c\u4f46\u53ea\u5728\u6307\u5b9a\u7684\u7c7b\u522b\u4e2d\u8bbe\u7f6e\u533a\u57df\u8bbe\u7f6e\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--no-locale</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u7b49\u4ef7\u4e8e<code class=\"option\">--locale=C</code>\u3002</p>\n</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 lang=\"zh\">\n<p>\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c<code class=\"command\">initdb</code>\u4f1a\u7b49\u5f85\u6240\u6709\u6587\u4ef6\u5b89\u5168\u5199\u5165\u78c1\u76d8\u3002\u6b64\u9009\u9879\u4f7f<code class=\"command\">initdb</code>\u4e0d\u7b49\u5f85\u5c31\u8fd4\u56de\uff0c\u901f\u5ea6\u66f4\u5feb\uff0c\u4f46\u610f\u5473\u7740\u6b64\u540e\u64cd\u4f5c\u7cfb\u7edf\u5d29\u6e83\u53ef\u80fd\u4f1a\u9020\u6210\u6570\u636e\u76ee\u5f55\u635f\u574f\u3002\u901a\u5e38\uff0c\u6b64\u9009\u9879\u9002\u7528\u4e8e\u6d4b\u8bd5\uff0c\u4f46\u4e0d\u5e94\u5728\u521b\u5efa\u751f\u4ea7\u5b89\u88c5\u65f6\u4f7f\u7528\u3002</p>\n</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 lang=\"zh\">\n<p>\u4f7f<code class=\"command\">initdb</code>\u4ece\u6587\u4ef6\u4e2d\u8bfb\u53d6\u6570\u636e\u5e93\u8d85\u7ea7\u7528\u6237\u7684\u5bc6\u7801\u3002\u6587\u4ef6\u7684\u7b2c\u4e00\u884c\u4f1a\u88ab\u5f53\u4f5c\u5bc6\u7801\u3002</p>\n</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 lang=\"zh\">\n<p>\u5c06\u6240\u6709\u6570\u636e\u5e93\u6587\u4ef6\u5b89\u5168\u5199\u5165\u78c1\u76d8\uff0c\u7136\u540e\u9000\u51fa\u3002\u8fd9\u4e0d\u4f1a\u6267\u884c\u4efb\u4f55\u5e38\u89c4<span class=\"application\">initdb</span>\u64cd\u4f5c\u3002</p>\n</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 lang=\"zh\">\n<p>\u8bbe\u7f6e\u9ed8\u8ba4\u6587\u672c\u68c0\u7d22\u914d\u7f6e\u3002\u66f4\u591a\u4fe1\u606f\u89c1<a class=\"xref\" href=\"/docs/13/runtime-config-client.html#GUC-DEFAULT-TEXT-SEARCH-CONFIG\">default_text_search_config</a>\u3002</p>\n</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 lang=\"zh\">\n<p>\u9009\u62e9\u6570\u636e\u5e93\u8d85\u7ea7\u7528\u6237\u7684\u7528\u6237\u540d\u3002\u9ed8\u8ba4\u503c\u662f\u8fd0\u884c<code class=\"command\">initdb</code>\u7684\u6709\u6548\u7528\u6237\u7684\u540d\u79f0\u3002\u8d85\u7ea7\u7528\u6237\u7684\u540d\u79f0\u672c\u8eab\u5e76\u4e0d\u91cd\u8981\uff0c\u4e0d\u8fc7\u5373\u4f7f\u64cd\u4f5c\u7cfb\u7edf\u7528\u6237\u540d\u79f0\u4e0d\u540c\uff0c\u4e5f\u53ef\u4ee5\u9009\u62e9\u6cbf\u7528\u60ef\u5e38\u7684\u540d\u79f0 <span class=\"systemitem\">postgres</span>\u3002</p>\n</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 lang=\"zh\">\n<p>\u4f7f<code class=\"command\">initdb</code>\u63d0\u793a\u8f93\u5165\u8981\u8d4b\u7ed9\u6570\u636e\u5e93\u8d85\u7ea7\u7528\u6237\u7684\u5bc6\u7801\u3002\u5982\u679c\u4e0d\u6253\u7b97\u4f7f\u7528\u5bc6\u7801\u8ba4\u8bc1\uff0c\u8fd9\u4e00\u70b9\u5e76\u4e0d\u91cd\u8981\u3002\u5426\u5219\uff0c\u5728\u8bbe\u7f6e\u5bc6\u7801\u4e4b\u524d\u5c06\u65e0\u6cd5\u4f7f\u7528\u5bc6\u7801\u8ba4\u8bc1\u3002</p>\n</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 lang=\"zh\">\n<p>\u8be5\u9009\u9879\u6307\u5b9a\u9884\u5199\u5f0f\u65e5\u5fd7\uff08WAL\uff09\u5e94\u5b58\u653e\u7684\u76ee\u5f55\u3002</p>\n</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 lang=\"zh\">\u8bbe\u7f6e WAL \u6bb5\u5927\u5c0f\uff0c\u5355\u4f4d\u4e3a\u5146\u5b57\u8282\u3002\u8fd9\u662f WAL \u65e5\u5fd7\u4e2d\u6bcf\u4e2a\u72ec\u7acb\u6587\u4ef6\u7684\u5927\u5c0f\u3002\u9ed8\u8ba4\u5927\u5c0f\u4e3a 16 \u5146\u5b57\u8282\u3002\u53d6\u503c\u5fc5\u987b\u662f 1 \u5230 1024\uff08\u5146\u5b57\u8282\uff09\u4e4b\u95f4\u7684 2 \u7684\u5e42\u3002\u6b64\u9009\u9879\u53ea\u80fd\u5728\u521d\u59cb\u5316\u65f6\u8bbe\u7f6e\uff0c\u4e4b\u540e\u65e0\u6cd5\u66f4\u6539\u3002</p>\n<p lang=\"zh\">\u8c03\u6574\u8be5\u5927\u5c0f\u53ef\u80fd\u6709\u52a9\u4e8e\u63a7\u5236 WAL \u65e5\u5fd7\u4f20\u9001\u6216\u5f52\u6863\u7684\u7c92\u5ea6\u3002\u6b64\u5916\uff0c\u5728 WAL \u91cf\u5f88\u5927\u7684\u6570\u636e\u5e93\u4e2d\uff0c\u6bcf\u4e2a\u76ee\u5f55\u4e2d\u7684 WAL \u6587\u4ef6\u6570\u91cf\u53ef\u80fd\u4f1a\u6210\u4e3a\u6027\u80fd\u548c\u7ba1\u7406\u95ee\u9898\u3002\u589e\u5927 WAL \u6587\u4ef6\u5927\u5c0f\u4f1a\u51cf\u5c11 WAL \u6587\u4ef6\u6570\u91cf\u3002</p>\n</dd>\n</dl>\n</div>\n<p lang=\"zh\">\u8fd8\u53ef\u4ee5\u4f7f\u7528\u4ee5\u4e0b\u8f83\u5c11\u7528\u5230\u7684\u9009\u9879\uff1a</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 lang=\"zh\">\n<p>\u6253\u5370\u5f15\u5bfc\u540e\u7aef\u7684\u8c03\u8bd5\u8f93\u51fa\uff0c\u4ee5\u53ca\u5c11\u91cf\u666e\u901a\u7528\u6237\u901a\u5e38\u4e0d\u611f\u5174\u8da3\u7684\u5176\u4ed6\u6d88\u606f\u3002\u5f15\u5bfc\u540e\u7aef\u662f <code class=\"command\">initdb</code>\u7528\u6765\u521b\u5efa\u7cfb\u7edf\u76ee\u5f55\u8868\u7684\u7a0b\u5e8f\u3002\u8be5\u9009\u9879\u4f1a\u4ea7\u751f\u5927\u91cf\u6781\u5176\u4e4f\u5473\u7684\u8f93\u51fa\u3002</p>\n</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 lang=\"zh\">\n<p>\u6307\u5b9a<code class=\"command\">initdb</code>\u521d\u59cb\u5316\u6570\u636e\u5e93\u96c6\u7c07\u65f6\u5e94\u5230\u54ea\u91cc\u67e5\u627e\u5176\u8f93\u5165\u6587\u4ef6\u3002\u901a\u5e38\u4e0d\u9700\u8981\u8fd9\u6837\u505a\u3002\u82e5\u9700\u8981\u663e\u5f0f\u6307\u5b9a\u5176\u4f4d\u7f6e\uff0c\u7cfb\u7edf\u4f1a\u63d0\u793a\u3002</p>\n</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 lang=\"zh\">\n<p>\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c\u5982\u679c<code class=\"command\">initdb</code>\u53d1\u73b0\u67d0\u4e2a\u9519\u8bef\u4f7f\u5176\u65e0\u6cd5\u5b8c\u6574\u521b\u5efa\u6570\u636e\u5e93\u96c6\u7c07\uff0c\u5c31\u4f1a\u5220\u9664\u5b83\u5728\u53d1\u73b0\u65e0\u6cd5\u5b8c\u6210\u4efb\u52a1\u4e4b\u524d\u53ef\u80fd\u5df2\u521b\u5efa\u7684\u6240\u6709\u6587\u4ef6\u3002\u8be5\u9009\u9879\u4f1a\u7981\u6b62\u8fd9\u79cd\u6e05\u7406\uff0c\u56e0\u6b64\u5bf9\u8c03\u8bd5\u6709\u7528\u3002</p>\n</p>\n</dd>\n</dl>\n</div>\n<p lang=\"zh\">\u5176\u4ed6\u9009\u9879\uff1a</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 lang=\"zh\">\n<p>\u6253\u5370<span class=\"application\">initdb</span>\u7248\u672c\u5e76\u9000\u51fa\u3002</p>\n</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 lang=\"zh\">\n<p>\u663e\u793a\u6709\u5173<span class=\"application\">initdb</span>\u547d\u4ee4\u884c\u53c2\u6570\u7684\u5e2e\u52a9\u5e76\u9000\u51fa\u3002</p>\n</p>\n</dd>\n</dl>\n</div>\n</div>\n<div class=\"refsect1\" id=\"id-1.9.5.3.7\">\n<h2 lang=\"zh\">\u73af\u5883</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 lang=\"zh\">\n<p>\u6307\u5b9a\u6570\u636e\u5e93\u96c6\u7c07\u5e94\u5b58\u653e\u7684\u76ee\u5f55\uff1b\u53ef\u4f7f\u7528<code class=\"option\">-D</code>\u9009\u9879\u8986\u76d6\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"envar\">PG_COLOR</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6307\u5b9a\u662f\u5426\u5728\u8bca\u65ad\u6d88\u606f\u4e2d\u4f7f\u7528\u989c\u8272\u3002\u53ef\u80fd\u7684\u503c\u4e3a<code class=\"literal\">always</code>\u3001<code class=\"literal\">auto</code>\u548c<code class=\"literal\">never</code>\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"envar\">TZ</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6307\u5b9a\u6240\u521b\u5efa\u6570\u636e\u5e93\u96c6\u7c07\u7684\u9ed8\u8ba4\u65f6\u533a\u3002\u8be5\u503c\u5e94\u4e3a\u5b8c\u6574\u7684\u65f6\u533a\u540d\u79f0\uff08\u89c1<a class=\"xref\" href=\"/docs/13/datatype-datetime.html#DATATYPE-TIMEZONES\" title=\"8.5.3.\u00a0\u65f6\u533a\">\u7b2c\u00a08.5.3\u00a0\u8282</a>\uff09\u3002</p>\n</p>\n</dd>\n</dl>\n</div>\n</div>\n<div class=\"refsect1\" id=\"id-1.9.5.3.8\">\n<h2 lang=\"zh\">\u6ce8\u89e3</h2>\n<p lang=\"zh\">\u4e5f\u53ef\u4ee5\u901a\u8fc7 pg_ctl initdb \u8c03\u7528 initdb\u3002</p>\n</div>\n<div class=\"refsect1\" id=\"id-1.9.5.3.9\">\n<h2 lang=\"zh\">\u53e6\u89c1</h2><span class=\"simplelist\"><a class=\"xref\" href=\"https://pg.center/docs/13/app-pg-ctl.html\" title=\"pg_ctl\"><span class=\"refentrytitle\"><span class=\"application\">pg_ctl</span></span></a>, <a class=\"xref\" href=\"https://pg.center/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", "localization": {"status": "complete", "sources": [{"url": "/docs/13/app-initdb.html", "method": "same-major semantic node", "sha256": "7c1f014411af6168bcd3d99b239d986f3c18e8b9e66280c26e82ec7d087317a9", "language": "zh", "matched_nodes": ["#APP-INITDB/div[2]/p[1]", "#APP-INITDB/div[3]/h2[0]", "#APP-INITDB/div[4]/p[1]", "#APP-INITDB/div[4]/p[2]", "#APP-INITDB/div[4]/p[3]", "#APP-INITDB/div[4]/p[4]", "#APP-INITDB/div[4]/p[5]", "#APP-INITDB/div[4]/p[6]", "#APP-INITDB/div[4]/p[7]", "#APP-INITDB/div[4]/p[8]", "#APP-INITDB/div[4]/p[9]", "#APP-INITDB/div[5]/div[1]/dl[0]/dd[11]", "#APP-INITDB/div[5]/div[1]/dl[0]/dd[13]", "#APP-INITDB/div[5]/div[1]/dl[0]/dd[15]", "#APP-INITDB/div[5]/div[1]/dl[0]/dd[17]", "#APP-INITDB/div[5]/div[1]/dl[0]/dd[19]", "#APP-INITDB/div[5]/div[1]/dl[0]/dd[1]/p[0]", "#APP-INITDB/div[5]/div[1]/dl[0]/dd[1]/p[1]", "#APP-INITDB/div[5]/div[1]/dl[0]/dd[21]", "#APP-INITDB/div[5]/div[1]/dl[0]/dd[23]", "#APP-INITDB/div[5]/div[1]/dl[0]/dd[25]", "#APP-INITDB/div[5]/div[1]/dl[0]/dd[27]", "#APP-INITDB/div[5]/div[1]/dl[0]/dd[29]", "#APP-INITDB/div[5]/div[1]/dl[0]/dd[31]", "#APP-INITDB/div[5]/div[1]/dl[0]/dd[33]", "#APP-INITDB/div[5]/div[1]/dl[0]/dd[35]/p[1]", "#APP-INITDB/div[5]/div[1]/dl[0]/dd[3]", "#APP-INITDB/div[5]/div[1]/dl[0]/dd[5]", "#APP-INITDB/div[5]/div[1]/dl[0]/dd[7]", "#APP-INITDB/div[5]/div[1]/dl[0]/dd[9]", "#APP-INITDB/div[5]/div[3]/dl[0]/dd[1]", "#APP-INITDB/div[5]/div[3]/dl[0]/dd[3]", "#APP-INITDB/div[5]/div[3]/dl[0]/dd[5]", "#APP-INITDB/div[5]/div[5]/dl[0]/dd[1]", "#APP-INITDB/div[5]/div[5]/dl[0]/dd[3]", "#APP-INITDB/div[5]/p[2]", "#APP-INITDB/div[5]/p[4]", "#APP-INITDB/div[6]/div[1]/dl[0]/dd[1]", "#APP-INITDB/div[6]/div[1]/dl[0]/dd[3]", "#APP-INITDB/div[6]/div[1]/dl[0]/dd[5]", "#APP-INITDB/div[6]/h2[0]", "#APP-INITDB/div[7]/h2[0]", "#APP-INITDB/div[8]/h2[0]"]}], "language": "zh", "original_text": {"/versions/13/description/0": "initdb \u2014 create a new PostgreSQL database cluster", "/versions/13/facts/0/label": "Documented executable", "/versions/13/facts/1/label": "Executable version", "/versions/13/facts/2/label": "Reference inventory", "/versions/13/facts/2/value": "Server applications", "/versions/13/facts/3/label": "Option definition groups", "/versions/13/tables/0/title": "Documented options", "/versions/13/tables/1/title": "Environment variables", "/versions/13/tables/0/rows/0/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.", "/versions/13/tables/0/rows/1/summary": "This option specifies the authentication method for local users via TCP/IP connections used in pg_hba.conf ( host lines).", "/versions/13/tables/0/rows/2/summary": "This option specifies the authentication method for local users via Unix-domain socket connections used in pg_hba.conf ( local lines).", "/versions/13/tables/0/rows/3/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.", "/versions/13/tables/0/rows/4/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 .", "/versions/13/tables/0/rows/5/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.", "/versions/13/tables/0/rows/6/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.", "/versions/13/tables/0/rows/7/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 .", "/versions/13/tables/0/rows/8/summary": "Like --locale , but only sets the locale in the specified category.", "/versions/13/tables/0/rows/9/summary": "Equivalent to --locale=C .", "/versions/13/tables/0/columns/0/label": "Option and arguments", "/versions/13/tables/0/columns/1/label": "Description", "/versions/13/tables/0/rows/10/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.", "/versions/13/tables/0/rows/11/summary": "Makes initdb read the database superuser's password from a file. The first line of the file is taken as the password.", "/versions/13/tables/0/rows/12/summary": "Safely write all database files to disk and exit. This does not perform any of the normal initdb operations.", "/versions/13/tables/0/rows/13/summary": "Sets the default text search configuration. See default_text_search_config for further information.", "/versions/13/tables/0/rows/14/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.", "/versions/13/tables/0/rows/15/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.", "/versions/13/tables/0/rows/16/summary": "This option specifies the directory where the write-ahead log should be stored.", "/versions/13/tables/0/rows/17/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.", "/versions/13/tables/0/rows/18/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.", "/versions/13/tables/0/rows/19/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.", "/versions/13/tables/0/rows/20/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.", "/versions/13/tables/0/rows/21/summary": "Print the initdb version and exit.", "/versions/13/tables/0/rows/22/summary": "Show help about initdb command line arguments, and exit.", "/versions/13/tables/1/columns/0/label": "Variable", "/versions/13/tables/1/columns/1/label": "Meaning", "/versions/13/tables/1/rows/0/description": "Specifies the directory where the database cluster is to be stored; can be overridden using the -D option.", "/versions/13/tables/1/rows/1/description": "Specifies whether to use color in diagnostic messages. Possible values are always , auto and never .", "/versions/13/tables/1/rows/2/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 )."}, "fallback_fields": [], "source_language": "en", "original_snapshot_sha256": "324d144940b8aa0439d006b9f34cb3c9538931f2125b2e20a5d934f1f85c0d22"}, "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", "manual_language": "zh"}, "14": {"facts": [{"label": "\u624b\u518c\u4e2d\u7684\u53ef\u6267\u884c\u7a0b\u5e8f", "value": "initdb"}, {"label": "\u7a0b\u5e8f\u7248\u672c", "value": "14.24"}, {"label": "\u53c2\u8003\u6e05\u5355", "value": "\u670d\u52a1\u7aef\u7a0b\u5e8f"}, {"label": "\u9009\u9879\u5b9a\u4e49\u7ec4", "value": "25"}], "tables": [{"key": "options", "rows": [{"summary": "\u6b64\u9009\u9879\u6307\u5b9a pg_hba.conf \u4e2d\u672c\u5730\u7528\u6237\u4f7f\u7528\u7684\u9ed8\u8ba4\u8ba4\u8bc1\u65b9\u6cd5\uff08 host \u548c local \u884c\uff09\u3002 initdb \u4f1a\u4f7f\u7528\u6307\u5b9a\u7684\u8ba4\u8bc1\u65b9\u6cd5\uff0c\u4e3a\u975e\u590d\u5236\u8fde\u63a5\u548c\u590d\u5236\u8fde\u63a5\u9884\u5148\u586b\u5145 pg_hba.conf \u6761\u76ee\u3002", "signature": {"url": "/docs/14/app-initdb.html", "text": "-A authmethod --auth= authmethod"}}, {"summary": "\u8be5\u9009\u9879\u6307\u5b9a pg_hba.conf \u4e2d\u672c\u5730\u7528\u6237\u901a\u8fc7 TCP/IP \u8fde\u63a5\u65f6\uff08 host \u884c\uff09\u4f7f\u7528\u7684\u8ba4\u8bc1\u65b9\u6cd5\u3002", "signature": {"url": "/docs/14/app-initdb.html", "text": "--auth-host= authmethod"}}, {"summary": "\u8be5\u9009\u9879\u6307\u5b9a pg_hba.conf \u4e2d\u672c\u5730\u7528\u6237\u901a\u8fc7 Unix \u57df\u5957\u63a5\u5b57\u8fde\u63a5\u65f6\uff08 local \u884c\uff09\u4f7f\u7528\u7684\u8ba4\u8bc1\u65b9\u6cd5\u3002", "signature": {"url": "/docs/14/app-initdb.html", "text": "--auth-local= authmethod"}}, {"summary": "\u8be5\u9009\u9879\u6307\u5b9a\u6570\u636e\u5e93\u96c6\u7c07\u5e94\u5b58\u653e\u7684\u76ee\u5f55\u3002\u8fd9\u662f initdb \u6240\u9700\u7684\u552f\u4e00\u4fe1\u606f\uff0c\u4f46\u4e5f\u53ef\u4ee5\u901a\u8fc7\u8bbe\u7f6e PGDATA \u73af\u5883\u53d8\u91cf\u6765\u7701\u53bb\u663e\u5f0f\u5199\u51fa\u5b83\uff1b\u8fd9\u901a\u5e38\u66f4\u65b9\u4fbf\uff0c\u56e0\u4e3a\u6570\u636e\u5e93\u670d\u52a1\u5668\uff08 postgres \uff09\u4e4b\u540e\u4e5f\u53ef\u4ee5\u901a\u8fc7\u540c\u4e00\u53d8\u91cf\u627e\u5230\u6570\u636e\u76ee\u5f55\u3002", "signature": {"url": "/docs/14/app-initdb.html", "text": "-D directory --pgdata= directory"}}, {"summary": "\u9009\u62e9\u6a21\u677f\u6570\u636e\u5e93\u7684\u7f16\u7801\u3002\u8fd9\u4e5f\u4f1a\u6210\u4e3a\u4ee5\u540e\u521b\u5efa\u7684\u4efb\u4f55\u6570\u636e\u5e93\u7684\u9ed8\u8ba4\u7f16\u7801\uff0c\u9664\u975e\u5728\u521b\u5efa\u65f6\u8986\u76d6\u5b83\u3002\u9ed8\u8ba4\u503c\u7531\u533a\u57df\u8bbe\u7f6e\u63a8\u5bfc\u800c\u6765\uff0c\u5982\u679c\u65e0\u6cd5\u63a8\u5bfc\uff0c\u5219\u4f7f\u7528 SQL_ASCII \u3002 PostgreSQL \u670d\u52a1\u5668\u652f\u6301\u7684\u5b57\u7b26\u96c6\u5728 \u7b2c 24.3.1 \u8282 \u4e2d\u4ecb\u7ecd\u3002", "signature": {"url": "/docs/14/app-initdb.html", "text": "-E encoding --encoding= encoding"}}, {"summary": "\u5141\u8bb8\u4e0e\u96c6\u7c07\u62e5\u6709\u8005\u540c\u7ec4\u7684\u7528\u6237\u8bfb\u53d6\u7531 initdb \u521b\u5efa\u7684\u6240\u6709\u96c6\u7c07\u6587\u4ef6\u3002\u8be5\u9009\u9879\u5728 Windows \u4e0a\u4f1a\u88ab\u5ffd\u7565\uff0c\u56e0\u4e3a\u5b83\u4e0d\u652f\u6301 POSIX \u98ce\u683c\u7684\u7ec4\u6743\u9650\u3002", "signature": {"url": "/docs/14/app-initdb.html#APP-INITDB-ALLOW-GROUP-ACCESS", "text": "-g --allow-group-access"}}, {"summary": "\u5728\u6570\u636e\u9875\u4e0a\u4f7f\u7528\u6821\u9a8c\u548c\uff0c\u5e2e\u52a9\u68c0\u6d4b I/O \u7cfb\u7edf\u9020\u6210\u7684\u3001\u5426\u5219\u53ef\u80fd\u6084\u65e0\u58f0\u606f\u7684\u6570\u636e\u635f\u574f\u3002\u542f\u7528\u6821\u9a8c\u548c\u53ef\u80fd\u4f1a\u5e26\u6765\u660e\u663e\u7684\u6027\u80fd\u635f\u5931\u3002\u5982\u679c\u542f\u7528\uff0c\u5c31\u4f1a\u4e3a\u6240\u6709\u6570\u636e\u5e93\u4e2d\u7684\u6240\u6709\u5bf9\u8c61\u8ba1\u7b97\u6821\u9a8c\u548c\u3002\u6240\u6709\u6821\u9a8c\u548c\u5931\u8d25\u90fd\u4f1a\u5728 pg_stat_database \u89c6\u56fe\u4e2d\u62a5\u544a\u3002\u8be6\u89c1 \u7b2c 30.2 \u8282 \u3002", "signature": {"url": "/docs/14/app-initdb.html#APP-INITDB-DATA-CHECKSUMS", "text": "-k --data-checksums"}}, {"summary": "\u8bbe\u7f6e\u6570\u636e\u5e93\u96c6\u7c07\u7684\u9ed8\u8ba4\u533a\u57df\u8bbe\u7f6e\u3002\u5982\u679c\u672a\u6307\u5b9a\u8be5\u9009\u9879\uff0c\u533a\u57df\u8bbe\u7f6e\u5c06\u7ee7\u627f\u81ea initdb \u8fd0\u884c\u65f6\u6240\u5728\u7684\u73af\u5883\u3002\u533a\u57df\u8bbe\u7f6e\u652f\u6301\u89c1 \u7b2c 24.1 \u8282 \u3002", "signature": {"url": "/docs/14/app-initdb.html", "text": "--locale= locale"}}, {"summary": "\u7c7b\u4f3c\u4e8e --locale \uff0c\u4f46\u53ea\u5728\u6307\u5b9a\u7684\u7c7b\u522b\u4e2d\u8bbe\u7f6e\u533a\u57df\u8bbe\u7f6e\u3002", "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": "\u7b49\u4ef7\u4e8e --locale=C \u3002", "signature": {"url": "/docs/14/app-initdb.html", "text": "--no-locale"}}, {"summary": "\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c initdb \u4f1a\u7b49\u5f85\u6240\u6709\u6587\u4ef6\u90fd\u5b89\u5168\u5199\u5165\u78c1\u76d8\u3002\u8be5\u9009\u9879\u4f7f initdb \u5728\u4e0d\u7b49\u5f85\u7684\u60c5\u51b5\u4e0b\u8fd4\u56de\uff0c\u901f\u5ea6\u66f4\u5feb\uff0c\u4f46\u8fd9\u610f\u5473\u7740\u5982\u679c\u540e\u7eed\u64cd\u4f5c\u7cfb\u7edf\u5d29\u6e83\uff0c\u6570\u636e\u76ee\u5f55\u53ef\u80fd\u4f1a\u635f\u574f\u3002\u901a\u5e38\uff0c\u8be5\u9009\u9879\u9002\u7528\u4e8e\u6d4b\u8bd5\uff0c\u4f46\u4e0d\u5e94\u7528\u4e8e\u521b\u5efa\u751f\u4ea7\u73af\u5883\u5b89\u88c5\u3002", "signature": {"url": "/docs/14/app-initdb.html", "text": "-N --no-sync"}}, {"summary": "\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c initdb \u4f1a\u5728\u5176\u8f93\u51fa\u672b\u5c3e\u5199\u51fa\u5982\u4f55\u542f\u52a8\u96c6\u7c07\u7684\u8bf4\u660e\u3002\u8be5\u9009\u9879\u4f1a\u7701\u7565\u8fd9\u4e9b\u8bf4\u660e\u3002\u5b83\u4e3b\u8981\u4f9b\u90a3\u4e9b\u5bf9 initdb \u8fdb\u884c\u5e73\u53f0\u7279\u5b9a\u5c01\u88c5\u7684\u5de5\u5177\u4f7f\u7528\uff0c\u56e0\u4e3a\u5728\u8fd9\u79cd\u60c5\u51b5\u4e0b\u90a3\u4e9b\u8bf4\u660e\u5f88\u53ef\u80fd\u5e76\u4e0d\u6b63\u786e\u3002", "signature": {"url": "/docs/14/app-initdb.html", "text": "--no-instructions"}}, {"summary": "\u4f7f initdb \u4ece\u6587\u4ef6\u4e2d\u8bfb\u53d6\u6570\u636e\u5e93\u8d85\u7ea7\u7528\u6237\u7684\u5bc6\u7801\u3002\u6587\u4ef6\u7684\u7b2c\u4e00\u884c\u4f1a\u88ab\u5f53\u4f5c\u5bc6\u7801\u3002", "signature": {"url": "/docs/14/app-initdb.html", "text": "--pwfile= filename"}}, {"summary": "\u5c06\u6240\u6709\u6570\u636e\u5e93\u6587\u4ef6\u5b89\u5168\u5199\u5165\u78c1\u76d8\uff0c\u7136\u540e\u9000\u51fa\u3002\u8fd9\u4e0d\u4f1a\u6267\u884c\u4efb\u4f55\u5e38\u89c4 initdb \u64cd\u4f5c\u3002", "signature": {"url": "/docs/14/app-initdb.html", "text": "-S --sync-only"}}, {"summary": "\u8bbe\u7f6e\u9ed8\u8ba4\u6587\u672c\u68c0\u7d22\u914d\u7f6e\u3002\u66f4\u591a\u4fe1\u606f\u89c1 default_text_search_config \u3002", "signature": {"url": "/docs/14/app-initdb.html", "text": "-T config --text-search-config= config"}}, {"summary": "\u9009\u62e9\u6570\u636e\u5e93\u8d85\u7ea7\u7528\u6237\u7684\u7528\u6237\u540d\u3002\u9ed8\u8ba4\u503c\u662f\u8fd0\u884c initdb \u7684\u6709\u6548\u7528\u6237\u7684\u540d\u79f0\u3002\u8d85\u7ea7\u7528\u6237\u7684\u540d\u79f0\u672c\u8eab\u5e76\u4e0d\u91cd\u8981\uff0c\u4e0d\u8fc7\u5373\u4f7f\u64cd\u4f5c\u7cfb\u7edf\u7528\u6237\u540d\u79f0\u4e0d\u540c\uff0c\u4e5f\u53ef\u4ee5\u9009\u62e9\u6cbf\u7528\u60ef\u5e38\u7684\u540d\u79f0 postgres \u3002", "signature": {"url": "/docs/14/app-initdb.html", "text": "-U username --username= username"}}, {"summary": "\u4f7f initdb \u63d0\u793a\u8f93\u5165\u8981\u8d4b\u7ed9\u6570\u636e\u5e93\u8d85\u7ea7\u7528\u6237\u7684\u5bc6\u7801\u3002\u5982\u679c\u4e0d\u6253\u7b97\u4f7f\u7528\u5bc6\u7801\u8ba4\u8bc1\uff0c\u8fd9\u4e00\u70b9\u5e76\u4e0d\u91cd\u8981\u3002\u5426\u5219\uff0c\u5728\u8bbe\u7f6e\u5bc6\u7801\u4e4b\u524d\u5c06\u65e0\u6cd5\u4f7f\u7528\u5bc6\u7801\u8ba4\u8bc1\u3002", "signature": {"url": "/docs/14/app-initdb.html", "text": "-W --pwprompt"}}, {"summary": "\u8be5\u9009\u9879\u6307\u5b9a\u9884\u5199\u5f0f\u65e5\u5fd7\uff08WAL\uff09\u5e94\u5b58\u653e\u7684\u76ee\u5f55\u3002", "signature": {"url": "/docs/14/app-initdb.html", "text": "-X directory --waldir= directory"}}, {"summary": "\u8bbe\u7f6e WAL \u6bb5\u5927\u5c0f\uff0c\u5355\u4f4d\u4e3a\u5146\u5b57\u8282\u3002\u8fd9\u662f WAL \u65e5\u5fd7\u4e2d\u6bcf\u4e2a\u72ec\u7acb\u6587\u4ef6\u7684\u5927\u5c0f\u3002\u9ed8\u8ba4\u5927\u5c0f\u4e3a 16 \u5146\u5b57\u8282\u3002\u53d6\u503c\u5fc5\u987b\u662f 1 \u5230 1024\uff08\u5146\u5b57\u8282\uff09\u4e4b\u95f4\u7684 2 \u7684\u5e42\u3002\u6b64\u9009\u9879\u53ea\u80fd\u5728\u521d\u59cb\u5316\u65f6\u8bbe\u7f6e\uff0c\u4e4b\u540e\u65e0\u6cd5\u66f4\u6539\u3002", "signature": {"url": "/docs/14/app-initdb.html", "text": "--wal-segsize= size"}}, {"summary": "\u6253\u5370\u5f15\u5bfc\u540e\u7aef\u7684\u8c03\u8bd5\u8f93\u51fa\uff0c\u4ee5\u53ca\u5c11\u91cf\u666e\u901a\u7528\u6237\u901a\u5e38\u4e0d\u611f\u5174\u8da3\u7684\u5176\u4ed6\u6d88\u606f\u3002\u5f15\u5bfc\u540e\u7aef\u662f initdb \u7528\u6765\u521b\u5efa\u7cfb\u7edf\u76ee\u5f55\u8868\u7684\u7a0b\u5e8f\u3002\u8be5\u9009\u9879\u4f1a\u4ea7\u751f\u5927\u91cf\u6781\u5176\u4e4f\u5473\u7684\u8f93\u51fa\u3002", "signature": {"url": "/docs/14/app-initdb.html", "text": "-d --debug"}}, {"summary": "\u4f7f\u7528 debug_discard_caches=1 \u9009\u9879\u8fd0\u884c\u5f15\u5bfc\u540e\u7aef\u3002\u8fd9\u4f1a\u82b1\u8d39\u5f88\u957f\u65f6\u95f4\uff0c\u53ea\u5bf9\u6df1\u5ea6\u8c03\u8bd5\u6709\u7528\u3002", "signature": {"url": "/docs/14/app-initdb.html", "text": "--discard-caches"}}, {"summary": "\u6307\u5b9a initdb \u521d\u59cb\u5316\u6570\u636e\u5e93\u96c6\u7c07\u65f6\u5e94\u5230\u54ea\u91cc\u67e5\u627e\u5176\u8f93\u5165\u6587\u4ef6\u3002\u901a\u5e38\u4e0d\u9700\u8981\u8fd9\u6837\u505a\u3002\u82e5\u9700\u8981\u663e\u5f0f\u6307\u5b9a\u5176\u4f4d\u7f6e\uff0c\u7cfb\u7edf\u4f1a\u63d0\u793a\u3002", "signature": {"url": "/docs/14/app-initdb.html", "text": "-L directory"}}, {"summary": "\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c\u5982\u679c initdb \u53d1\u73b0\u67d0\u4e2a\u9519\u8bef\u4f7f\u5176\u65e0\u6cd5\u5b8c\u6574\u521b\u5efa\u6570\u636e\u5e93\u96c6\u7c07\uff0c\u5c31\u4f1a\u5220\u9664\u5b83\u5728\u53d1\u73b0\u65e0\u6cd5\u5b8c\u6210\u4efb\u52a1\u4e4b\u524d\u53ef\u80fd\u5df2\u521b\u5efa\u7684\u6240\u6709\u6587\u4ef6\u3002\u8be5\u9009\u9879\u4f1a\u7981\u6b62\u8fd9\u79cd\u6e05\u7406\uff0c\u56e0\u6b64\u5bf9\u8c03\u8bd5\u6709\u7528\u3002", "signature": {"url": "/docs/14/app-initdb.html", "text": "-n --no-clean"}}, {"summary": "\u6253\u5370 initdb \u7248\u672c\u5e76\u9000\u51fa\u3002", "signature": {"url": "/docs/14/app-initdb.html", "text": "-V --version"}}, {"summary": "\u663e\u793a\u6709\u5173 initdb \u547d\u4ee4\u884c\u53c2\u6570\u7684\u5e2e\u52a9\u5e76\u9000\u51fa\u3002", "signature": {"url": "/docs/14/app-initdb.html", "text": "-? --help"}}], "title": "\u624b\u518c\u4e2d\u7684\u9009\u9879", "columns": [{"key": "signature", "label": "\u9009\u9879\u4e0e\u53c2\u6570"}, {"key": "summary", "label": "\u8bf4\u660e"}]}, {"key": "environment", "rows": [{"name": "PGDATA", "description": "\u6307\u5b9a\u6570\u636e\u5e93\u96c6\u7c07\u5e94\u5b58\u653e\u7684\u76ee\u5f55\uff1b\u53ef\u4f7f\u7528 -D \u9009\u9879\u8986\u76d6\u3002"}, {"name": "PG_COLOR", "description": "\u6307\u5b9a\u8bca\u65ad\u6d88\u606f\u662f\u5426\u4f7f\u7528\u989c\u8272\u3002\u53ef\u9009\u503c\u4e3a always \u3001 auto \u548c never \u3002"}, {"name": "TZ", "description": "\u6307\u5b9a\u6240\u521b\u5efa\u6570\u636e\u5e93\u96c6\u7c07\u7684\u9ed8\u8ba4\u65f6\u533a\u3002\u8be5\u503c\u5e94\u4e3a\u5b8c\u6574\u7684\u65f6\u533a\u540d\u79f0\uff08\u89c1 \u7b2c 8.5.3 \u8282 \uff09\u3002"}], "title": "\u73af\u5883\u53d8\u91cf", "columns": [{"key": "name", "label": "\u53d8\u91cf"}, {"key": "description", "label": "\u542b\u4e49"}]}], "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": "https://pg.center/docs/14/app-initdb.html", "file": "app-initdb.html", "label": "14.24 English manual \u00b7 app-initdb.html", "anchor": "", "sha256": "121b9021b6a64ab299a3be4821e567065afd5aca067bb7ed1bfd605913f3d2be", "language": "en", "original_url": "/docs/14/app-initdb.html"}, {"url": "https://pg.center/docs/14/reference-server.html", "file": "reference-server.html", "label": "Server applications inventory", "anchor": "", "sha256": "db0cdccaa8d3c65ad3b2a07d4956eb5a783a18505bfa0f9d9626eef4ab94fe44", "language": "en", "original_url": "/docs/14/reference-server.html"}], "sections": [], "synopsis": ["initdb [ option ...] [ --pgdata | -D ] directory"], "signature": "initdb [ option ...] [ --pgdata | -D ] directory", "description": ["initdb \u2014 \u521b\u5efa\u4e00\u4e2a\u65b0\u7684 PostgreSQL \u6570\u636e\u5e93\u96c6\u7c07"], "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 lang=\"zh\">initdb \u2014 \u521b\u5efa\u4e00\u4e2a\u65b0\u7684<span class=\"productname\">PostgreSQL</span>\u6570\u636e\u5e93\u96c6\u7c07</p>\n</div>\n<div class=\"refsynopsisdiv\">\n<h2 lang=\"zh\">\u5927\u7eb2</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 lang=\"zh\">\u8bf4\u660e</h2>\n<p lang=\"zh\"><code class=\"command\">initdb</code>\u521b\u5efa\u4e00\u4e2a\u65b0\u7684<span class=\"productname\">PostgreSQL</span>\u6570\u636e\u5e93\u96c6\u7c07\u3002\u6570\u636e\u5e93\u96c6\u7c07\u662f\u7531\u5355\u4e2a\u670d\u52a1\u5668\u5b9e\u4f8b\u7ba1\u7406\u7684\u4e00\u7ec4\u6570\u636e\u5e93\u3002</p>\n<p lang=\"zh\">\u521b\u5efa\u6570\u636e\u5e93\u96c6\u7c07\u5305\u62ec\u521b\u5efa\u7528\u4e8e\u5b58\u653e\u6570\u636e\u5e93\u6570\u636e\u7684\u76ee\u5f55\uff0c\u751f\u6210\u5171\u4eab\u7cfb\u7edf\u76ee\u5f55\u8868\uff08\u5c5e\u4e8e\u6574\u4e2a\u96c6\u7c07\u800c\u4e0d\u662f\u67d0\u4e2a\u7279\u5b9a\u6570\u636e\u5e93\u7684\u8868\uff09\uff0c\u4ee5\u53ca\u521b\u5efa<code class=\"literal\">template1</code>\u548c<code class=\"literal\">postgres</code>\u6570\u636e\u5e93\u3002\u4ee5\u540e\u521b\u5efa\u65b0\u6570\u636e\u5e93\u65f6\uff0c\u4f1a\u590d\u5236<code class=\"literal\">template1</code>\u6570\u636e\u5e93\u4e2d\u7684\u6240\u6709\u5185\u5bb9\u3002\uff08\u56e0\u6b64\uff0c\u5b89\u88c5\u5728<code class=\"literal\">template1</code>\u4e2d\u7684\u4efb\u4f55\u4e1c\u897f\u90fd\u4f1a\u81ea\u52a8\u590d\u5236\u5230\u4ee5\u540e\u521b\u5efa\u7684\u6bcf\u4e2a\u6570\u636e\u5e93\u4e2d\u3002\uff09<code class=\"literal\">postgres</code>\u6570\u636e\u5e93\u662f\u4e00\u4e2a\u9ed8\u8ba4\u6570\u636e\u5e93\uff0c\u4f9b\u7528\u6237\u3001\u5de5\u5177\u7a0b\u5e8f\u548c\u7b2c\u4e09\u65b9\u5e94\u7528\u7a0b\u5e8f\u4f7f\u7528\u3002</p>\n<p lang=\"zh\">\u867d\u7136<code class=\"command\">initdb</code>\u4f1a\u5c1d\u8bd5\u521b\u5efa\u6307\u5b9a\u7684\u6570\u636e\u76ee\u5f55\uff0c\u4f46\u5982\u679c\u6240\u9700\u6570\u636e\u76ee\u5f55\u7684\u7236\u76ee\u5f55\u5f52 root \u6240\u6709\uff0c\u5b83\u53ef\u80fd\u6ca1\u6709\u8db3\u591f\u7684\u6743\u9650\u3002\u8981\u5728\u8fd9\u79cd\u73af\u5883\u4e2d\u521d\u59cb\u5316\uff0c\u53ef\u5148\u7531 root \u521b\u5efa\u4e00\u4e2a\u7a7a\u7684\u6570\u636e\u76ee\u5f55\uff0c\u7136\u540e\u7528<code class=\"command\">chown</code>\u5c06\u8be5\u76ee\u5f55\u7684\u6240\u6709\u6743\u8d4b\u4e88\u6570\u636e\u5e93\u7528\u6237\u8d26\u6237\uff0c\u518d\u7528 <code class=\"command\">su</code>\u5207\u6362\u4e3a\u8be5\u6570\u636e\u5e93\u7528\u6237\u6765\u8fd0\u884c<code class=\"command\">initdb</code>\u3002</p>\n<p lang=\"zh\"><code class=\"command\">initdb</code>\u5fc5\u987b\u4ee5\u5c06\u62e5\u6709\u670d\u52a1\u5668\u8fdb\u7a0b\u7684\u7528\u6237\u8eab\u4efd\u8fd0\u884c\uff0c\u56e0\u4e3a\u670d\u52a1\u5668\u9700\u8981\u8bbf\u95ee <code class=\"command\">initdb</code>\u521b\u5efa\u7684\u6587\u4ef6\u548c\u76ee\u5f55\u3002\u7531\u4e8e\u670d\u52a1\u5668\u4e0d\u80fd\u4ee5 root \u8eab\u4efd\u8fd0\u884c\uff0c\u56e0\u6b64\u4e5f\u7edd\u4e0d\u80fd\u4ee5 root \u8eab\u4efd\u8fd0\u884c<code class=\"command\">initdb</code>\u3002\uff08\u5b9e\u9645\u4e0a\u5b83\u4f1a\u62d2\u7edd\u8fd9\u6837\u505a\u3002\uff09</p>\n<p lang=\"zh\">\u51fa\u4e8e\u5b89\u5168\u539f\u56e0\uff0c<code class=\"command\">initdb</code>\u521b\u5efa\u7684\u65b0\u96c6\u7c07\u9ed8\u8ba4\u53ea\u6709\u96c6\u7c07\u62e5\u6709\u8005\u53ef\u4ee5\u8bbf\u95ee\u3002<code class=\"option\">--allow-group-access</code> \u9009\u9879\u5141\u8bb8\u4e0e\u96c6\u7c07\u62e5\u6709\u8005\u540c\u7ec4\u7684\u4efb\u4f55\u7528\u6237\u8bfb\u53d6\u96c6\u7c07\u4e2d\u7684\u6587\u4ef6\u3002\u8fd9\u5bf9\u7531\u975e\u7279\u6743\u7528\u6237\u6267\u884c\u5907\u4efd\u5f88\u6709\u7528\u3002</p>\n<p lang=\"zh\"><code class=\"command\">initdb</code>\u4f1a\u521d\u59cb\u5316\u6570\u636e\u5e93\u96c6\u7c07\u7684\u9ed8\u8ba4\u533a\u57df\u8bbe\u7f6e\u548c\u5b57\u7b26\u96c6\u7f16\u7801\u3002\u5b57\u7b26\u96c6\u7f16\u7801\u3001\u6392\u5e8f\u987a\u5e8f\uff08<code class=\"literal\">LC_COLLATE</code>\uff09\u548c\u5b57\u7b26\u96c6\u5206\u7c7b\uff08<code class=\"literal\">LC_CTYPE</code>\uff0c\u4f8b\u5982\u5927\u5199\u3001\u5c0f\u5199\u3001\u6570\u5b57\uff09\u53ef\u4ee5\u5728\u521b\u5efa\u6570\u636e\u5e93\u65f6\u5355\u72ec\u8bbe\u7f6e\u3002<code class=\"command\">initdb</code>\u4e3a<code class=\"literal\">template1</code>\u6570\u636e\u5e93\u786e\u5b9a\u8fd9\u4e9b\u8bbe\u7f6e\uff0c\u5b83\u4eec\u5c06\u4f5c\u4e3a\u6240\u6709\u5176\u4ed6\u6570\u636e\u5e93\u7684\u9ed8\u8ba4\u503c\u3002</p>\n<p lang=\"zh\">\u8981\u66f4\u6539\u9ed8\u8ba4\u6392\u5e8f\u987a\u5e8f\u6216\u5b57\u7b26\u96c6\u5206\u7c7b\uff0c\u8bf7\u4f7f\u7528<code class=\"option\">--lc-collate</code>\u548c<code class=\"option\">--lc-ctype</code>\u9009\u9879\u3002\u4f7f\u7528<code class=\"literal\">C</code>\u6216<code class=\"literal\">POSIX</code>\u4e4b\u5916\u7684\u6392\u5e8f\u987a\u5e8f\u4e5f\u4f1a\u5e26\u6765\u6027\u80fd\u635f\u5931\u3002\u56e0\u6b64\uff0c\u5728\u8fd0\u884c<code class=\"command\">initdb</code>\u65f6\u9009\u62e9\u6b63\u786e\u7684\u533a\u57df\u8bbe\u7f6e\u5f88\u91cd\u8981\u3002</p>\n<p lang=\"zh\">\u5176\u4f59\u533a\u57df\u8bbe\u7f6e\u7c7b\u522b\u53ef\u4ee5\u5728\u4ee5\u540e\u542f\u52a8\u670d\u52a1\u5668\u65f6\u66f4\u6539\u3002\u8fd8\u53ef\u4ee5\u4f7f\u7528<code class=\"option\">--locale</code>\u8bbe\u7f6e\u6240\u6709\u533a\u57df\u8bbe\u7f6e\u7c7b\u522b\u7684\u9ed8\u8ba4\u503c\uff0c\u5305\u62ec\u6392\u5e8f\u987a\u5e8f\u548c\u5b57\u7b26\u96c6\u5206\u7c7b\u3002\u6240\u6709\u670d\u52a1\u5668\u533a\u57df\u8bbe\u7f6e\u503c\uff08<code class=\"literal\">lc_*</code>\uff09\u90fd\u53ef\u4ee5\u901a\u8fc7<code class=\"command\">SHOW ALL</code>\u663e\u793a\u3002\u66f4\u591a\u7ec6\u8282\u89c1<a class=\"xref\" href=\"/docs/14/charset.html#LOCALE\" title=\"24.1.\u00a0\u533a\u57df\u8bbe\u7f6e\u652f\u6301\">\u7b2c\u00a024.1\u00a0\u8282</a>\u3002</p>\n<p lang=\"zh\">\u8981\u4fee\u6539\u9ed8\u8ba4\u7f16\u7801\uff0c\u8bf7\u4f7f\u7528<code class=\"option\">--encoding</code>\u3002\u66f4\u591a\u7ec6\u8282\u89c1<a class=\"xref\" href=\"/docs/14/multibyte.html\" title=\"24.3.\u00a0\u5b57\u7b26\u96c6\u652f\u6301\">\u7b2c\u00a024.3\u00a0\u8282</a>\u3002</p>\n</div>\n<div class=\"refsect1\" id=\"id-1.9.5.3.6\">\n<h2 lang=\"zh\">\u9009\u9879</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 lang=\"zh\">\u6b64\u9009\u9879\u6307\u5b9a<code class=\"filename\">pg_hba.conf</code>\u4e2d\u672c\u5730\u7528\u6237\u4f7f\u7528\u7684\u9ed8\u8ba4\u8ba4\u8bc1\u65b9\u6cd5\uff08<code class=\"literal\">host</code>\u548c<code class=\"literal\">local</code>\u884c\uff09\u3002<code class=\"command\">initdb</code>\u4f1a\u4f7f\u7528\u6307\u5b9a\u7684\u8ba4\u8bc1\u65b9\u6cd5\uff0c\u4e3a\u975e\u590d\u5236\u8fde\u63a5\u548c\u590d\u5236\u8fde\u63a5\u9884\u5148\u586b\u5145<code class=\"filename\">pg_hba.conf</code>\u6761\u76ee\u3002</p>\n<p lang=\"zh\">\u9664\u975e\u4fe1\u4efb\u7cfb\u7edf\u4e0a\u7684\u6240\u6709\u672c\u5730\u7528\u6237\uff0c\u5426\u5219\u4e0d\u8981\u4f7f\u7528<code class=\"literal\">trust</code>\u3002\u4e3a\u4fbf\u4e8e\u5b89\u88c5\uff0c\u9ed8\u8ba4\u503c\u4e3a<code class=\"literal\">trust</code>\u3002</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 lang=\"zh\">\n<p>\u8be5\u9009\u9879\u6307\u5b9a<code class=\"filename\">pg_hba.conf</code>\u4e2d\u672c\u5730\u7528\u6237\u901a\u8fc7 TCP/IP \u8fde\u63a5\u65f6\uff08<code class=\"literal\">host</code> \u884c\uff09\u4f7f\u7528\u7684\u8ba4\u8bc1\u65b9\u6cd5\u3002</p>\n</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 lang=\"zh\">\n<p>\u8be5\u9009\u9879\u6307\u5b9a<code class=\"filename\">pg_hba.conf</code>\u4e2d\u672c\u5730\u7528\u6237\u901a\u8fc7 Unix \u57df\u5957\u63a5\u5b57\u8fde\u63a5\u65f6\uff08<code class=\"literal\">local</code> \u884c\uff09\u4f7f\u7528\u7684\u8ba4\u8bc1\u65b9\u6cd5\u3002</p>\n</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 lang=\"zh\">\n<p>\u8be5\u9009\u9879\u6307\u5b9a\u6570\u636e\u5e93\u96c6\u7c07\u5e94\u5b58\u653e\u7684\u76ee\u5f55\u3002\u8fd9\u662f<code class=\"command\">initdb</code>\u6240\u9700\u7684\u552f\u4e00\u4fe1\u606f\uff0c\u4f46\u4e5f\u53ef\u4ee5\u901a\u8fc7\u8bbe\u7f6e<code class=\"envar\">PGDATA</code>\u73af\u5883\u53d8\u91cf\u6765\u7701\u53bb\u663e\u5f0f\u5199\u51fa\u5b83\uff1b\u8fd9\u901a\u5e38\u66f4\u65b9\u4fbf\uff0c\u56e0\u4e3a\u6570\u636e\u5e93\u670d\u52a1\u5668\uff08<code class=\"command\">postgres</code>\uff09\u4e4b\u540e\u4e5f\u53ef\u4ee5\u901a\u8fc7\u540c\u4e00\u53d8\u91cf\u627e\u5230\u6570\u636e\u76ee\u5f55\u3002</p>\n</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 lang=\"zh\">\n<p>\u9009\u62e9\u6a21\u677f\u6570\u636e\u5e93\u7684\u7f16\u7801\u3002\u8fd9\u4e5f\u4f1a\u6210\u4e3a\u4ee5\u540e\u521b\u5efa\u7684\u4efb\u4f55\u6570\u636e\u5e93\u7684\u9ed8\u8ba4\u7f16\u7801\uff0c\u9664\u975e\u5728\u521b\u5efa\u65f6\u8986\u76d6\u5b83\u3002\u9ed8\u8ba4\u503c\u7531\u533a\u57df\u8bbe\u7f6e\u63a8\u5bfc\u800c\u6765\uff0c\u5982\u679c\u65e0\u6cd5\u63a8\u5bfc\uff0c\u5219\u4f7f\u7528<code class=\"literal\">SQL_ASCII</code>\u3002<span class=\"productname\">PostgreSQL</span>\u670d\u52a1\u5668\u652f\u6301\u7684\u5b57\u7b26\u96c6\u5728<a class=\"xref\" href=\"/docs/14/multibyte.html#MULTIBYTE-CHARSET-SUPPORTED\" title=\"24.3.1.\u00a0\u652f\u6301\u7684\u5b57\u7b26\u96c6\">\u7b2c\u00a024.3.1\u00a0\u8282</a>\u4e2d\u4ecb\u7ecd\u3002</p>\n</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 lang=\"zh\">\u5141\u8bb8\u4e0e\u96c6\u7fa4\u6240\u6709\u8005\u540c\u7ec4\u7684\u7528\u6237\u8bfb\u53d6 initdb \u521b\u5efa\u7684\u6240\u6709\u96c6\u7fa4\u6587\u4ef6\u3002Windows \u4e0d\u652f\u6301 POSIX \u98ce\u683c\u7684\u7ec4\u6743\u9650\uff0c\u56e0\u6b64\u4f1a\u5ffd\u7565\u6b64\u9009\u9879\u3002</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 lang=\"zh\">\n<p>\u5728\u6570\u636e\u9875\u4e0a\u4f7f\u7528\u6821\u9a8c\u548c\uff0c\u5e2e\u52a9\u68c0\u6d4b I/O \u7cfb\u7edf\u9020\u6210\u7684\u3001\u5426\u5219\u53ef\u80fd\u6084\u65e0\u58f0\u606f\u7684\u6570\u636e\u635f\u574f\u3002\u542f\u7528\u6821\u9a8c\u548c\u53ef\u80fd\u4f1a\u5e26\u6765\u660e\u663e\u7684\u6027\u80fd\u635f\u5931\u3002\u5982\u679c\u542f\u7528\uff0c\u5c31\u4f1a\u4e3a\u6240\u6709\u6570\u636e\u5e93\u4e2d\u7684\u6240\u6709\u5bf9\u8c61\u8ba1\u7b97\u6821\u9a8c\u548c\u3002\u6240\u6709\u6821\u9a8c\u548c\u5931\u8d25\u90fd\u4f1a\u5728 <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>\u89c6\u56fe\u4e2d\u62a5\u544a\u3002\u8be6\u89c1<a class=\"xref\" href=\"/docs/14/checksums.html\" title=\"30.2.\u00a0\u6570\u636e\u6821\u9a8c\u548c\">\u7b2c\u00a030.2\u00a0\u8282</a>\u3002</p>\n</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 lang=\"zh\">\n<p>\u8bbe\u7f6e\u6570\u636e\u5e93\u96c6\u7c07\u7684\u9ed8\u8ba4\u533a\u57df\u8bbe\u7f6e\u3002\u5982\u679c\u672a\u6307\u5b9a\u8be5\u9009\u9879\uff0c\u533a\u57df\u8bbe\u7f6e\u5c06\u7ee7\u627f\u81ea <code class=\"command\">initdb</code>\u8fd0\u884c\u65f6\u6240\u5728\u7684\u73af\u5883\u3002\u533a\u57df\u8bbe\u7f6e\u652f\u6301\u89c1<a class=\"xref\" href=\"/docs/14/charset.html#LOCALE\" title=\"24.1.\u00a0\u533a\u57df\u8bbe\u7f6e\u652f\u6301\">\u7b2c\u00a024.1\u00a0\u8282</a>\u3002</p>\n</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 lang=\"zh\">\n<p>\u7c7b\u4f3c\u4e8e<code class=\"option\">--locale</code>\uff0c\u4f46\u53ea\u5728\u6307\u5b9a\u7684\u7c7b\u522b\u4e2d\u8bbe\u7f6e\u533a\u57df\u8bbe\u7f6e\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--no-locale</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u7b49\u4ef7\u4e8e<code class=\"option\">--locale=C</code>\u3002</p>\n</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 lang=\"zh\">\n<p>\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c<code class=\"command\">initdb</code>\u4f1a\u7b49\u5f85\u6240\u6709\u6587\u4ef6\u90fd\u5b89\u5168\u5199\u5165\u78c1\u76d8\u3002\u8be5\u9009\u9879\u4f7f <code class=\"command\">initdb</code>\u5728\u4e0d\u7b49\u5f85\u7684\u60c5\u51b5\u4e0b\u8fd4\u56de\uff0c\u901f\u5ea6\u66f4\u5feb\uff0c\u4f46\u8fd9\u610f\u5473\u7740\u5982\u679c\u540e\u7eed\u64cd\u4f5c\u7cfb\u7edf\u5d29\u6e83\uff0c\u6570\u636e\u76ee\u5f55\u53ef\u80fd\u4f1a\u635f\u574f\u3002\u901a\u5e38\uff0c\u8be5\u9009\u9879\u9002\u7528\u4e8e\u6d4b\u8bd5\uff0c\u4f46\u4e0d\u5e94\u7528\u4e8e\u521b\u5efa\u751f\u4ea7\u73af\u5883\u5b89\u88c5\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--no-instructions</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c<code class=\"command\">initdb</code>\u4f1a\u5728\u5176\u8f93\u51fa\u672b\u5c3e\u5199\u51fa\u5982\u4f55\u542f\u52a8\u96c6\u7c07\u7684\u8bf4\u660e\u3002\u8be5\u9009\u9879\u4f1a\u7701\u7565\u8fd9\u4e9b\u8bf4\u660e\u3002\u5b83\u4e3b\u8981\u4f9b\u90a3\u4e9b\u5bf9<code class=\"command\">initdb</code>\u8fdb\u884c\u5e73\u53f0\u7279\u5b9a\u5c01\u88c5\u7684\u5de5\u5177\u4f7f\u7528\uff0c\u56e0\u4e3a\u5728\u8fd9\u79cd\u60c5\u51b5\u4e0b\u90a3\u4e9b\u8bf4\u660e\u5f88\u53ef\u80fd\u5e76\u4e0d\u6b63\u786e\u3002</p>\n</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 lang=\"zh\">\n<p>\u4f7f<code class=\"command\">initdb</code>\u4ece\u6587\u4ef6\u4e2d\u8bfb\u53d6\u6570\u636e\u5e93\u8d85\u7ea7\u7528\u6237\u7684\u5bc6\u7801\u3002\u6587\u4ef6\u7684\u7b2c\u4e00\u884c\u4f1a\u88ab\u5f53\u4f5c\u5bc6\u7801\u3002</p>\n</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 lang=\"zh\">\n<p>\u5c06\u6240\u6709\u6570\u636e\u5e93\u6587\u4ef6\u5b89\u5168\u5199\u5165\u78c1\u76d8\uff0c\u7136\u540e\u9000\u51fa\u3002\u8fd9\u4e0d\u4f1a\u6267\u884c\u4efb\u4f55\u5e38\u89c4<span class=\"application\">initdb</span>\u64cd\u4f5c\u3002</p>\n</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 lang=\"zh\">\n<p>\u8bbe\u7f6e\u9ed8\u8ba4\u6587\u672c\u68c0\u7d22\u914d\u7f6e\u3002\u66f4\u591a\u4fe1\u606f\u89c1<a class=\"xref\" href=\"/docs/14/runtime-config-client.html#GUC-DEFAULT-TEXT-SEARCH-CONFIG\">default_text_search_config</a>\u3002</p>\n</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 lang=\"zh\">\n<p>\u9009\u62e9\u6570\u636e\u5e93\u8d85\u7ea7\u7528\u6237\u7684\u7528\u6237\u540d\u3002\u9ed8\u8ba4\u503c\u662f\u8fd0\u884c<code class=\"command\">initdb</code>\u7684\u6709\u6548\u7528\u6237\u7684\u540d\u79f0\u3002\u8d85\u7ea7\u7528\u6237\u7684\u540d\u79f0\u672c\u8eab\u5e76\u4e0d\u91cd\u8981\uff0c\u4e0d\u8fc7\u5373\u4f7f\u64cd\u4f5c\u7cfb\u7edf\u7528\u6237\u540d\u79f0\u4e0d\u540c\uff0c\u4e5f\u53ef\u4ee5\u9009\u62e9\u6cbf\u7528\u60ef\u5e38\u7684\u540d\u79f0 <span class=\"systemitem\">postgres</span>\u3002</p>\n</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 lang=\"zh\">\n<p>\u4f7f<code class=\"command\">initdb</code>\u63d0\u793a\u8f93\u5165\u8981\u8d4b\u7ed9\u6570\u636e\u5e93\u8d85\u7ea7\u7528\u6237\u7684\u5bc6\u7801\u3002\u5982\u679c\u4e0d\u6253\u7b97\u4f7f\u7528\u5bc6\u7801\u8ba4\u8bc1\uff0c\u8fd9\u4e00\u70b9\u5e76\u4e0d\u91cd\u8981\u3002\u5426\u5219\uff0c\u5728\u8bbe\u7f6e\u5bc6\u7801\u4e4b\u524d\u5c06\u65e0\u6cd5\u4f7f\u7528\u5bc6\u7801\u8ba4\u8bc1\u3002</p>\n</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 lang=\"zh\">\n<p>\u8be5\u9009\u9879\u6307\u5b9a\u9884\u5199\u5f0f\u65e5\u5fd7\uff08WAL\uff09\u5e94\u5b58\u653e\u7684\u76ee\u5f55\u3002</p>\n</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 lang=\"zh\">\u8bbe\u7f6e WAL \u6bb5\u5927\u5c0f\uff0c\u5355\u4f4d\u4e3a\u5146\u5b57\u8282\u3002\u8fd9\u662f WAL \u65e5\u5fd7\u4e2d\u6bcf\u4e2a\u72ec\u7acb\u6587\u4ef6\u7684\u5927\u5c0f\u3002\u9ed8\u8ba4\u5927\u5c0f\u4e3a 16 \u5146\u5b57\u8282\u3002\u53d6\u503c\u5fc5\u987b\u662f 1 \u5230 1024\uff08\u5146\u5b57\u8282\uff09\u4e4b\u95f4\u7684 2 \u7684\u5e42\u3002\u6b64\u9009\u9879\u53ea\u80fd\u5728\u521d\u59cb\u5316\u65f6\u8bbe\u7f6e\uff0c\u4e4b\u540e\u65e0\u6cd5\u66f4\u6539\u3002</p>\n<p lang=\"zh\">\u8c03\u6574\u8be5\u5927\u5c0f\u53ef\u80fd\u6709\u52a9\u4e8e\u63a7\u5236 WAL \u65e5\u5fd7\u4f20\u9001\u6216\u5f52\u6863\u7684\u7c92\u5ea6\u3002\u6b64\u5916\uff0c\u5728 WAL \u91cf\u5f88\u5927\u7684\u6570\u636e\u5e93\u4e2d\uff0c\u6bcf\u4e2a\u76ee\u5f55\u4e2d\u7684 WAL \u6587\u4ef6\u6570\u91cf\u53ef\u80fd\u4f1a\u6210\u4e3a\u6027\u80fd\u548c\u7ba1\u7406\u95ee\u9898\u3002\u589e\u5927 WAL \u6587\u4ef6\u5927\u5c0f\u4f1a\u51cf\u5c11 WAL \u6587\u4ef6\u6570\u91cf\u3002</p>\n</dd>\n</dl>\n</div>\n<p lang=\"zh\">\u8fd8\u63d0\u4f9b\u4e86\u5176\u4ed6\u4e00\u4e9b\u8f83\u5c11\u4f7f\u7528\u7684\u9009\u9879\uff1a</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 lang=\"zh\">\n<p>\u6253\u5370\u5f15\u5bfc\u540e\u7aef\u7684\u8c03\u8bd5\u8f93\u51fa\uff0c\u4ee5\u53ca\u5c11\u91cf\u666e\u901a\u7528\u6237\u901a\u5e38\u4e0d\u611f\u5174\u8da3\u7684\u5176\u4ed6\u6d88\u606f\u3002\u5f15\u5bfc\u540e\u7aef\u662f <code class=\"command\">initdb</code>\u7528\u6765\u521b\u5efa\u7cfb\u7edf\u76ee\u5f55\u8868\u7684\u7a0b\u5e8f\u3002\u8be5\u9009\u9879\u4f1a\u4ea7\u751f\u5927\u91cf\u6781\u5176\u4e4f\u5473\u7684\u8f93\u51fa\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--discard-caches</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u4f7f\u7528<code class=\"literal\">debug_discard_caches=1</code>\u9009\u9879\u8fd0\u884c\u5f15\u5bfc\u540e\u7aef\u3002\u8fd9\u4f1a\u82b1\u8d39\u5f88\u957f\u65f6\u95f4\uff0c\u53ea\u5bf9\u6df1\u5ea6\u8c03\u8bd5\u6709\u7528\u3002</p>\n</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 lang=\"zh\">\n<p>\u6307\u5b9a<code class=\"command\">initdb</code>\u521d\u59cb\u5316\u6570\u636e\u5e93\u96c6\u7c07\u65f6\u5e94\u5230\u54ea\u91cc\u67e5\u627e\u5176\u8f93\u5165\u6587\u4ef6\u3002\u901a\u5e38\u4e0d\u9700\u8981\u8fd9\u6837\u505a\u3002\u82e5\u9700\u8981\u663e\u5f0f\u6307\u5b9a\u5176\u4f4d\u7f6e\uff0c\u7cfb\u7edf\u4f1a\u63d0\u793a\u3002</p>\n</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 lang=\"zh\">\n<p>\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c\u5982\u679c<code class=\"command\">initdb</code>\u53d1\u73b0\u67d0\u4e2a\u9519\u8bef\u4f7f\u5176\u65e0\u6cd5\u5b8c\u6574\u521b\u5efa\u6570\u636e\u5e93\u96c6\u7c07\uff0c\u5c31\u4f1a\u5220\u9664\u5b83\u5728\u53d1\u73b0\u65e0\u6cd5\u5b8c\u6210\u4efb\u52a1\u4e4b\u524d\u53ef\u80fd\u5df2\u521b\u5efa\u7684\u6240\u6709\u6587\u4ef6\u3002\u8be5\u9009\u9879\u4f1a\u7981\u6b62\u8fd9\u79cd\u6e05\u7406\uff0c\u56e0\u6b64\u5bf9\u8c03\u8bd5\u6709\u7528\u3002</p>\n</p>\n</dd>\n</dl>\n</div>\n<p lang=\"zh\">\u5176\u4ed6\u9009\u9879\uff1a</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 lang=\"zh\">\n<p>\u6253\u5370<span class=\"application\">initdb</span>\u7248\u672c\u5e76\u9000\u51fa\u3002</p>\n</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 lang=\"zh\">\n<p>\u663e\u793a\u6709\u5173<span class=\"application\">initdb</span>\u547d\u4ee4\u884c\u53c2\u6570\u7684\u5e2e\u52a9\u5e76\u9000\u51fa\u3002</p>\n</p>\n</dd>\n</dl>\n</div>\n</div>\n<div class=\"refsect1\" id=\"id-1.9.5.3.7\">\n<h2 lang=\"zh\">\u73af\u5883</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 lang=\"zh\">\n<p>\u6307\u5b9a\u6570\u636e\u5e93\u96c6\u7c07\u5e94\u5b58\u653e\u7684\u76ee\u5f55\uff1b\u53ef\u4f7f\u7528<code class=\"option\">-D</code>\u9009\u9879\u8986\u76d6\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"envar\">PG_COLOR</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6307\u5b9a\u8bca\u65ad\u6d88\u606f\u662f\u5426\u4f7f\u7528\u989c\u8272\u3002\u53ef\u9009\u503c\u4e3a <code class=\"literal\">always</code>\u3001<code class=\"literal\">auto</code>\u548c <code class=\"literal\">never</code>\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"envar\">TZ</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6307\u5b9a\u6240\u521b\u5efa\u6570\u636e\u5e93\u96c6\u7c07\u7684\u9ed8\u8ba4\u65f6\u533a\u3002\u8be5\u503c\u5e94\u4e3a\u5b8c\u6574\u7684\u65f6\u533a\u540d\u79f0\uff08\u89c1<a class=\"xref\" href=\"/docs/14/datatype-datetime.html#DATATYPE-TIMEZONES\" title=\"8.5.3.\u00a0\u65f6\u533a\">\u7b2c\u00a08.5.3\u00a0\u8282</a>\uff09\u3002</p>\n</p>\n</dd>\n</dl>\n</div>\n</div>\n<div class=\"refsect1\" id=\"id-1.9.5.3.8\">\n<h2 lang=\"zh\">\u6ce8\u89e3</h2>\n<p lang=\"zh\">\u4e5f\u53ef\u4ee5\u901a\u8fc7 pg_ctl initdb \u8c03\u7528 initdb\u3002</p>\n</div>\n<div class=\"refsect1\" id=\"id-1.9.5.3.9\">\n<h2 lang=\"zh\">\u53e6\u89c1</h2><span class=\"simplelist\"><a class=\"xref\" href=\"https://pg.center/docs/14/app-pg-ctl.html\" title=\"pg_ctl\"><span class=\"refentrytitle\"><span class=\"application\">pg_ctl</span></span></a>, <a class=\"xref\" href=\"https://pg.center/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", "localization": {"status": "complete", "sources": [{"url": "/docs/14/app-initdb.html", "method": "same-major semantic node", "sha256": "8f5c4da4b8f7c2e7e1cf32d350d8aadc9630ad5e7fec0e6e7b6be2d63176ae35", "language": "zh", "matched_nodes": ["#APP-INITDB/div[2]/p[1]", "#APP-INITDB/div[3]/h2[0]", "#APP-INITDB/div[4]/p[1]", "#APP-INITDB/div[4]/p[2]", "#APP-INITDB/div[4]/p[3]", "#APP-INITDB/div[4]/p[4]", "#APP-INITDB/div[4]/p[5]", "#APP-INITDB/div[4]/p[6]", "#APP-INITDB/div[4]/p[7]", "#APP-INITDB/div[4]/p[8]", "#APP-INITDB/div[4]/p[9]", "#APP-INITDB/div[5]/div[1]/dl[0]/dd[11]", "#APP-INITDB/div[5]/div[1]/dl[0]/dd[13]", "#APP-INITDB/div[5]/div[1]/dl[0]/dd[15]", "#APP-INITDB/div[5]/div[1]/dl[0]/dd[17]", "#APP-INITDB/div[5]/div[1]/dl[0]/dd[19]", "#APP-INITDB/div[5]/div[1]/dl[0]/dd[1]/p[0]", "#APP-INITDB/div[5]/div[1]/dl[0]/dd[1]/p[1]", "#APP-INITDB/div[5]/div[1]/dl[0]/dd[21]", "#APP-INITDB/div[5]/div[1]/dl[0]/dd[23]", "#APP-INITDB/div[5]/div[1]/dl[0]/dd[25]", "#APP-INITDB/div[5]/div[1]/dl[0]/dd[27]", "#APP-INITDB/div[5]/div[1]/dl[0]/dd[29]", "#APP-INITDB/div[5]/div[1]/dl[0]/dd[31]", "#APP-INITDB/div[5]/div[1]/dl[0]/dd[33]", "#APP-INITDB/div[5]/div[1]/dl[0]/dd[35]", "#APP-INITDB/div[5]/div[1]/dl[0]/dd[37]/p[1]", "#APP-INITDB/div[5]/div[1]/dl[0]/dd[3]", "#APP-INITDB/div[5]/div[1]/dl[0]/dd[5]", "#APP-INITDB/div[5]/div[1]/dl[0]/dd[7]", "#APP-INITDB/div[5]/div[1]/dl[0]/dd[9]", "#APP-INITDB/div[5]/div[3]/dl[0]/dd[1]", "#APP-INITDB/div[5]/div[3]/dl[0]/dd[3]", "#APP-INITDB/div[5]/div[3]/dl[0]/dd[5]", "#APP-INITDB/div[5]/div[3]/dl[0]/dd[7]", "#APP-INITDB/div[5]/div[5]/dl[0]/dd[1]", "#APP-INITDB/div[5]/div[5]/dl[0]/dd[3]", "#APP-INITDB/div[5]/p[2]", "#APP-INITDB/div[5]/p[4]", "#APP-INITDB/div[6]/div[1]/dl[0]/dd[1]", "#APP-INITDB/div[6]/div[1]/dl[0]/dd[3]", "#APP-INITDB/div[6]/div[1]/dl[0]/dd[5]", "#APP-INITDB/div[6]/h2[0]", "#APP-INITDB/div[7]/h2[0]", "#APP-INITDB/div[8]/h2[0]"]}], "language": "zh", "original_text": {"/versions/14/description/0": "initdb \u2014 create a new PostgreSQL database cluster", "/versions/14/facts/0/label": "Documented executable", "/versions/14/facts/1/label": "Executable version", "/versions/14/facts/2/label": "Reference inventory", "/versions/14/facts/2/value": "Server applications", "/versions/14/facts/3/label": "Option definition groups", "/versions/14/tables/0/title": "Documented options", "/versions/14/tables/1/title": "Environment variables", "/versions/14/tables/0/rows/0/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.", "/versions/14/tables/0/rows/1/summary": "This option specifies the authentication method for local users via TCP/IP connections used in pg_hba.conf ( host lines).", "/versions/14/tables/0/rows/2/summary": "This option specifies the authentication method for local users via Unix-domain socket connections used in pg_hba.conf ( local lines).", "/versions/14/tables/0/rows/3/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.", "/versions/14/tables/0/rows/4/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 .", "/versions/14/tables/0/rows/5/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.", "/versions/14/tables/0/rows/6/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.", "/versions/14/tables/0/rows/7/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 .", "/versions/14/tables/0/rows/8/summary": "Like --locale , but only sets the locale in the specified category.", "/versions/14/tables/0/rows/9/summary": "Equivalent to --locale=C .", "/versions/14/tables/0/columns/0/label": "Option and arguments", "/versions/14/tables/0/columns/1/label": "Description", "/versions/14/tables/0/rows/10/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.", "/versions/14/tables/0/rows/11/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.", "/versions/14/tables/0/rows/12/summary": "Makes initdb read the database superuser's password from a file. The first line of the file is taken as the password.", "/versions/14/tables/0/rows/13/summary": "Safely write all database files to disk and exit. This does not perform any of the normal initdb operations.", "/versions/14/tables/0/rows/14/summary": "Sets the default text search configuration. See default_text_search_config for further information.", "/versions/14/tables/0/rows/15/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.", "/versions/14/tables/0/rows/16/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.", "/versions/14/tables/0/rows/17/summary": "This option specifies the directory where the write-ahead log should be stored.", "/versions/14/tables/0/rows/18/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.", "/versions/14/tables/0/rows/19/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.", "/versions/14/tables/0/rows/20/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.", "/versions/14/tables/0/rows/21/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.", "/versions/14/tables/0/rows/22/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.", "/versions/14/tables/0/rows/23/summary": "Print the initdb version and exit.", "/versions/14/tables/0/rows/24/summary": "Show help about initdb command line arguments, and exit.", "/versions/14/tables/1/columns/0/label": "Variable", "/versions/14/tables/1/columns/1/label": "Meaning", "/versions/14/tables/1/rows/0/description": "Specifies the directory where the database cluster is to be stored; can be overridden using the -D option.", "/versions/14/tables/1/rows/1/description": "Specifies whether to use color in diagnostic messages. Possible values are always , auto and never .", "/versions/14/tables/1/rows/2/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 )."}, "fallback_fields": [], "source_language": "en", "original_snapshot_sha256": "7732268ac3ef4e4f957981f9bc202edaf6a8886f75e7c6b4ead58943cb37a348"}, "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", "manual_language": "zh"}, "15": {"facts": [{"label": "\u624b\u518c\u4e2d\u7684\u53ef\u6267\u884c\u7a0b\u5e8f", "value": "initdb"}, {"label": "\u7a0b\u5e8f\u7248\u672c", "value": "15.19"}, {"label": "\u53c2\u8003\u6e05\u5355", "value": "\u670d\u52a1\u7aef\u7a0b\u5e8f"}, {"label": "\u9009\u9879\u5b9a\u4e49\u7ec4", "value": "27"}], "tables": [{"key": "options", "rows": [{"summary": "\u8be5\u9009\u9879\u6307\u5b9a pg_hba.conf \u4e2d\u672c\u5730\u7528\u6237\u9ed8\u8ba4\u4f7f\u7528\u7684\u8ba4\u8bc1\u65b9\u6cd5\uff08 host \u548c local \u884c\uff09\u3002\u6709\u6548\u503c\u6982\u89c8\u89c1 \u7b2c 21.1 \u8282 \u3002", "signature": {"url": "/docs/15/app-initdb.html", "text": "-A authmethod --auth= authmethod"}}, {"summary": "\u8be5\u9009\u9879\u6307\u5b9a pg_hba.conf \u4e2d\u672c\u5730\u7528\u6237\u901a\u8fc7 TCP/IP \u8fde\u63a5\u65f6\uff08 host \u884c\uff09\u4f7f\u7528\u7684\u8ba4\u8bc1\u65b9\u6cd5\u3002", "signature": {"url": "/docs/15/app-initdb.html", "text": "--auth-host= authmethod"}}, {"summary": "\u8be5\u9009\u9879\u6307\u5b9a pg_hba.conf \u4e2d\u672c\u5730\u7528\u6237\u901a\u8fc7 Unix \u57df\u5957\u63a5\u5b57\u8fde\u63a5\u65f6\uff08 local \u884c\uff09\u4f7f\u7528\u7684\u8ba4\u8bc1\u65b9\u6cd5\u3002", "signature": {"url": "/docs/15/app-initdb.html", "text": "--auth-local= authmethod"}}, {"summary": "\u8be5\u9009\u9879\u6307\u5b9a\u6570\u636e\u5e93\u96c6\u7c07\u5e94\u5b58\u653e\u7684\u76ee\u5f55\u3002\u8fd9\u662f initdb \u6240\u9700\u7684\u552f\u4e00\u4fe1\u606f\uff0c\u4f46\u4e5f\u53ef\u4ee5\u901a\u8fc7\u8bbe\u7f6e PGDATA \u73af\u5883\u53d8\u91cf\u6765\u7701\u53bb\u663e\u5f0f\u5199\u51fa\u5b83\uff1b\u8fd9\u901a\u5e38\u66f4\u65b9\u4fbf\uff0c\u56e0\u4e3a\u6570\u636e\u5e93\u670d\u52a1\u5668\uff08 postgres \uff09\u4e4b\u540e\u4e5f\u53ef\u4ee5\u901a\u8fc7\u540c\u4e00\u53d8\u91cf\u627e\u5230\u6570\u636e\u76ee\u5f55\u3002", "signature": {"url": "/docs/15/app-initdb.html", "text": "-D directory --pgdata= directory"}}, {"summary": "\u9009\u62e9\u6a21\u677f\u6570\u636e\u5e93\u7684\u7f16\u7801\u3002\u8fd9\u4e5f\u5c06\u6210\u4e3a\u4ee5\u540e\u521b\u5efa\u7684\u4efb\u4f55\u6570\u636e\u5e93\u7684\u9ed8\u8ba4\u7f16\u7801\uff0c\u9664\u975e\u5728\u521b\u5efa\u65f6\u8986\u76d6\u5b83\u3002\u5982\u679c\u4f7f\u7528 libc \u533a\u57df\u8bbe\u7f6e\u63d0\u4f9b\u7a0b\u5e8f\uff0c\u9ed8\u8ba4\u503c\u7531\u533a\u57df\u8bbe\u7f6e\u63a8\u5bfc\u800c\u6765\uff1b\u5982\u679c\u4f7f\u7528 ICU \u533a\u57df\u8bbe\u7f6e\u63d0\u4f9b\u7a0b\u5e8f\uff0c\u9ed8\u8ba4\u503c\u4e3a UTF8 \u3002 PostgreSQL \u670d\u52a1\u5668\u652f\u6301\u7684\u5b57\u7b26\u96c6\u89c1 \u7b2c 24.3.1 \u8282 \u3002", "signature": {"url": "/docs/15/app-initdb.html", "text": "-E encoding --encoding= encoding"}}, {"summary": "\u5141\u8bb8\u4e0e\u96c6\u7c07\u62e5\u6709\u8005\u540c\u7ec4\u7684\u7528\u6237\u8bfb\u53d6\u7531 initdb \u521b\u5efa\u7684\u6240\u6709\u96c6\u7c07\u6587\u4ef6\u3002\u8be5\u9009\u9879\u5728 Windows \u4e0a\u4f1a\u88ab\u5ffd\u7565\uff0c\u56e0\u4e3a\u5b83\u4e0d\u652f\u6301 POSIX \u98ce\u683c\u7684\u7ec4\u6743\u9650\u3002", "signature": {"url": "/docs/15/app-initdb.html#APP-INITDB-ALLOW-GROUP-ACCESS", "text": "-g --allow-group-access"}}, {"summary": "\u5982\u679c\u4f7f\u7528 ICU \u533a\u57df\u8bbe\u7f6e\u63d0\u4f9b\u7a0b\u5e8f\uff0c\u5219\u6307\u5b9a ICU \u533a\u57df\u8bbe\u7f6e ID\u3002", "signature": {"url": "/docs/15/app-initdb.html", "text": "--icu-locale= locale"}}, {"summary": "\u5728\u6570\u636e\u9875\u4e0a\u4f7f\u7528\u6821\u9a8c\u548c\uff0c\u5e2e\u52a9\u68c0\u6d4b I/O \u7cfb\u7edf\u9020\u6210\u7684\u3001\u5426\u5219\u53ef\u80fd\u6084\u65e0\u58f0\u606f\u7684\u6570\u636e\u635f\u574f\u3002\u542f\u7528\u6821\u9a8c\u548c\u53ef\u80fd\u4f1a\u5e26\u6765\u660e\u663e\u7684\u6027\u80fd\u635f\u5931\u3002\u5982\u679c\u542f\u7528\uff0c\u5c31\u4f1a\u4e3a\u6240\u6709\u6570\u636e\u5e93\u4e2d\u7684\u6240\u6709\u5bf9\u8c61\u8ba1\u7b97\u6821\u9a8c\u548c\u3002\u6240\u6709\u6821\u9a8c\u548c\u5931\u8d25\u90fd\u4f1a\u5728 pg_stat_database \u89c6\u56fe\u4e2d\u62a5\u544a\u3002\u8be6\u89c1 \u7b2c 30.2 \u8282 \u3002", "signature": {"url": "/docs/15/app-initdb.html#APP-INITDB-DATA-CHECKSUMS", "text": "-k --data-checksums"}}, {"summary": "\u8bbe\u7f6e\u6570\u636e\u5e93\u96c6\u7c07\u7684\u9ed8\u8ba4\u533a\u57df\u8bbe\u7f6e\u3002\u5982\u679c\u672a\u6307\u5b9a\u8be5\u9009\u9879\uff0c\u533a\u57df\u8bbe\u7f6e\u5c06\u7ee7\u627f\u81ea initdb \u8fd0\u884c\u65f6\u6240\u5728\u7684\u73af\u5883\u3002\u533a\u57df\u8bbe\u7f6e\u652f\u6301\u89c1 \u7b2c 24.1 \u8282 \u3002", "signature": {"url": "/docs/15/app-initdb.html", "text": "--locale= locale"}}, {"summary": "\u7c7b\u4f3c\u4e8e --locale \uff0c\u4f46\u53ea\u5728\u6307\u5b9a\u7684\u7c7b\u522b\u4e2d\u8bbe\u7f6e\u533a\u57df\u8bbe\u7f6e\u3002", "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": "\u7b49\u4ef7\u4e8e --locale=C \u3002", "signature": {"url": "/docs/15/app-initdb.html", "text": "--no-locale"}}, {"summary": "\u8be5\u9009\u9879\u8bbe\u7f6e\u65b0\u96c6\u7c07\u4e2d\u521b\u5efa\u7684\u6570\u636e\u5e93\u6240\u4f7f\u7528\u7684\u533a\u57df\u8bbe\u7f6e\u63d0\u4f9b\u7a0b\u5e8f\u3002\u540e\u7eed\u521b\u5efa\u65b0\u6570\u636e\u5e93\u65f6\uff0c\u53ef\u4ee5\u5728 CREATE DATABASE \u547d\u4ee4\u4e2d\u8986\u76d6\u5b83\u3002\u9ed8\u8ba4\u503c\u4e3a libc \u3002", "signature": {"url": "/docs/15/app-initdb.html", "text": "--locale-provider={ libc | icu }"}}, {"summary": "\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c initdb \u4f1a\u7b49\u5f85\u6240\u6709\u6587\u4ef6\u90fd\u5b89\u5168\u5199\u5165\u78c1\u76d8\u3002\u8be5\u9009\u9879\u4f7f initdb \u5728\u4e0d\u7b49\u5f85\u7684\u60c5\u51b5\u4e0b\u8fd4\u56de\uff0c\u901f\u5ea6\u66f4\u5feb\uff0c\u4f46\u8fd9\u610f\u5473\u7740\u5982\u679c\u540e\u7eed\u64cd\u4f5c\u7cfb\u7edf\u5d29\u6e83\uff0c\u6570\u636e\u76ee\u5f55\u53ef\u80fd\u4f1a\u635f\u574f\u3002\u901a\u5e38\uff0c\u8be5\u9009\u9879\u9002\u7528\u4e8e\u6d4b\u8bd5\uff0c\u4f46\u4e0d\u5e94\u7528\u4e8e\u521b\u5efa\u751f\u4ea7\u73af\u5883\u5b89\u88c5\u3002", "signature": {"url": "/docs/15/app-initdb.html", "text": "-N --no-sync"}}, {"summary": "\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c initdb \u4f1a\u5728\u5176\u8f93\u51fa\u672b\u5c3e\u5199\u51fa\u5982\u4f55\u542f\u52a8\u96c6\u7c07\u7684\u8bf4\u660e\u3002\u8be5\u9009\u9879\u4f1a\u7701\u7565\u8fd9\u4e9b\u8bf4\u660e\u3002\u5b83\u4e3b\u8981\u4f9b\u90a3\u4e9b\u5bf9 initdb \u8fdb\u884c\u5e73\u53f0\u7279\u5b9a\u5c01\u88c5\u7684\u5de5\u5177\u4f7f\u7528\uff0c\u56e0\u4e3a\u5728\u8fd9\u79cd\u60c5\u51b5\u4e0b\u90a3\u4e9b\u8bf4\u660e\u5f88\u53ef\u80fd\u5e76\u4e0d\u6b63\u786e\u3002", "signature": {"url": "/docs/15/app-initdb.html", "text": "--no-instructions"}}, {"summary": "\u4f7f initdb \u4ece\u6587\u4ef6\u4e2d\u8bfb\u53d6\u6570\u636e\u5e93\u8d85\u7ea7\u7528\u6237\u7684\u5bc6\u7801\u3002\u6587\u4ef6\u7684\u7b2c\u4e00\u884c\u4f1a\u88ab\u5f53\u4f5c\u5bc6\u7801\u3002", "signature": {"url": "/docs/15/app-initdb.html", "text": "--pwfile= filename"}}, {"summary": "\u5c06\u6240\u6709\u6570\u636e\u5e93\u6587\u4ef6\u5b89\u5168\u5730\u5199\u5165\u78c1\u76d8\u5e76\u9000\u51fa\u3002\u8fd9\u4e0d\u4f1a\u6267\u884c\u4efb\u4f55\u5e38\u89c4\u7684 initdb \u64cd\u4f5c\u3002\u901a\u5e38\uff0c\u8be5\u9009\u9879\u53ef\u7528\u4e8e\u5728\u5c06 fsync \u4ece off \u6539\u4e3a on \u540e\uff0c\u786e\u4fdd\u80fd\u591f\u53ef\u9760\u6062\u590d\u3002", "signature": {"url": "/docs/15/app-initdb.html", "text": "-S --sync-only"}}, {"summary": "\u8bbe\u7f6e\u9ed8\u8ba4\u6587\u672c\u68c0\u7d22\u914d\u7f6e\u3002\u66f4\u591a\u4fe1\u606f\u89c1 default_text_search_config \u3002", "signature": {"url": "/docs/15/app-initdb.html", "text": "-T config --text-search-config= config"}}, {"summary": "\u9009\u62e9\u6570\u636e\u5e93\u8d85\u7ea7\u7528\u6237\u7684\u7528\u6237\u540d\u3002\u9ed8\u8ba4\u503c\u662f\u8fd0\u884c initdb \u7684\u6709\u6548\u7528\u6237\u7684\u540d\u79f0\u3002\u8d85\u7ea7\u7528\u6237\u7684\u540d\u79f0\u672c\u8eab\u5e76\u4e0d\u91cd\u8981\uff0c\u4e0d\u8fc7\u5373\u4f7f\u64cd\u4f5c\u7cfb\u7edf\u7528\u6237\u540d\u79f0\u4e0d\u540c\uff0c\u4e5f\u53ef\u4ee5\u9009\u62e9\u6cbf\u7528\u60ef\u5e38\u7684\u540d\u79f0 postgres \u3002", "signature": {"url": "/docs/15/app-initdb.html", "text": "-U username --username= username"}}, {"summary": "\u4f7f initdb \u63d0\u793a\u8f93\u5165\u8981\u8d4b\u7ed9\u6570\u636e\u5e93\u8d85\u7ea7\u7528\u6237\u7684\u5bc6\u7801\u3002\u5982\u679c\u4e0d\u6253\u7b97\u4f7f\u7528\u5bc6\u7801\u8ba4\u8bc1\uff0c\u8fd9\u4e00\u70b9\u5e76\u4e0d\u91cd\u8981\u3002\u5426\u5219\uff0c\u5728\u8bbe\u7f6e\u5bc6\u7801\u4e4b\u524d\u5c06\u65e0\u6cd5\u4f7f\u7528\u5bc6\u7801\u8ba4\u8bc1\u3002", "signature": {"url": "/docs/15/app-initdb.html", "text": "-W --pwprompt"}}, {"summary": "\u8be5\u9009\u9879\u6307\u5b9a\u9884\u5199\u5f0f\u65e5\u5fd7\uff08WAL\uff09\u5e94\u5b58\u653e\u7684\u76ee\u5f55\u3002", "signature": {"url": "/docs/15/app-initdb.html", "text": "-X directory --waldir= directory"}}, {"summary": "\u8bbe\u7f6e WAL \u6bb5\u5927\u5c0f\uff0c\u5355\u4f4d\u4e3a\u5146\u5b57\u8282\u3002\u8fd9\u662f WAL \u65e5\u5fd7\u4e2d\u6bcf\u4e2a\u72ec\u7acb\u6587\u4ef6\u7684\u5927\u5c0f\u3002\u9ed8\u8ba4\u5927\u5c0f\u4e3a 16 \u5146\u5b57\u8282\u3002\u53d6\u503c\u5fc5\u987b\u662f 1 \u5230 1024\uff08\u5146\u5b57\u8282\uff09\u4e4b\u95f4\u7684 2 \u7684\u5e42\u3002\u6b64\u9009\u9879\u53ea\u80fd\u5728\u521d\u59cb\u5316\u65f6\u8bbe\u7f6e\uff0c\u4e4b\u540e\u65e0\u6cd5\u66f4\u6539\u3002", "signature": {"url": "/docs/15/app-initdb.html", "text": "--wal-segsize= size"}}, {"summary": "\u6253\u5370\u5f15\u5bfc\u540e\u7aef\u7684\u8c03\u8bd5\u8f93\u51fa\uff0c\u4ee5\u53ca\u5c11\u91cf\u666e\u901a\u7528\u6237\u901a\u5e38\u4e0d\u611f\u5174\u8da3\u7684\u5176\u4ed6\u6d88\u606f\u3002\u5f15\u5bfc\u540e\u7aef\u662f initdb \u7528\u6765\u521b\u5efa\u7cfb\u7edf\u76ee\u5f55\u8868\u7684\u7a0b\u5e8f\u3002\u8be5\u9009\u9879\u4f1a\u4ea7\u751f\u5927\u91cf\u6781\u5176\u4e4f\u5473\u7684\u8f93\u51fa\u3002", "signature": {"url": "/docs/15/app-initdb.html", "text": "-d --debug"}}, {"summary": "\u4f7f\u7528 debug_discard_caches=1 \u9009\u9879\u8fd0\u884c\u5f15\u5bfc\u540e\u7aef\u3002\u8fd9\u4f1a\u82b1\u8d39\u5f88\u957f\u65f6\u95f4\uff0c\u53ea\u5bf9\u6df1\u5ea6\u8c03\u8bd5\u6709\u7528\u3002", "signature": {"url": "/docs/15/app-initdb.html", "text": "--discard-caches"}}, {"summary": "\u6307\u5b9a initdb \u521d\u59cb\u5316\u6570\u636e\u5e93\u96c6\u7c07\u65f6\u5e94\u5230\u54ea\u91cc\u67e5\u627e\u5176\u8f93\u5165\u6587\u4ef6\u3002\u901a\u5e38\u4e0d\u9700\u8981\u8fd9\u6837\u505a\u3002\u82e5\u9700\u8981\u663e\u5f0f\u6307\u5b9a\u5176\u4f4d\u7f6e\uff0c\u7cfb\u7edf\u4f1a\u63d0\u793a\u3002", "signature": {"url": "/docs/15/app-initdb.html", "text": "-L directory"}}, {"summary": "\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c\u5982\u679c initdb \u53d1\u73b0\u67d0\u4e2a\u9519\u8bef\u4f7f\u5176\u65e0\u6cd5\u5b8c\u6574\u521b\u5efa\u6570\u636e\u5e93\u96c6\u7c07\uff0c\u5c31\u4f1a\u5220\u9664\u5b83\u5728\u53d1\u73b0\u65e0\u6cd5\u5b8c\u6210\u4efb\u52a1\u4e4b\u524d\u53ef\u80fd\u5df2\u521b\u5efa\u7684\u6240\u6709\u6587\u4ef6\u3002\u8be5\u9009\u9879\u4f1a\u7981\u6b62\u8fd9\u79cd\u6e05\u7406\uff0c\u56e0\u6b64\u5bf9\u8c03\u8bd5\u6709\u7528\u3002", "signature": {"url": "/docs/15/app-initdb.html", "text": "-n --no-clean"}}, {"summary": "\u6253\u5370 initdb \u7248\u672c\u5e76\u9000\u51fa\u3002", "signature": {"url": "/docs/15/app-initdb.html", "text": "-V --version"}}, {"summary": "\u663e\u793a\u6709\u5173 initdb \u547d\u4ee4\u884c\u53c2\u6570\u7684\u5e2e\u52a9\u5e76\u9000\u51fa\u3002", "signature": {"url": "/docs/15/app-initdb.html", "text": "-? --help"}}], "title": "\u624b\u518c\u4e2d\u7684\u9009\u9879", "columns": [{"key": "signature", "label": "\u9009\u9879\u4e0e\u53c2\u6570"}, {"key": "summary", "label": "\u8bf4\u660e"}]}, {"key": "environment", "rows": [{"name": "PGDATA", "description": "\u6307\u5b9a\u6570\u636e\u5e93\u96c6\u7c07\u5e94\u5b58\u653e\u7684\u76ee\u5f55\uff1b\u53ef\u4f7f\u7528 -D \u9009\u9879\u8986\u76d6\u3002"}, {"name": "PG_COLOR", "description": "\u6307\u5b9a\u8bca\u65ad\u6d88\u606f\u662f\u5426\u4f7f\u7528\u989c\u8272\u3002\u53ef\u9009\u503c\u4e3a always \u3001 auto \u548c never \u3002"}, {"name": "TZ", "description": "\u6307\u5b9a\u6240\u521b\u5efa\u6570\u636e\u5e93\u96c6\u7c07\u7684\u9ed8\u8ba4\u65f6\u533a\u3002\u8be5\u503c\u5e94\u4e3a\u5b8c\u6574\u7684\u65f6\u533a\u540d\u79f0\uff08\u89c1 \u7b2c 8.5.3 \u8282 \uff09\u3002"}], "title": "\u73af\u5883\u53d8\u91cf", "columns": [{"key": "name", "label": "\u53d8\u91cf"}, {"key": "description", "label": "\u542b\u4e49"}]}], "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": "https://pg.center/docs/15/app-initdb.html", "file": "app-initdb.html", "label": "15.19 English manual \u00b7 app-initdb.html", "anchor": "", "sha256": "9d8430c6c45a71ccb2016dde532079685a00f06b58cd26bd07690bef7fbcbd54", "language": "en", "original_url": "/docs/15/app-initdb.html"}, {"url": "https://pg.center/docs/15/reference-server.html", "file": "reference-server.html", "label": "Server applications inventory", "anchor": "", "sha256": "1240cfbb13ebfd22aac8d5ae40c62a9015b246f7774bcf0bce97355ce06350a0", "language": "en", "original_url": "/docs/15/reference-server.html"}], "sections": [], "synopsis": ["initdb [ option ...] [ --pgdata | -D ] directory"], "signature": "initdb [ option ...] [ --pgdata | -D ] directory", "description": ["initdb \u2014 \u521b\u5efa\u4e00\u4e2a\u65b0\u7684 PostgreSQL \u6570\u636e\u5e93\u96c6\u7c07"], "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 lang=\"zh\">initdb \u2014 \u521b\u5efa\u4e00\u4e2a\u65b0\u7684<span class=\"productname\">PostgreSQL</span>\u6570\u636e\u5e93\u96c6\u7c07</p>\n</div>\n<div class=\"refsynopsisdiv\">\n<h2 lang=\"zh\">\u5927\u7eb2</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 lang=\"zh\">\u8bf4\u660e</h2>\n<p lang=\"zh\"><code class=\"command\">initdb</code>\u521b\u5efa\u4e00\u4e2a\u65b0\u7684<span class=\"productname\">PostgreSQL</span>\u6570\u636e\u5e93\u96c6\u7c07\u3002\u6570\u636e\u5e93\u96c6\u7c07\u662f\u7531\u5355\u4e2a\u670d\u52a1\u5668\u5b9e\u4f8b\u7ba1\u7406\u7684\u4e00\u7ec4\u6570\u636e\u5e93\u3002</p>\n<p lang=\"zh\">\u521b\u5efa\u6570\u636e\u5e93\u96c6\u7c07\u5305\u62ec\u521b\u5efa\u7528\u4e8e\u5b58\u653e\u6570\u636e\u5e93\u6570\u636e\u7684\u76ee\u5f55\uff0c\u751f\u6210\u5171\u4eab\u7cfb\u7edf\u76ee\u5f55\u8868\uff08\u5c5e\u4e8e\u6574\u4e2a\u96c6\u7c07\u800c\u4e0d\u662f\u67d0\u4e2a\u7279\u5b9a\u6570\u636e\u5e93\u7684\u8868\uff09\uff0c\u4ee5\u53ca\u521b\u5efa <code class=\"literal\">postgres</code>\u3001<code class=\"literal\">template1</code> \u548c <code class=\"literal\">template0</code> \u6570\u636e\u5e93\u3002<code class=\"literal\">postgres</code> \u6570\u636e\u5e93\u662f\u4e00\u4e2a\u9ed8\u8ba4\u6570\u636e\u5e93\uff0c\u4f9b\u7528\u6237\u3001\u5de5\u5177\u7a0b\u5e8f\u548c\u7b2c\u4e09\u65b9\u5e94\u7528\u7a0b\u5e8f\u4f7f\u7528\u3002<code class=\"literal\">template1</code> \u548c <code class=\"literal\">template0</code> \u7528\u4f5c\u540e\u7eed<code class=\"command\">CREATE DATABASE</code>\u547d\u4ee4\u590d\u5236\u7684\u6e90\u6570\u636e\u5e93\u3002<code class=\"literal\">template0</code> \u4e0d\u5e94\u88ab\u4fee\u6539\uff0c\u4f46\u53ef\u4ee5\u5411 <code class=\"literal\">template1</code> \u4e2d\u6dfb\u52a0\u5bf9\u8c61\uff0c\u8fd9\u4e9b\u5bf9\u8c61\u9ed8\u8ba4\u4f1a\u88ab\u590d\u5236\u5230\u4ee5\u540e\u521b\u5efa\u7684\u6570\u636e\u5e93\u4e2d\u3002\u66f4\u591a\u7ec6\u8282\u89c1<a class=\"xref\" href=\"/docs/15/manage-ag-templatedbs.html\" title=\"23.3.\u00a0\u6a21\u677f\u6570\u636e\u5e93\">\u7b2c\u00a023.3\u00a0\u8282</a>\u3002</p>\n<p lang=\"zh\">\u867d\u7136<code class=\"command\">initdb</code>\u4f1a\u5c1d\u8bd5\u521b\u5efa\u6307\u5b9a\u7684\u6570\u636e\u76ee\u5f55\uff0c\u4f46\u5982\u679c\u6240\u9700\u6570\u636e\u76ee\u5f55\u7684\u7236\u76ee\u5f55\u5f52 root \u6240\u6709\uff0c\u5b83\u53ef\u80fd\u6ca1\u6709\u8db3\u591f\u7684\u6743\u9650\u3002\u8981\u5728\u8fd9\u79cd\u73af\u5883\u4e2d\u521d\u59cb\u5316\uff0c\u53ef\u5148\u7531 root \u521b\u5efa\u4e00\u4e2a\u7a7a\u7684\u6570\u636e\u76ee\u5f55\uff0c\u7136\u540e\u7528<code class=\"command\">chown</code>\u5c06\u8be5\u76ee\u5f55\u7684\u6240\u6709\u6743\u8d4b\u4e88\u6570\u636e\u5e93\u7528\u6237\u8d26\u6237\uff0c\u518d\u7528 <code class=\"command\">su</code>\u5207\u6362\u4e3a\u8be5\u6570\u636e\u5e93\u7528\u6237\u6765\u8fd0\u884c<code class=\"command\">initdb</code>\u3002</p>\n<p lang=\"zh\"><code class=\"command\">initdb</code>\u5fc5\u987b\u4ee5\u5c06\u62e5\u6709\u670d\u52a1\u5668\u8fdb\u7a0b\u7684\u7528\u6237\u8eab\u4efd\u8fd0\u884c\uff0c\u56e0\u4e3a\u670d\u52a1\u5668\u9700\u8981\u8bbf\u95ee <code class=\"command\">initdb</code>\u521b\u5efa\u7684\u6587\u4ef6\u548c\u76ee\u5f55\u3002\u7531\u4e8e\u670d\u52a1\u5668\u4e0d\u80fd\u4ee5 root \u8eab\u4efd\u8fd0\u884c\uff0c\u56e0\u6b64\u4e5f\u7edd\u4e0d\u80fd\u4ee5 root \u8eab\u4efd\u8fd0\u884c<code class=\"command\">initdb</code>\u3002\uff08\u5b9e\u9645\u4e0a\u5b83\u4f1a\u62d2\u7edd\u8fd9\u6837\u505a\u3002\uff09</p>\n<p lang=\"zh\">\u51fa\u4e8e\u5b89\u5168\u539f\u56e0\uff0c<code class=\"command\">initdb</code>\u521b\u5efa\u7684\u65b0\u96c6\u7c07\u9ed8\u8ba4\u53ea\u6709\u96c6\u7c07\u62e5\u6709\u8005\u53ef\u4ee5\u8bbf\u95ee\u3002<code class=\"option\">--allow-group-access</code> \u9009\u9879\u5141\u8bb8\u4e0e\u96c6\u7c07\u62e5\u6709\u8005\u540c\u7ec4\u7684\u4efb\u4f55\u7528\u6237\u8bfb\u53d6\u96c6\u7c07\u4e2d\u7684\u6587\u4ef6\u3002\u8fd9\u5bf9\u7531\u975e\u7279\u6743\u7528\u6237\u6267\u884c\u5907\u4efd\u5f88\u6709\u7528\u3002</p>\n<p lang=\"zh\"><code class=\"command\">initdb</code>\u4f1a\u521d\u59cb\u5316\u6570\u636e\u5e93\u96c6\u7c07\u7684\u9ed8\u8ba4\u533a\u57df\u8bbe\u7f6e\u548c\u5b57\u7b26\u96c6\u7f16\u7801\u3002\u8fd9\u4e9b\u8bbe\u7f6e\u4e5f\u53ef\u4ee5\u5728\u521b\u5efa\u6bcf\u4e2a\u6570\u636e\u5e93\u65f6\u5206\u522b\u8bbe\u7f6e\u3002<code class=\"command\">initdb</code>\u4e3a\u6a21\u677f\u6570\u636e\u5e93\u786e\u5b9a\u8fd9\u4e9b\u8bbe\u7f6e\uff0c\u5b83\u4eec\u5c06\u4f5c\u4e3a\u6240\u6709\u5176\u4ed6\u6570\u636e\u5e93\u7684\u9ed8\u8ba4\u503c\u3002\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c<code class=\"command\">initdb</code>\u4f7f\u7528 <code class=\"literal\">libc</code>\u533a\u57df\u8bbe\u7f6e\u63d0\u4f9b\u7a0b\u5e8f\uff0c\u4ece\u73af\u5883\u4e2d\u83b7\u53d6\u533a\u57df\u8bbe\u7f6e\uff0c\u5e76\u6839\u636e\u533a\u57df\u8bbe\u7f6e\u786e\u5b9a\u7f16\u7801\u3002\u9664\u975e\u6709\u7279\u6b8a\u8981\u6c42\uff0c\u8fd9\u6837\u51e0\u4e4e\u603b\u80fd\u6ee1\u8db3\u9700\u8981\u3002</p>\n<p lang=\"zh\">\u8981\u4e3a\u96c6\u7c07\u9009\u62e9\u4e0d\u540c\u7684\u533a\u57df\u8bbe\u7f6e\uff0c\u8bf7\u4f7f\u7528<code class=\"option\">--locale</code>\u3002\u6b64\u5916\u8fd8\u6709\u5355\u72ec\u7684 <code class=\"option\">--lc-*</code>\u9009\u9879\uff08\u89c1\u4e0b\u6587\uff09\uff0c\u7528\u4e8e\u4e3a\u5404\u4e2a\u533a\u57df\u8bbe\u7f6e\u7c7b\u522b\u8bbe\u7f6e\u503c\u3002\u8bf7\u6ce8\u610f\uff0c\u4e0d\u540c\u533a\u57df\u8bbe\u7f6e\u7c7b\u522b\u4e4b\u95f4\u82e5\u8bbe\u7f6e\u4e0d\u4e00\u81f4\uff0c\u53ef\u80fd\u4ea7\u751f\u4e0d\u5408\u7406\u7684\u7ed3\u679c\uff0c\u56e0\u6b64\u5e94\u8c28\u614e\u4f7f\u7528\u3002</p>\n<p lang=\"zh\">\u4e5f\u53ef\u4ee5\u4f7f\u7528 ICU \u5e93\u63d0\u4f9b\u533a\u57df\u8bbe\u7f6e\u670d\u52a1\uff08\u540c\u6837\uff0c\u8fd9\u53ea\u4f1a\u8bbe\u7f6e\u540e\u7eed\u521b\u5efa\u7684\u6570\u636e\u5e93\u7684\u9ed8\u8ba4\u503c\uff09\u3002\u8981\u9009\u62e9\u6b64\u65b9\u5f0f\uff0c\u8bf7\u6307\u5b9a<code class=\"literal\">--locale-provider=icu</code>\u3002\u8981\u9009\u62e9\u5177\u4f53\u8981\u5e94\u7528\u7684 ICU \u533a\u57df\u8bbe\u7f6e ID\uff0c\u8bf7\u4f7f\u7528<code class=\"option\">--icu-locale</code>\u3002\u8bf7\u6ce8\u610f\uff0c\u51fa\u4e8e\u5b9e\u73b0\u539f\u56e0\u4ee5\u53ca\u5bf9\u65e7\u4ee3\u7801\u7684\u652f\u6301\uff0c\u5728\u4f7f\u7528 ICU \u533a\u57df\u8bbe\u7f6e\u63d0\u4f9b\u7a0b\u5e8f\u65f6\uff0c<code class=\"command\">initdb</code> \u4ecd\u4f1a\u9009\u62e9\u5e76\u521d\u59cb\u5316 libc \u533a\u57df\u8bbe\u7f6e\u3002</p>\n<p lang=\"zh\"><code class=\"command\">initdb</code>\u8fd0\u884c\u65f6\u4f1a\u6253\u5370\u51fa\u5b83\u9009\u62e9\u7684\u533a\u57df\u8bbe\u7f6e\u3002\u5982\u679c\u6709\u590d\u6742\u9700\u6c42\u6216\u8005\u6307\u5b9a\u4e86\u591a\u4e2a\u9009\u9879\uff0c\u5efa\u8bae\u68c0\u67e5\u7ed3\u679c\u662f\u5426\u7b26\u5408\u9884\u671f\u3002</p>\n<p lang=\"zh\">\u6709\u5173\u533a\u57df\u8bbe\u7f6e\u7684\u66f4\u591a\u7ec6\u8282\u89c1<a class=\"xref\" href=\"/docs/15/charset.html#LOCALE\" title=\"24.1.\u00a0\u533a\u57df\u8bbe\u7f6e\u652f\u6301\">\u7b2c\u00a024.1\u00a0\u8282</a>\u3002</p>\n<p lang=\"zh\">\u8981\u4fee\u6539\u9ed8\u8ba4\u7f16\u7801\uff0c\u8bf7\u4f7f\u7528<code class=\"option\">--encoding</code>\u3002\u66f4\u591a\u7ec6\u8282\u89c1<a class=\"xref\" href=\"/docs/15/multibyte.html\" title=\"24.3.\u00a0\u5b57\u7b26\u96c6\u652f\u6301\">\u7b2c\u00a024.3\u00a0\u8282</a>\u3002</p>\n</div>\n<div class=\"refsect1\" id=\"id-1.9.5.3.6\">\n<h2 lang=\"zh\">\u9009\u9879</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 lang=\"zh\">\u8be5\u9009\u9879\u6307\u5b9a<code class=\"filename\">pg_hba.conf</code>\u4e2d\u672c\u5730\u7528\u6237\u9ed8\u8ba4\u4f7f\u7528\u7684\u8ba4\u8bc1\u65b9\u6cd5\uff08<code class=\"literal\">host</code> \u548c <code class=\"literal\">local</code> \u884c\uff09\u3002\u6709\u6548\u503c\u6982\u89c8\u89c1<a class=\"xref\" href=\"/docs/15/client-authentication.html#AUTH-PG-HBA-CONF\" title=\"21.1.\u00a0pg_hba.conf \u6587\u4ef6\">\u7b2c\u00a021.1\u00a0\u8282</a>\u3002</p>\n<p lang=\"zh\"><code class=\"command\">initdb</code>\u4f1a\u4f7f\u7528\u6307\u5b9a\u7684\u8ba4\u8bc1\u65b9\u6cd5\u9884\u586b\u5145<code class=\"filename\">pg_hba.conf</code> \u6761\u76ee\uff0c\u65e2\u7528\u4e8e\u975e\u590d\u5236\u8fde\u63a5\uff0c\u4e5f\u7528\u4e8e\u590d\u5236\u8fde\u63a5\u3002</p>\n<p lang=\"zh\">\u9664\u975e\u4fe1\u4efb\u7cfb\u7edf\u4e0a\u7684\u6240\u6709\u672c\u5730\u7528\u6237\uff0c\u5426\u5219\u4e0d\u8981\u4f7f\u7528<code class=\"literal\">trust</code>\u3002\u4e3a\u4e86\u4fbf\u4e8e\u5b89\u88c5\uff0c\u9ed8\u8ba4\u4f7f\u7528<code class=\"literal\">trust</code>\u3002</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 lang=\"zh\">\n<p>\u8be5\u9009\u9879\u6307\u5b9a<code class=\"filename\">pg_hba.conf</code>\u4e2d\u672c\u5730\u7528\u6237\u901a\u8fc7 TCP/IP \u8fde\u63a5\u65f6\uff08<code class=\"literal\">host</code> \u884c\uff09\u4f7f\u7528\u7684\u8ba4\u8bc1\u65b9\u6cd5\u3002</p>\n</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 lang=\"zh\">\n<p>\u8be5\u9009\u9879\u6307\u5b9a<code class=\"filename\">pg_hba.conf</code>\u4e2d\u672c\u5730\u7528\u6237\u901a\u8fc7 Unix \u57df\u5957\u63a5\u5b57\u8fde\u63a5\u65f6\uff08<code class=\"literal\">local</code> \u884c\uff09\u4f7f\u7528\u7684\u8ba4\u8bc1\u65b9\u6cd5\u3002</p>\n</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 lang=\"zh\">\n<p>\u8be5\u9009\u9879\u6307\u5b9a\u6570\u636e\u5e93\u96c6\u7c07\u5e94\u5b58\u653e\u7684\u76ee\u5f55\u3002\u8fd9\u662f<code class=\"command\">initdb</code>\u6240\u9700\u7684\u552f\u4e00\u4fe1\u606f\uff0c\u4f46\u4e5f\u53ef\u4ee5\u901a\u8fc7\u8bbe\u7f6e<code class=\"envar\">PGDATA</code>\u73af\u5883\u53d8\u91cf\u6765\u7701\u53bb\u663e\u5f0f\u5199\u51fa\u5b83\uff1b\u8fd9\u901a\u5e38\u66f4\u65b9\u4fbf\uff0c\u56e0\u4e3a\u6570\u636e\u5e93\u670d\u52a1\u5668\uff08<code class=\"command\">postgres</code>\uff09\u4e4b\u540e\u4e5f\u53ef\u4ee5\u901a\u8fc7\u540c\u4e00\u53d8\u91cf\u627e\u5230\u6570\u636e\u76ee\u5f55\u3002</p>\n</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 lang=\"zh\">\n<p>\u9009\u62e9\u6a21\u677f\u6570\u636e\u5e93\u7684\u7f16\u7801\u3002\u8fd9\u4e5f\u5c06\u6210\u4e3a\u4ee5\u540e\u521b\u5efa\u7684\u4efb\u4f55\u6570\u636e\u5e93\u7684\u9ed8\u8ba4\u7f16\u7801\uff0c\u9664\u975e\u5728\u521b\u5efa\u65f6\u8986\u76d6\u5b83\u3002\u5982\u679c\u4f7f\u7528 libc \u533a\u57df\u8bbe\u7f6e\u63d0\u4f9b\u7a0b\u5e8f\uff0c\u9ed8\u8ba4\u503c\u7531\u533a\u57df\u8bbe\u7f6e\u63a8\u5bfc\u800c\u6765\uff1b\u5982\u679c\u4f7f\u7528 ICU \u533a\u57df\u8bbe\u7f6e\u63d0\u4f9b\u7a0b\u5e8f\uff0c\u9ed8\u8ba4\u503c\u4e3a<code class=\"literal\">UTF8</code>\u3002<span class=\"productname\">PostgreSQL</span>\u670d\u52a1\u5668\u652f\u6301\u7684\u5b57\u7b26\u96c6\u89c1<a class=\"xref\" href=\"/docs/15/multibyte.html#MULTIBYTE-CHARSET-SUPPORTED\" title=\"24.3.1.\u00a0\u652f\u6301\u7684\u5b57\u7b26\u96c6\">\u7b2c\u00a024.3.1\u00a0\u8282</a>\u3002</p>\n</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 lang=\"zh\">\u5141\u8bb8\u4e0e\u96c6\u7fa4\u6240\u6709\u8005\u540c\u7ec4\u7684\u7528\u6237\u8bfb\u53d6 initdb \u521b\u5efa\u7684\u6240\u6709\u96c6\u7fa4\u6587\u4ef6\u3002Windows \u4e0d\u652f\u6301 POSIX \u98ce\u683c\u7684\u7ec4\u6743\u9650\uff0c\u56e0\u6b64\u4f1a\u5ffd\u7565\u6b64\u9009\u9879\u3002</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 lang=\"zh\">\n<p>\u5982\u679c\u4f7f\u7528 ICU \u533a\u57df\u8bbe\u7f6e\u63d0\u4f9b\u7a0b\u5e8f\uff0c\u5219\u6307\u5b9a ICU \u533a\u57df\u8bbe\u7f6e ID\u3002</p>\n</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 lang=\"zh\">\n<p>\u5728\u6570\u636e\u9875\u4e0a\u4f7f\u7528\u6821\u9a8c\u548c\uff0c\u5e2e\u52a9\u68c0\u6d4b I/O \u7cfb\u7edf\u9020\u6210\u7684\u3001\u5426\u5219\u53ef\u80fd\u6084\u65e0\u58f0\u606f\u7684\u6570\u636e\u635f\u574f\u3002\u542f\u7528\u6821\u9a8c\u548c\u53ef\u80fd\u4f1a\u5e26\u6765\u660e\u663e\u7684\u6027\u80fd\u635f\u5931\u3002\u5982\u679c\u542f\u7528\uff0c\u5c31\u4f1a\u4e3a\u6240\u6709\u6570\u636e\u5e93\u4e2d\u7684\u6240\u6709\u5bf9\u8c61\u8ba1\u7b97\u6821\u9a8c\u548c\u3002\u6240\u6709\u6821\u9a8c\u548c\u5931\u8d25\u90fd\u4f1a\u5728 <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>\u89c6\u56fe\u4e2d\u62a5\u544a\u3002\u8be6\u89c1<a class=\"xref\" href=\"/docs/15/checksums.html\" title=\"30.2.\u00a0\u6570\u636e\u6821\u9a8c\u548c\">\u7b2c\u00a030.2\u00a0\u8282</a>\u3002</p>\n</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 lang=\"zh\">\n<p>\u8bbe\u7f6e\u6570\u636e\u5e93\u96c6\u7c07\u7684\u9ed8\u8ba4\u533a\u57df\u8bbe\u7f6e\u3002\u5982\u679c\u672a\u6307\u5b9a\u8be5\u9009\u9879\uff0c\u533a\u57df\u8bbe\u7f6e\u5c06\u7ee7\u627f\u81ea <code class=\"command\">initdb</code>\u8fd0\u884c\u65f6\u6240\u5728\u7684\u73af\u5883\u3002\u533a\u57df\u8bbe\u7f6e\u652f\u6301\u89c1<a class=\"xref\" href=\"/docs/15/charset.html#LOCALE\" title=\"24.1.\u00a0\u533a\u57df\u8bbe\u7f6e\u652f\u6301\">\u7b2c\u00a024.1\u00a0\u8282</a>\u3002</p>\n</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 lang=\"zh\">\n<p>\u7c7b\u4f3c\u4e8e<code class=\"option\">--locale</code>\uff0c\u4f46\u53ea\u5728\u6307\u5b9a\u7684\u7c7b\u522b\u4e2d\u8bbe\u7f6e\u533a\u57df\u8bbe\u7f6e\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--no-locale</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u7b49\u4ef7\u4e8e<code class=\"option\">--locale=C</code>\u3002</p>\n</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 lang=\"zh\">\n<p>\u8be5\u9009\u9879\u8bbe\u7f6e\u65b0\u96c6\u7c07\u4e2d\u521b\u5efa\u7684\u6570\u636e\u5e93\u6240\u4f7f\u7528\u7684\u533a\u57df\u8bbe\u7f6e\u63d0\u4f9b\u7a0b\u5e8f\u3002\u540e\u7eed\u521b\u5efa\u65b0\u6570\u636e\u5e93\u65f6\uff0c\u53ef\u4ee5\u5728<code class=\"command\">CREATE DATABASE</code>\u547d\u4ee4\u4e2d\u8986\u76d6\u5b83\u3002\u9ed8\u8ba4\u503c\u4e3a <code class=\"literal\">libc</code>\u3002</p>\n</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 lang=\"zh\">\n<p>\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c<code class=\"command\">initdb</code>\u4f1a\u7b49\u5f85\u6240\u6709\u6587\u4ef6\u90fd\u5b89\u5168\u5199\u5165\u78c1\u76d8\u3002\u8be5\u9009\u9879\u4f7f <code class=\"command\">initdb</code>\u5728\u4e0d\u7b49\u5f85\u7684\u60c5\u51b5\u4e0b\u8fd4\u56de\uff0c\u901f\u5ea6\u66f4\u5feb\uff0c\u4f46\u8fd9\u610f\u5473\u7740\u5982\u679c\u540e\u7eed\u64cd\u4f5c\u7cfb\u7edf\u5d29\u6e83\uff0c\u6570\u636e\u76ee\u5f55\u53ef\u80fd\u4f1a\u635f\u574f\u3002\u901a\u5e38\uff0c\u8be5\u9009\u9879\u9002\u7528\u4e8e\u6d4b\u8bd5\uff0c\u4f46\u4e0d\u5e94\u7528\u4e8e\u521b\u5efa\u751f\u4ea7\u73af\u5883\u5b89\u88c5\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--no-instructions</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c<code class=\"command\">initdb</code>\u4f1a\u5728\u5176\u8f93\u51fa\u672b\u5c3e\u5199\u51fa\u5982\u4f55\u542f\u52a8\u96c6\u7c07\u7684\u8bf4\u660e\u3002\u8be5\u9009\u9879\u4f1a\u7701\u7565\u8fd9\u4e9b\u8bf4\u660e\u3002\u5b83\u4e3b\u8981\u4f9b\u90a3\u4e9b\u5bf9<code class=\"command\">initdb</code>\u8fdb\u884c\u5e73\u53f0\u7279\u5b9a\u5c01\u88c5\u7684\u5de5\u5177\u4f7f\u7528\uff0c\u56e0\u4e3a\u5728\u8fd9\u79cd\u60c5\u51b5\u4e0b\u90a3\u4e9b\u8bf4\u660e\u5f88\u53ef\u80fd\u5e76\u4e0d\u6b63\u786e\u3002</p>\n</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 lang=\"zh\">\n<p>\u4f7f<code class=\"command\">initdb</code>\u4ece\u6587\u4ef6\u4e2d\u8bfb\u53d6\u6570\u636e\u5e93\u8d85\u7ea7\u7528\u6237\u7684\u5bc6\u7801\u3002\u6587\u4ef6\u7684\u7b2c\u4e00\u884c\u4f1a\u88ab\u5f53\u4f5c\u5bc6\u7801\u3002</p>\n</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 lang=\"zh\">\n<p>\u5c06\u6240\u6709\u6570\u636e\u5e93\u6587\u4ef6\u5b89\u5168\u5730\u5199\u5165\u78c1\u76d8\u5e76\u9000\u51fa\u3002\u8fd9\u4e0d\u4f1a\u6267\u884c\u4efb\u4f55\u5e38\u89c4\u7684 <span class=\"application\">initdb</span>\u64cd\u4f5c\u3002\u901a\u5e38\uff0c\u8be5\u9009\u9879\u53ef\u7528\u4e8e\u5728\u5c06<a class=\"xref\" href=\"/docs/15/runtime-config-wal.html#GUC-FSYNC\">fsync</a>\u4ece<code class=\"literal\">off</code>\u6539\u4e3a<code class=\"literal\">on</code>\u540e\uff0c\u786e\u4fdd\u80fd\u591f\u53ef\u9760\u6062\u590d\u3002</p>\n</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 lang=\"zh\">\n<p>\u8bbe\u7f6e\u9ed8\u8ba4\u6587\u672c\u68c0\u7d22\u914d\u7f6e\u3002\u66f4\u591a\u4fe1\u606f\u89c1<a class=\"xref\" href=\"/docs/15/runtime-config-client.html#GUC-DEFAULT-TEXT-SEARCH-CONFIG\">default_text_search_config</a>\u3002</p>\n</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 lang=\"zh\">\n<p>\u9009\u62e9\u6570\u636e\u5e93\u8d85\u7ea7\u7528\u6237\u7684\u7528\u6237\u540d\u3002\u9ed8\u8ba4\u503c\u662f\u8fd0\u884c<code class=\"command\">initdb</code>\u7684\u6709\u6548\u7528\u6237\u7684\u540d\u79f0\u3002\u8d85\u7ea7\u7528\u6237\u7684\u540d\u79f0\u672c\u8eab\u5e76\u4e0d\u91cd\u8981\uff0c\u4e0d\u8fc7\u5373\u4f7f\u64cd\u4f5c\u7cfb\u7edf\u7528\u6237\u540d\u79f0\u4e0d\u540c\uff0c\u4e5f\u53ef\u4ee5\u9009\u62e9\u6cbf\u7528\u60ef\u5e38\u7684\u540d\u79f0 <span class=\"systemitem\">postgres</span>\u3002</p>\n</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 lang=\"zh\">\n<p>\u4f7f<code class=\"command\">initdb</code>\u63d0\u793a\u8f93\u5165\u8981\u8d4b\u7ed9\u6570\u636e\u5e93\u8d85\u7ea7\u7528\u6237\u7684\u5bc6\u7801\u3002\u5982\u679c\u4e0d\u6253\u7b97\u4f7f\u7528\u5bc6\u7801\u8ba4\u8bc1\uff0c\u8fd9\u4e00\u70b9\u5e76\u4e0d\u91cd\u8981\u3002\u5426\u5219\uff0c\u5728\u8bbe\u7f6e\u5bc6\u7801\u4e4b\u524d\u5c06\u65e0\u6cd5\u4f7f\u7528\u5bc6\u7801\u8ba4\u8bc1\u3002</p>\n</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 lang=\"zh\">\n<p>\u8be5\u9009\u9879\u6307\u5b9a\u9884\u5199\u5f0f\u65e5\u5fd7\uff08WAL\uff09\u5e94\u5b58\u653e\u7684\u76ee\u5f55\u3002</p>\n</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 lang=\"zh\">\u8bbe\u7f6e WAL \u6bb5\u5927\u5c0f\uff0c\u5355\u4f4d\u4e3a\u5146\u5b57\u8282\u3002\u8fd9\u662f WAL \u65e5\u5fd7\u4e2d\u6bcf\u4e2a\u72ec\u7acb\u6587\u4ef6\u7684\u5927\u5c0f\u3002\u9ed8\u8ba4\u5927\u5c0f\u4e3a 16 \u5146\u5b57\u8282\u3002\u53d6\u503c\u5fc5\u987b\u662f 1 \u5230 1024\uff08\u5146\u5b57\u8282\uff09\u4e4b\u95f4\u7684 2 \u7684\u5e42\u3002\u6b64\u9009\u9879\u53ea\u80fd\u5728\u521d\u59cb\u5316\u65f6\u8bbe\u7f6e\uff0c\u4e4b\u540e\u65e0\u6cd5\u66f4\u6539\u3002</p>\n<p lang=\"zh\">\u8c03\u6574\u8be5\u5927\u5c0f\u53ef\u80fd\u6709\u52a9\u4e8e\u63a7\u5236 WAL \u65e5\u5fd7\u4f20\u9001\u6216\u5f52\u6863\u7684\u7c92\u5ea6\u3002\u6b64\u5916\uff0c\u5728 WAL \u91cf\u5f88\u5927\u7684\u6570\u636e\u5e93\u4e2d\uff0c\u6bcf\u4e2a\u76ee\u5f55\u4e2d\u7684 WAL \u6587\u4ef6\u6570\u91cf\u53ef\u80fd\u4f1a\u6210\u4e3a\u6027\u80fd\u548c\u7ba1\u7406\u95ee\u9898\u3002\u589e\u5927 WAL \u6587\u4ef6\u5927\u5c0f\u4f1a\u51cf\u5c11 WAL \u6587\u4ef6\u6570\u91cf\u3002</p>\n</dd>\n</dl>\n</div>\n<p lang=\"zh\">\u8fd8\u63d0\u4f9b\u4e86\u5176\u4ed6\u4e00\u4e9b\u8f83\u5c11\u4f7f\u7528\u7684\u9009\u9879\uff1a</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 lang=\"zh\">\n<p>\u6253\u5370\u5f15\u5bfc\u540e\u7aef\u7684\u8c03\u8bd5\u8f93\u51fa\uff0c\u4ee5\u53ca\u5c11\u91cf\u666e\u901a\u7528\u6237\u901a\u5e38\u4e0d\u611f\u5174\u8da3\u7684\u5176\u4ed6\u6d88\u606f\u3002\u5f15\u5bfc\u540e\u7aef\u662f <code class=\"command\">initdb</code>\u7528\u6765\u521b\u5efa\u7cfb\u7edf\u76ee\u5f55\u8868\u7684\u7a0b\u5e8f\u3002\u8be5\u9009\u9879\u4f1a\u4ea7\u751f\u5927\u91cf\u6781\u5176\u4e4f\u5473\u7684\u8f93\u51fa\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--discard-caches</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u4f7f\u7528<code class=\"literal\">debug_discard_caches=1</code>\u9009\u9879\u8fd0\u884c\u5f15\u5bfc\u540e\u7aef\u3002\u8fd9\u4f1a\u82b1\u8d39\u5f88\u957f\u65f6\u95f4\uff0c\u53ea\u5bf9\u6df1\u5ea6\u8c03\u8bd5\u6709\u7528\u3002</p>\n</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 lang=\"zh\">\n<p>\u6307\u5b9a<code class=\"command\">initdb</code>\u521d\u59cb\u5316\u6570\u636e\u5e93\u96c6\u7c07\u65f6\u5e94\u5230\u54ea\u91cc\u67e5\u627e\u5176\u8f93\u5165\u6587\u4ef6\u3002\u901a\u5e38\u4e0d\u9700\u8981\u8fd9\u6837\u505a\u3002\u82e5\u9700\u8981\u663e\u5f0f\u6307\u5b9a\u5176\u4f4d\u7f6e\uff0c\u7cfb\u7edf\u4f1a\u63d0\u793a\u3002</p>\n</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 lang=\"zh\">\n<p>\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c\u5982\u679c<code class=\"command\">initdb</code>\u53d1\u73b0\u67d0\u4e2a\u9519\u8bef\u4f7f\u5176\u65e0\u6cd5\u5b8c\u6574\u521b\u5efa\u6570\u636e\u5e93\u96c6\u7c07\uff0c\u5c31\u4f1a\u5220\u9664\u5b83\u5728\u53d1\u73b0\u65e0\u6cd5\u5b8c\u6210\u4efb\u52a1\u4e4b\u524d\u53ef\u80fd\u5df2\u521b\u5efa\u7684\u6240\u6709\u6587\u4ef6\u3002\u8be5\u9009\u9879\u4f1a\u7981\u6b62\u8fd9\u79cd\u6e05\u7406\uff0c\u56e0\u6b64\u5bf9\u8c03\u8bd5\u6709\u7528\u3002</p>\n</p>\n</dd>\n</dl>\n</div>\n<p lang=\"zh\">\u5176\u4ed6\u9009\u9879\uff1a</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 lang=\"zh\">\n<p>\u6253\u5370<span class=\"application\">initdb</span>\u7248\u672c\u5e76\u9000\u51fa\u3002</p>\n</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 lang=\"zh\">\n<p>\u663e\u793a\u6709\u5173<span class=\"application\">initdb</span>\u547d\u4ee4\u884c\u53c2\u6570\u7684\u5e2e\u52a9\u5e76\u9000\u51fa\u3002</p>\n</p>\n</dd>\n</dl>\n</div>\n</div>\n<div class=\"refsect1\" id=\"id-1.9.5.3.7\">\n<h2 lang=\"zh\">\u73af\u5883</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 lang=\"zh\">\n<p>\u6307\u5b9a\u6570\u636e\u5e93\u96c6\u7c07\u5e94\u5b58\u653e\u7684\u76ee\u5f55\uff1b\u53ef\u4f7f\u7528<code class=\"option\">-D</code>\u9009\u9879\u8986\u76d6\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"envar\">PG_COLOR</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6307\u5b9a\u8bca\u65ad\u6d88\u606f\u662f\u5426\u4f7f\u7528\u989c\u8272\u3002\u53ef\u9009\u503c\u4e3a <code class=\"literal\">always</code>\u3001<code class=\"literal\">auto</code>\u548c <code class=\"literal\">never</code>\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"envar\">TZ</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6307\u5b9a\u6240\u521b\u5efa\u6570\u636e\u5e93\u96c6\u7c07\u7684\u9ed8\u8ba4\u65f6\u533a\u3002\u8be5\u503c\u5e94\u4e3a\u5b8c\u6574\u7684\u65f6\u533a\u540d\u79f0\uff08\u89c1<a class=\"xref\" href=\"/docs/15/datatype-datetime.html#DATATYPE-TIMEZONES\" title=\"8.5.3.\u00a0\u65f6\u533a\">\u7b2c\u00a08.5.3\u00a0\u8282</a>\uff09\u3002</p>\n</p>\n</dd>\n</dl>\n</div>\n</div>\n<div class=\"refsect1\" id=\"id-1.9.5.3.8\">\n<h2 lang=\"zh\">\u6ce8\u89e3</h2>\n<p lang=\"zh\">\u4e5f\u53ef\u4ee5\u901a\u8fc7 pg_ctl initdb \u8c03\u7528 initdb\u3002</p>\n</div>\n<div class=\"refsect1\" id=\"id-1.9.5.3.9\">\n<h2 lang=\"zh\">\u53e6\u89c1</h2><span class=\"simplelist\"><a class=\"xref\" href=\"https://pg.center/docs/15/app-pg-ctl.html\" title=\"pg_ctl\"><span class=\"refentrytitle\"><span class=\"application\">pg_ctl</span></span></a>, <a class=\"xref\" href=\"https://pg.center/docs/15/app-postgres.html\" title=\"postgres\"><span class=\"refentrytitle\"><span class=\"application\">postgres</span></span></a>, <a class=\"xref\" href=\"https://pg.center/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", "localization": {"status": "complete", "sources": [{"url": "/docs/15/app-initdb.html", "method": "same-major semantic node", "sha256": "1683e2988a85f2163c17a430b8de7e27281bf4aedcc6039d318854a6f49b6e63", "language": "zh", "matched_nodes": ["#APP-INITDB/div[2]/p[1]", "#APP-INITDB/div[3]/h2[0]", "#APP-INITDB/div[4]/p[10]", "#APP-INITDB/div[4]/p[11]", "#APP-INITDB/div[4]/p[1]", "#APP-INITDB/div[4]/p[2]", "#APP-INITDB/div[4]/p[3]", "#APP-INITDB/div[4]/p[4]", "#APP-INITDB/div[4]/p[5]", "#APP-INITDB/div[4]/p[6]", "#APP-INITDB/div[4]/p[7]", "#APP-INITDB/div[4]/p[8]", "#APP-INITDB/div[4]/p[9]", "#APP-INITDB/div[5]/div[1]/dl[0]/dd[11]", "#APP-INITDB/div[5]/div[1]/dl[0]/dd[13]", "#APP-INITDB/div[5]/div[1]/dl[0]/dd[15]", "#APP-INITDB/div[5]/div[1]/dl[0]/dd[17]", "#APP-INITDB/div[5]/div[1]/dl[0]/dd[19]", "#APP-INITDB/div[5]/div[1]/dl[0]/dd[1]/p[0]", "#APP-INITDB/div[5]/div[1]/dl[0]/dd[1]/p[1]", "#APP-INITDB/div[5]/div[1]/dl[0]/dd[1]/p[2]", "#APP-INITDB/div[5]/div[1]/dl[0]/dd[21]", "#APP-INITDB/div[5]/div[1]/dl[0]/dd[23]", "#APP-INITDB/div[5]/div[1]/dl[0]/dd[25]", "#APP-INITDB/div[5]/div[1]/dl[0]/dd[27]", "#APP-INITDB/div[5]/div[1]/dl[0]/dd[29]", "#APP-INITDB/div[5]/div[1]/dl[0]/dd[31]", "#APP-INITDB/div[5]/div[1]/dl[0]/dd[33]", "#APP-INITDB/div[5]/div[1]/dl[0]/dd[35]", "#APP-INITDB/div[5]/div[1]/dl[0]/dd[37]", "#APP-INITDB/div[5]/div[1]/dl[0]/dd[39]", "#APP-INITDB/div[5]/div[1]/dl[0]/dd[3]", "#APP-INITDB/div[5]/div[1]/dl[0]/dd[41]/p[1]", "#APP-INITDB/div[5]/div[1]/dl[0]/dd[5]", "#APP-INITDB/div[5]/div[1]/dl[0]/dd[7]", "#APP-INITDB/div[5]/div[1]/dl[0]/dd[9]", "#APP-INITDB/div[5]/div[3]/dl[0]/dd[1]", "#APP-INITDB/div[5]/div[3]/dl[0]/dd[3]", "#APP-INITDB/div[5]/div[3]/dl[0]/dd[5]", "#APP-INITDB/div[5]/div[3]/dl[0]/dd[7]", "#APP-INITDB/div[5]/div[5]/dl[0]/dd[1]", "#APP-INITDB/div[5]/div[5]/dl[0]/dd[3]", "#APP-INITDB/div[5]/p[2]", "#APP-INITDB/div[5]/p[4]", "#APP-INITDB/div[6]/div[1]/dl[0]/dd[1]", "#APP-INITDB/div[6]/div[1]/dl[0]/dd[3]", "#APP-INITDB/div[6]/div[1]/dl[0]/dd[5]", "#APP-INITDB/div[6]/h2[0]", "#APP-INITDB/div[7]/h2[0]", "#APP-INITDB/div[8]/h2[0]"]}], "language": "zh", "original_text": {"/versions/15/description/0": "initdb \u2014 create a new PostgreSQL database cluster", "/versions/15/facts/0/label": "Documented executable", "/versions/15/facts/1/label": "Executable version", "/versions/15/facts/2/label": "Reference inventory", "/versions/15/facts/2/value": "Server applications", "/versions/15/facts/3/label": "Option definition groups", "/versions/15/tables/0/title": "Documented options", "/versions/15/tables/1/title": "Environment variables", "/versions/15/tables/0/rows/0/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.", "/versions/15/tables/0/rows/1/summary": "This option specifies the authentication method for local users via TCP/IP connections used in pg_hba.conf ( host lines).", "/versions/15/tables/0/rows/2/summary": "This option specifies the authentication method for local users via Unix-domain socket connections used in pg_hba.conf ( local lines).", "/versions/15/tables/0/rows/3/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.", "/versions/15/tables/0/rows/4/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 .", "/versions/15/tables/0/rows/5/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.", "/versions/15/tables/0/rows/6/summary": "Specifies the ICU locale ID, if the ICU locale provider is used.", "/versions/15/tables/0/rows/7/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.", "/versions/15/tables/0/rows/8/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 .", "/versions/15/tables/0/rows/9/summary": "Like --locale , but only sets the locale in the specified category.", "/versions/15/tables/0/columns/0/label": "Option and arguments", "/versions/15/tables/0/columns/1/label": "Description", "/versions/15/tables/0/rows/10/summary": "Equivalent to --locale=C .", "/versions/15/tables/0/rows/11/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 .", "/versions/15/tables/0/rows/12/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.", "/versions/15/tables/0/rows/13/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.", "/versions/15/tables/0/rows/14/summary": "Makes initdb read the database superuser's password from a file. The first line of the file is taken as the password.", "/versions/15/tables/0/rows/15/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 .", "/versions/15/tables/0/rows/16/summary": "Sets the default text search configuration. See default_text_search_config for further information.", "/versions/15/tables/0/rows/17/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.", "/versions/15/tables/0/rows/18/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.", "/versions/15/tables/0/rows/19/summary": "This option specifies the directory where the write-ahead log should be stored.", "/versions/15/tables/0/rows/20/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.", "/versions/15/tables/0/rows/21/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.", "/versions/15/tables/0/rows/22/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.", "/versions/15/tables/0/rows/23/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.", "/versions/15/tables/0/rows/24/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.", "/versions/15/tables/0/rows/25/summary": "Print the initdb version and exit.", "/versions/15/tables/0/rows/26/summary": "Show help about initdb command line arguments, and exit.", "/versions/15/tables/1/columns/0/label": "Variable", "/versions/15/tables/1/columns/1/label": "Meaning", "/versions/15/tables/1/rows/0/description": "Specifies the directory where the database cluster is to be stored; can be overridden using the -D option.", "/versions/15/tables/1/rows/1/description": "Specifies whether to use color in diagnostic messages. Possible values are always , auto and never .", "/versions/15/tables/1/rows/2/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 )."}, "fallback_fields": [], "source_language": "en", "original_snapshot_sha256": "3f1b41a72126d2f9ab968b190262d5c18ebe834c754a955a7f527f27bce9dd01"}, "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", "manual_language": "zh"}, "16": {"facts": [{"label": "\u624b\u518c\u4e2d\u7684\u53ef\u6267\u884c\u7a0b\u5e8f", "value": "initdb"}, {"label": "\u7a0b\u5e8f\u7248\u672c", "value": "16.15"}, {"label": "\u53c2\u8003\u6e05\u5355", "value": "\u670d\u52a1\u7aef\u7a0b\u5e8f"}, {"label": "\u9009\u9879\u5b9a\u4e49\u7ec4", "value": "29"}], "tables": [{"key": "options", "rows": [{"summary": "\u8be5\u9009\u9879\u6307\u5b9a pg_hba.conf \u4e2d\u672c\u5730\u7528\u6237\u9ed8\u8ba4\u4f7f\u7528\u7684\u8ba4\u8bc1\u65b9\u6cd5\uff08 host \u548c local \u884c\uff09\u3002\u6709\u6548\u503c\u6982\u89c8\u89c1 \u7b2c 21.1 \u8282 \u3002", "signature": {"url": "/docs/16/app-initdb.html#APP-INITDB-OPTION-AUTH", "text": "-A authmethod --auth= authmethod"}}, {"summary": "\u8be5\u9009\u9879\u6307\u5b9a pg_hba.conf \u4e2d\u672c\u5730\u7528\u6237\u901a\u8fc7 TCP/IP \u8fde\u63a5\u65f6\uff08 host \u884c\uff09\u4f7f\u7528\u7684\u8ba4\u8bc1\u65b9\u6cd5\u3002", "signature": {"url": "/docs/16/app-initdb.html#APP-INITDB-OPTION-AUTH-HOST", "text": "--auth-host= authmethod"}}, {"summary": "\u8be5\u9009\u9879\u6307\u5b9a pg_hba.conf \u4e2d\u672c\u5730\u7528\u6237\u901a\u8fc7 Unix \u57df\u5957\u63a5\u5b57\u8fde\u63a5\u65f6\uff08 local \u884c\uff09\u4f7f\u7528\u7684\u8ba4\u8bc1\u65b9\u6cd5\u3002", "signature": {"url": "/docs/16/app-initdb.html#APP-INITDB-OPTION-AUTH-LOCAL", "text": "--auth-local= authmethod"}}, {"summary": "\u8be5\u9009\u9879\u6307\u5b9a\u6570\u636e\u5e93\u96c6\u7c07\u5e94\u5b58\u653e\u7684\u76ee\u5f55\u3002\u8fd9\u662f initdb \u6240\u9700\u7684\u552f\u4e00\u4fe1\u606f\uff0c\u4f46\u4e5f\u53ef\u4ee5\u901a\u8fc7\u8bbe\u7f6e PGDATA \u73af\u5883\u53d8\u91cf\u6765\u7701\u53bb\u663e\u5f0f\u5199\u51fa\u5b83\uff1b\u8fd9\u901a\u5e38\u66f4\u65b9\u4fbf\uff0c\u56e0\u4e3a\u6570\u636e\u5e93\u670d\u52a1\u5668\uff08 postgres \uff09\u4e4b\u540e\u4e5f\u53ef\u4ee5\u901a\u8fc7\u540c\u4e00\u53d8\u91cf\u627e\u5230\u6570\u636e\u76ee\u5f55\u3002", "signature": {"url": "/docs/16/app-initdb.html#APP-INITDB-OPTION-PGDATA", "text": "-D directory --pgdata= directory"}}, {"summary": "\u9009\u62e9\u6a21\u677f\u6570\u636e\u5e93\u7684\u7f16\u7801\u3002\u8fd9\u4e5f\u5c06\u6210\u4e3a\u4ee5\u540e\u521b\u5efa\u7684\u4efb\u4f55\u6570\u636e\u5e93\u7684\u9ed8\u8ba4\u7f16\u7801\uff0c\u9664\u975e\u5728\u521b\u5efa\u65f6\u8986\u76d6\u5b83\u3002 PostgreSQL \u670d\u52a1\u5668\u652f\u6301\u7684\u5b57\u7b26\u96c6\u89c1 \u7b2c 24.3.1 \u8282 \u3002", "signature": {"url": "/docs/16/app-initdb.html#APP-INITDB-OPTION-ENCODING", "text": "-E encoding --encoding= encoding"}}, {"summary": "\u5141\u8bb8\u4e0e\u96c6\u7c07\u62e5\u6709\u8005\u540c\u7ec4\u7684\u7528\u6237\u8bfb\u53d6\u7531 initdb \u521b\u5efa\u7684\u6240\u6709\u96c6\u7c07\u6587\u4ef6\u3002\u8be5\u9009\u9879\u5728 Windows \u4e0a\u4f1a\u88ab\u5ffd\u7565\uff0c\u56e0\u4e3a\u5b83\u4e0d\u652f\u6301 POSIX \u98ce\u683c\u7684\u7ec4\u6743\u9650\u3002", "signature": {"url": "/docs/16/app-initdb.html#APP-INITDB-ALLOW-GROUP-ACCESS", "text": "-g --allow-group-access"}}, {"summary": "\u5f53\u4f7f\u7528 ICU \u63d0\u4f9b\u7a0b\u5e8f\u65f6\uff0c\u6307\u5b9a ICU \u533a\u57df\u8bbe\u7f6e\u3002\u533a\u57df\u8bbe\u7f6e\u652f\u6301\u89c1 \u7b2c 24.1 \u8282 \u3002", "signature": {"url": "/docs/16/app-initdb.html#APP-INITDB-ICU-LOCALE", "text": "--icu-locale= locale"}}, {"summary": "\u6307\u5b9a\u9644\u52a0\u7684\u6392\u5e8f\u89c4\u5219\uff0c\u4ee5\u5b9a\u5236\u9ed8\u8ba4\u6392\u5e8f\u89c4\u5219\u7684\u884c\u4e3a\u3002\u8be5\u9009\u9879\u4ec5\u652f\u6301 ICU\u3002", "signature": {"url": "/docs/16/app-initdb.html#APP-INITDB-ICU-RULES", "text": "--icu-rules= rules"}}, {"summary": "\u5728\u6570\u636e\u9875\u4e0a\u4f7f\u7528\u6821\u9a8c\u548c\uff0c\u5e2e\u52a9\u68c0\u6d4b I/O \u7cfb\u7edf\u9020\u6210\u7684\u3001\u5426\u5219\u53ef\u80fd\u6084\u65e0\u58f0\u606f\u7684\u6570\u636e\u635f\u574f\u3002\u542f\u7528\u6821\u9a8c\u548c\u53ef\u80fd\u4f1a\u5e26\u6765\u660e\u663e\u7684\u6027\u80fd\u635f\u5931\u3002\u5982\u679c\u542f\u7528\uff0c\u5c31\u4f1a\u4e3a\u6240\u6709\u6570\u636e\u5e93\u4e2d\u7684\u6240\u6709\u5bf9\u8c61\u8ba1\u7b97\u6821\u9a8c\u548c\u3002\u6240\u6709\u6821\u9a8c\u548c\u5931\u8d25\u90fd\u4f1a\u5728 pg_stat_database \u89c6\u56fe\u4e2d\u62a5\u544a\u3002\u8be6\u89c1 \u7b2c 30.2 \u8282 \u3002", "signature": {"url": "/docs/16/app-initdb.html#APP-INITDB-DATA-CHECKSUMS", "text": "-k --data-checksums"}}, {"summary": "\u8bbe\u7f6e\u6570\u636e\u5e93\u96c6\u7c07\u7684\u9ed8\u8ba4\u533a\u57df\u8bbe\u7f6e\u3002\u5982\u679c\u672a\u6307\u5b9a\u8be5\u9009\u9879\uff0c\u533a\u57df\u8bbe\u7f6e\u5c06\u7ee7\u627f\u81ea initdb \u8fd0\u884c\u65f6\u6240\u5728\u7684\u73af\u5883\u3002\u533a\u57df\u8bbe\u7f6e\u652f\u6301\u89c1 \u7b2c 24.1 \u8282 \u3002", "signature": {"url": "/docs/16/app-initdb.html#APP-INITDB-OPTION-LOCALE", "text": "--locale= locale"}}, {"summary": "\u7c7b\u4f3c\u4e8e --locale \uff0c\u4f46\u53ea\u5728\u6307\u5b9a\u7684\u7c7b\u522b\u4e2d\u8bbe\u7f6e\u533a\u57df\u8bbe\u7f6e\u3002", "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": "\u7b49\u4ef7\u4e8e --locale=C \u3002", "signature": {"url": "/docs/16/app-initdb.html#APP-INITDB-OPTION-NO-LOCALE", "text": "--no-locale"}}, {"summary": "\u8be5\u9009\u9879\u8bbe\u7f6e\u65b0\u96c6\u7c07\u4e2d\u521b\u5efa\u7684\u6570\u636e\u5e93\u6240\u4f7f\u7528\u7684\u533a\u57df\u8bbe\u7f6e\u63d0\u4f9b\u7a0b\u5e8f\u3002\u540e\u7eed\u521b\u5efa\u65b0\u6570\u636e\u5e93\u65f6\uff0c\u53ef\u4ee5\u5728 CREATE DATABASE \u547d\u4ee4\u4e2d\u8986\u76d6\u5b83\u3002\u9ed8\u8ba4\u503c\u4e3a libc \uff08\u89c1 \u7b2c 24.1.4 \u8282 \uff09\u3002", "signature": {"url": "/docs/16/app-initdb.html#APP-INITDB-OPTION-LOCALE-PROVIDER", "text": "--locale-provider={ libc | icu }"}}, {"summary": "\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c initdb \u4f1a\u7b49\u5f85\u6240\u6709\u6587\u4ef6\u90fd\u5b89\u5168\u5199\u5165\u78c1\u76d8\u3002\u8be5\u9009\u9879\u4f7f initdb \u5728\u4e0d\u7b49\u5f85\u7684\u60c5\u51b5\u4e0b\u8fd4\u56de\uff0c\u901f\u5ea6\u66f4\u5feb\uff0c\u4f46\u8fd9\u610f\u5473\u7740\u5982\u679c\u540e\u7eed\u64cd\u4f5c\u7cfb\u7edf\u5d29\u6e83\uff0c\u6570\u636e\u76ee\u5f55\u53ef\u80fd\u4f1a\u635f\u574f\u3002\u901a\u5e38\uff0c\u8be5\u9009\u9879\u9002\u7528\u4e8e\u6d4b\u8bd5\uff0c\u4f46\u4e0d\u5e94\u7528\u4e8e\u521b\u5efa\u751f\u4ea7\u73af\u5883\u5b89\u88c5\u3002", "signature": {"url": "/docs/16/app-initdb.html#APP-INITDB-OPTION-NO-SYNC", "text": "-N --no-sync"}}, {"summary": "\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c initdb \u4f1a\u5728\u5176\u8f93\u51fa\u672b\u5c3e\u5199\u51fa\u5982\u4f55\u542f\u52a8\u96c6\u7c07\u7684\u8bf4\u660e\u3002\u8be5\u9009\u9879\u4f1a\u7701\u7565\u8fd9\u4e9b\u8bf4\u660e\u3002\u5b83\u4e3b\u8981\u4f9b\u90a3\u4e9b\u5bf9 initdb \u8fdb\u884c\u5e73\u53f0\u7279\u5b9a\u5c01\u88c5\u7684\u5de5\u5177\u4f7f\u7528\uff0c\u56e0\u4e3a\u5728\u8fd9\u79cd\u60c5\u51b5\u4e0b\u90a3\u4e9b\u8bf4\u660e\u5f88\u53ef\u80fd\u5e76\u4e0d\u6b63\u786e\u3002", "signature": {"url": "/docs/16/app-initdb.html#APP-INITDB-OPTION-NO-INSTRUCTIONS", "text": "--no-instructions"}}, {"summary": "\u4f7f initdb \u4ece\u6587\u4ef6\u4e2d\u8bfb\u53d6\u5f15\u5bfc\u8d85\u7ea7\u7528\u6237\u7684\u5bc6\u7801\u3002\u6587\u4ef6\u7684\u7b2c\u4e00\u884c\u4f1a\u88ab\u5f53\u4f5c\u5bc6\u7801\u3002", "signature": {"url": "/docs/16/app-initdb.html#APP-INITDB-OPTION-PWFILE", "text": "--pwfile= filename"}}, {"summary": "\u5c06\u6240\u6709\u6570\u636e\u5e93\u6587\u4ef6\u5b89\u5168\u5730\u5199\u5165\u78c1\u76d8\u5e76\u9000\u51fa\u3002\u8fd9\u4e0d\u4f1a\u6267\u884c\u4efb\u4f55\u5e38\u89c4\u7684 initdb \u64cd\u4f5c\u3002\u901a\u5e38\uff0c\u8be5\u9009\u9879\u53ef\u7528\u4e8e\u5728\u5c06 fsync \u4ece off \u6539\u4e3a on \u540e\uff0c\u786e\u4fdd\u80fd\u591f\u53ef\u9760\u6062\u590d\u3002", "signature": {"url": "/docs/16/app-initdb.html#APP-INITDB-OPTION-SYNC-ONLY", "text": "-S --sync-only"}}, {"summary": "\u8bbe\u7f6e\u9ed8\u8ba4\u6587\u672c\u68c0\u7d22\u914d\u7f6e\u3002\u66f4\u591a\u4fe1\u606f\u89c1 default_text_search_config \u3002", "signature": {"url": "/docs/16/app-initdb.html#APP-INITDB-OPTION-TEXT-SEARCH-CONFIG", "text": "-T config --text-search-config= config"}}, {"summary": "\u8bbe\u7f6e \u5f15\u5bfc\u8d85\u7ea7\u7528\u6237 \u7684\u7528\u6237\u540d\u3002\u9ed8\u8ba4\u503c\u662f\u8fd0\u884c initdb \u7684\u64cd\u4f5c\u7cfb\u7edf\u7528\u6237\u540d\u3002", "signature": {"url": "/docs/16/app-initdb.html#APP-INITDB-OPTION-USERNAME", "text": "-U username --username= username"}}, {"summary": "\u4f7f initdb \u63d0\u793a\u8f93\u5165\u8981\u8d4b\u7ed9\u5f15\u5bfc\u8d85\u7ea7\u7528\u6237\u7684\u5bc6\u7801\u3002\u5982\u679c\u4e0d\u6253\u7b97\u4f7f\u7528\u5bc6\u7801\u8ba4\u8bc1\uff0c\u8fd9\u4e00\u70b9\u5e76\u4e0d\u91cd\u8981\u3002\u5426\u5219\uff0c\u5728\u8bbe\u7f6e\u5bc6\u7801\u4e4b\u524d\u5c06\u65e0\u6cd5\u4f7f\u7528\u5bc6\u7801\u8ba4\u8bc1\u3002", "signature": {"url": "/docs/16/app-initdb.html#APP-INITDB-OPTION-PWPROMPT", "text": "-W --pwprompt"}}, {"summary": "\u8be5\u9009\u9879\u6307\u5b9a\u9884\u5199\u5f0f\u65e5\u5fd7\uff08WAL\uff09\u5e94\u5b58\u653e\u7684\u76ee\u5f55\u3002", "signature": {"url": "/docs/16/app-initdb.html#APP-INITDB-OPTION-WALDIR", "text": "-X directory --waldir= directory"}}, {"summary": "\u8bbe\u7f6e WAL \u6bb5\u5927\u5c0f\uff0c\u5355\u4f4d\u4e3a\u5146\u5b57\u8282\u3002\u8fd9\u662f WAL \u65e5\u5fd7\u4e2d\u6bcf\u4e2a\u72ec\u7acb\u6587\u4ef6\u7684\u5927\u5c0f\u3002\u9ed8\u8ba4\u5927\u5c0f\u4e3a 16 \u5146\u5b57\u8282\u3002\u53d6\u503c\u5fc5\u987b\u662f 1 \u5230 1024\uff08\u5146\u5b57\u8282\uff09\u4e4b\u95f4\u7684 2 \u7684\u5e42\u3002\u6b64\u9009\u9879\u53ea\u80fd\u5728\u521d\u59cb\u5316\u65f6\u8bbe\u7f6e\uff0c\u4e4b\u540e\u65e0\u6cd5\u66f4\u6539\u3002", "signature": {"url": "/docs/16/app-initdb.html#APP-INITDB-OPTION-WAL-SEGSIZE", "text": "--wal-segsize= size"}}, {"summary": "\u5728 initdb \u671f\u95f4\u5f3a\u5236\u5c06\u670d\u52a1\u5668\u53c2\u6570 name \u8bbe\u4e3a value\uff0c\u5e76\u628a\u8be5\u8bbe\u7f6e\u5199\u5165\u751f\u6210\u7684 postgresql.conf \u6587\u4ef6\uff0c\u4f7f\u5176\u5728\u4e4b\u540e\u7684\u670d\u52a1\u5668\u8fd0\u884c\u4e2d\u4e5f\u751f\u6548\u3002\u6b64\u9009\u9879\u53ef\u591a\u6b21\u4f7f\u7528\uff0c\u4ee5\u8bbe\u7f6e\u591a\u4e2a\u53c2\u6570\u3002\u5b83\u4e3b\u8981\u7528\u4e8e\u73af\u5883\u6761\u4ef6\u5bfc\u81f4\u670d\u52a1\u5668\u5b8c\u5168\u65e0\u6cd5\u4f7f\u7528\u9ed8\u8ba4\u53c2\u6570\u542f\u52a8\u7684\u60c5\u51b5\u3002", "signature": {"url": "/docs/16/app-initdb.html#APP-INITDB-OPTION-SET", "text": "-c name = value --set name = value"}}, {"summary": "\u6253\u5370\u5f15\u5bfc\u540e\u7aef\u7684\u8c03\u8bd5\u8f93\u51fa\uff0c\u4ee5\u53ca\u5c11\u91cf\u666e\u901a\u7528\u6237\u901a\u5e38\u4e0d\u611f\u5174\u8da3\u7684\u5176\u4ed6\u6d88\u606f\u3002\u5f15\u5bfc\u540e\u7aef\u662f initdb \u7528\u6765\u521b\u5efa\u7cfb\u7edf\u76ee\u5f55\u8868\u7684\u7a0b\u5e8f\u3002\u8be5\u9009\u9879\u4f1a\u4ea7\u751f\u5927\u91cf\u6781\u5176\u4e4f\u5473\u7684\u8f93\u51fa\u3002", "signature": {"url": "/docs/16/app-initdb.html#APP-INITDB-OPTION-DEBUG", "text": "-d --debug"}}, {"summary": "\u4f7f\u7528 debug_discard_caches=1 \u9009\u9879\u8fd0\u884c\u5f15\u5bfc\u540e\u7aef\u3002\u8fd9\u4f1a\u82b1\u8d39\u5f88\u957f\u65f6\u95f4\uff0c\u53ea\u5bf9\u6df1\u5ea6\u8c03\u8bd5\u6709\u7528\u3002", "signature": {"url": "/docs/16/app-initdb.html#APP-INITDB-OPTION-DISCARD-CACHES", "text": "--discard-caches"}}, {"summary": "\u6307\u5b9a initdb \u521d\u59cb\u5316\u6570\u636e\u5e93\u96c6\u7c07\u65f6\u5e94\u5230\u54ea\u91cc\u67e5\u627e\u5176\u8f93\u5165\u6587\u4ef6\u3002\u901a\u5e38\u4e0d\u9700\u8981\u8fd9\u6837\u505a\u3002\u82e5\u9700\u8981\u663e\u5f0f\u6307\u5b9a\u5176\u4f4d\u7f6e\uff0c\u7cfb\u7edf\u4f1a\u63d0\u793a\u3002", "signature": {"url": "/docs/16/app-initdb.html#APP-INITDB-OPTION-L", "text": "-L directory"}}, {"summary": "\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c\u5982\u679c initdb \u53d1\u73b0\u67d0\u4e2a\u9519\u8bef\u4f7f\u5176\u65e0\u6cd5\u5b8c\u6574\u521b\u5efa\u6570\u636e\u5e93\u96c6\u7c07\uff0c\u5c31\u4f1a\u5220\u9664\u5b83\u5728\u53d1\u73b0\u65e0\u6cd5\u5b8c\u6210\u4efb\u52a1\u4e4b\u524d\u53ef\u80fd\u5df2\u521b\u5efa\u7684\u6240\u6709\u6587\u4ef6\u3002\u8be5\u9009\u9879\u4f1a\u7981\u6b62\u8fd9\u79cd\u6e05\u7406\uff0c\u56e0\u6b64\u5bf9\u8c03\u8bd5\u6709\u7528\u3002", "signature": {"url": "/docs/16/app-initdb.html#APP-INITDB-OPTION-NO-CLEAN", "text": "-n --no-clean"}}, {"summary": "\u6253\u5370 initdb \u7248\u672c\u5e76\u9000\u51fa\u3002", "signature": {"url": "/docs/16/app-initdb.html#APP-INITDB-OPTION-VERSION", "text": "-V --version"}}, {"summary": "\u663e\u793a\u6709\u5173 initdb \u547d\u4ee4\u884c\u53c2\u6570\u7684\u5e2e\u52a9\u5e76\u9000\u51fa\u3002", "signature": {"url": "/docs/16/app-initdb.html#APP-INITDB-OPTION-HELP", "text": "-? --help"}}], "title": "\u624b\u518c\u4e2d\u7684\u9009\u9879", "columns": [{"key": "signature", "label": "\u9009\u9879\u4e0e\u53c2\u6570"}, {"key": "summary", "label": "\u8bf4\u660e"}]}, {"key": "environment", "rows": [{"name": "PGDATA", "description": "\u6307\u5b9a\u6570\u636e\u5e93\u96c6\u7c07\u5e94\u5b58\u653e\u7684\u76ee\u5f55\uff1b\u53ef\u4f7f\u7528 -D \u9009\u9879\u8986\u76d6\u3002"}, {"name": "PG_COLOR", "description": "\u6307\u5b9a\u8bca\u65ad\u6d88\u606f\u662f\u5426\u4f7f\u7528\u989c\u8272\u3002\u53ef\u9009\u503c\u4e3a always \u3001 auto \u548c never \u3002"}, {"name": "TZ", "description": "\u6307\u5b9a\u6240\u521b\u5efa\u6570\u636e\u5e93\u96c6\u7c07\u7684\u9ed8\u8ba4\u65f6\u533a\u3002\u8be5\u503c\u5e94\u4e3a\u5b8c\u6574\u7684\u65f6\u533a\u540d\u79f0\uff08\u89c1 \u7b2c 8.5.3 \u8282 \uff09\u3002"}], "title": "\u73af\u5883\u53d8\u91cf", "columns": [{"key": "name", "label": "\u53d8\u91cf"}, {"key": "description", "label": "\u542b\u4e49"}]}], "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": "https://pg.center/docs/16/app-initdb.html", "file": "app-initdb.html", "label": "16.15 English manual \u00b7 app-initdb.html", "anchor": "", "sha256": "7ac7c692002c8e409f240ae0233ee4d9c3dc0dd4fb155738b983aa8c1429e07d", "language": "en", "original_url": "/docs/16/app-initdb.html"}, {"url": "https://pg.center/docs/16/reference-server.html", "file": "reference-server.html", "label": "Server applications inventory", "anchor": "", "sha256": "8aaa4422eece8f26d84715f855d9d0f7f87b200f8b82898c73c865ee42c2c70f", "language": "en", "original_url": "/docs/16/reference-server.html"}], "sections": [], "synopsis": ["initdb [ option ...] [ --pgdata | -D ] directory"], "signature": "initdb [ option ...] [ --pgdata | -D ] directory", "description": ["initdb \u2014 \u521b\u5efa\u4e00\u4e2a\u65b0\u7684 PostgreSQL \u6570\u636e\u5e93\u96c6\u7c07"], "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 lang=\"zh\">initdb \u2014 \u521b\u5efa\u4e00\u4e2a\u65b0\u7684<span class=\"productname\">PostgreSQL</span>\u6570\u636e\u5e93\u96c6\u7c07</p>\n</div>\n<div class=\"refsynopsisdiv\">\n<h2 lang=\"zh\">\u5927\u7eb2</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 lang=\"zh\">\u8bf4\u660e</h2>\n<p lang=\"zh\"><code class=\"command\">initdb</code>\u521b\u5efa\u4e00\u4e2a\u65b0\u7684<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=\"\u6570\u636e\u5e93\u96c6\u7c07\">\u6570\u636e\u5e93\u96c6\u7c07</a>\u3002</p>\n<p lang=\"zh\">\u521b\u5efa\u6570\u636e\u5e93\u96c6\u7c07\u5305\u62ec\u521b\u5efa\u7528\u4e8e\u5b58\u653e\u96c6\u7c07\u6570\u636e\u7684<a class=\"glossterm\" href=\"/docs/16/glossary.html#GLOSSARY-DATA-DIRECTORY\"></a><a class=\"glossterm\" href=\"/docs/16/glossary.html#GLOSSARY-DATA-DIRECTORY\" title=\"\u6570\u636e\u76ee\u5f55\">\u76ee\u5f55</a>\uff0c\u751f\u6210\u5171\u4eab\u7cfb\u7edf\u76ee\u5f55\u8868\uff08\u5c5e\u4e8e\u6574\u4e2a\u96c6\u7c07\u800c\u4e0d\u662f\u67d0\u4e2a\u7279\u5b9a\u6570\u636e\u5e93\u7684\u8868\uff09\uff0c\u4ee5\u53ca\u521b\u5efa <code class=\"literal\">postgres</code>\u3001<code class=\"literal\">template1</code> \u548c <code class=\"literal\">template0</code> \u6570\u636e\u5e93\u3002<code class=\"literal\">postgres</code> \u6570\u636e\u5e93\u662f\u4e00\u4e2a\u9ed8\u8ba4\u6570\u636e\u5e93\uff0c\u4f9b\u7528\u6237\u3001\u5de5\u5177\u7a0b\u5e8f\u548c\u7b2c\u4e09\u65b9\u5e94\u7528\u7a0b\u5e8f\u4f7f\u7528\u3002<code class=\"literal\">template1</code> \u548c <code class=\"literal\">template0</code> \u7528\u4f5c\u540e\u7eed<code class=\"command\">CREATE DATABASE</code>\u547d\u4ee4\u590d\u5236\u7684\u6e90\u6570\u636e\u5e93\u3002<code class=\"literal\">template0</code> \u4e0d\u5e94\u88ab\u4fee\u6539\uff0c\u4f46\u53ef\u4ee5\u5411 <code class=\"literal\">template1</code> \u4e2d\u6dfb\u52a0\u5bf9\u8c61\uff0c\u8fd9\u4e9b\u5bf9\u8c61\u9ed8\u8ba4\u4f1a\u88ab\u590d\u5236\u5230\u4ee5\u540e\u521b\u5efa\u7684\u6570\u636e\u5e93\u4e2d\u3002\u66f4\u591a\u7ec6\u8282\u89c1<a class=\"xref\" href=\"/docs/16/manage-ag-templatedbs.html\" title=\"23.3.\u00a0\u6a21\u677f\u6570\u636e\u5e93\">\u7b2c\u00a023.3\u00a0\u8282</a>\u3002</p>\n<p lang=\"zh\">\u867d\u7136<code class=\"command\">initdb</code>\u4f1a\u5c1d\u8bd5\u521b\u5efa\u6307\u5b9a\u7684\u6570\u636e\u76ee\u5f55\uff0c\u4f46\u5982\u679c\u6240\u9700\u6570\u636e\u76ee\u5f55\u7684\u7236\u76ee\u5f55\u5f52 root \u6240\u6709\uff0c\u5b83\u53ef\u80fd\u6ca1\u6709\u8db3\u591f\u7684\u6743\u9650\u3002\u8981\u5728\u8fd9\u79cd\u73af\u5883\u4e2d\u521d\u59cb\u5316\uff0c\u53ef\u5148\u7531 root \u521b\u5efa\u4e00\u4e2a\u7a7a\u7684\u6570\u636e\u76ee\u5f55\uff0c\u7136\u540e\u7528<code class=\"command\">chown</code>\u5c06\u8be5\u76ee\u5f55\u7684\u6240\u6709\u6743\u8d4b\u4e88\u6570\u636e\u5e93\u7528\u6237\u8d26\u6237\uff0c\u518d\u7528 <code class=\"command\">su</code>\u5207\u6362\u4e3a\u8be5\u6570\u636e\u5e93\u7528\u6237\u6765\u8fd0\u884c<code class=\"command\">initdb</code>\u3002</p>\n<p lang=\"zh\"><code class=\"command\">initdb</code>\u5fc5\u987b\u4ee5\u5c06\u62e5\u6709\u670d\u52a1\u5668\u8fdb\u7a0b\u7684\u7528\u6237\u8eab\u4efd\u8fd0\u884c\uff0c\u56e0\u4e3a\u670d\u52a1\u5668\u9700\u8981\u8bbf\u95ee <code class=\"command\">initdb</code>\u521b\u5efa\u7684\u6587\u4ef6\u548c\u76ee\u5f55\u3002\u7531\u4e8e\u670d\u52a1\u5668\u4e0d\u80fd\u4ee5 root \u8eab\u4efd\u8fd0\u884c\uff0c\u56e0\u6b64\u4e5f\u7edd\u4e0d\u80fd\u4ee5 root \u8eab\u4efd\u8fd0\u884c<code class=\"command\">initdb</code>\u3002\uff08\u5b9e\u9645\u4e0a\u5b83\u4f1a\u62d2\u7edd\u8fd9\u6837\u505a\u3002\uff09</p>\n<p lang=\"zh\">\u51fa\u4e8e\u5b89\u5168\u539f\u56e0\uff0c<code class=\"command\">initdb</code>\u521b\u5efa\u7684\u65b0\u96c6\u7c07\u9ed8\u8ba4\u53ea\u6709\u96c6\u7c07\u62e5\u6709\u8005\u53ef\u4ee5\u8bbf\u95ee\u3002<code class=\"option\">--allow-group-access</code> \u9009\u9879\u5141\u8bb8\u4e0e\u96c6\u7c07\u62e5\u6709\u8005\u540c\u7ec4\u7684\u4efb\u4f55\u7528\u6237\u8bfb\u53d6\u96c6\u7c07\u4e2d\u7684\u6587\u4ef6\u3002\u8fd9\u5bf9\u7531\u975e\u7279\u6743\u7528\u6237\u6267\u884c\u5907\u4efd\u5f88\u6709\u7528\u3002</p>\n<p lang=\"zh\"><code class=\"command\">initdb</code>\u4f1a\u521d\u59cb\u5316\u6570\u636e\u5e93\u96c6\u7c07\u7684\u9ed8\u8ba4\u533a\u57df\u8bbe\u7f6e\u548c\u5b57\u7b26\u96c6\u7f16\u7801\u3002\u8fd9\u4e9b\u8bbe\u7f6e\u4e5f\u53ef\u4ee5\u5728\u521b\u5efa\u6bcf\u4e2a\u6570\u636e\u5e93\u65f6\u5206\u522b\u8bbe\u7f6e\u3002<code class=\"command\">initdb</code>\u4e3a\u6a21\u677f\u6570\u636e\u5e93\u786e\u5b9a\u8fd9\u4e9b\u8bbe\u7f6e\uff0c\u5b83\u4eec\u5c06\u4f5c\u4e3a\u6240\u6709\u5176\u4ed6\u6570\u636e\u5e93\u7684\u9ed8\u8ba4\u503c\u3002</p>\n<p lang=\"zh\">\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c<code class=\"command\">initdb</code>\u4f7f\u7528<code class=\"literal\">libc</code>\u533a\u57df\u8bbe\u7f6e\u63d0\u4f9b\u7a0b\u5e8f\uff08\u89c1<a class=\"xref\" href=\"/docs/16/locale.html#LOCALE-PROVIDERS\" title=\"24.1.4.\u00a0\u533a\u57df\u8bbe\u7f6e\u63d0\u4f9b\u7a0b\u5e8f\">\u7b2c\u00a024.1.4\u00a0\u8282</a>\uff09\u3002<code class=\"literal\">libc</code>\u533a\u57df\u8bbe\u7f6e\u63d0\u4f9b\u7a0b\u5e8f\u4f1a\u4ece\u73af\u5883\u4e2d\u83b7\u53d6\u533a\u57df\u8bbe\u7f6e\uff0c\u5e76\u6839\u636e\u533a\u57df\u8bbe\u7f6e\u786e\u5b9a\u7f16\u7801\u3002</p>\n<p lang=\"zh\">\u8981\u4e3a\u96c6\u7c07\u9009\u62e9\u4e0d\u540c\u7684\u533a\u57df\u8bbe\u7f6e\uff0c\u8bf7\u4f7f\u7528<code class=\"option\">--locale</code>\u3002\u6b64\u5916\u8fd8\u6709\u5355\u72ec\u7684 <code class=\"option\">--lc-*</code> \u548c <code class=\"option\">--icu-locale</code> \u9009\u9879\uff08\u89c1\u4e0b\u6587\uff09\uff0c\u7528\u4e8e\u4e3a\u5404\u4e2a\u533a\u57df\u8bbe\u7f6e\u7c7b\u522b\u8bbe\u7f6e\u503c\u3002\u8bf7\u6ce8\u610f\uff0c\u4e0d\u540c\u533a\u57df\u8bbe\u7f6e\u7c7b\u522b\u4e4b\u95f4\u82e5\u8bbe\u7f6e\u4e0d\u4e00\u81f4\uff0c\u53ef\u80fd\u4ea7\u751f\u4e0d\u5408\u7406\u7684\u7ed3\u679c\uff0c\u56e0\u6b64\u5e94\u8c28\u614e\u4f7f\u7528\u3002</p>\n<p lang=\"zh\">\u4e5f\u53ef\u4ee5\u6307\u5b9a --locale-provider=icu\uff0c\u8ba9 initdb \u4f7f\u7528 ICU \u5e93\u63d0\u4f9b\u533a\u57df\u8bbe\u7f6e\u670d\u52a1\u3002\u670d\u52a1\u5668\u5fc5\u987b\u5728\u6784\u5efa\u65f6\u542f\u7528 ICU \u652f\u6301\u3002\u4f7f\u7528 --icu-locale \u9009\u9879\u9009\u62e9\u5177\u4f53\u7684 ICU \u533a\u57df ID\u3002\u6ce8\u610f\uff0c\u51fa\u4e8e\u5b9e\u73b0\u65b9\u9762\u7684\u539f\u56e0\u4ee5\u53ca\u5bf9\u65e7\u4ee3\u7801\u7684\u517c\u5bb9\uff0c\u5373\u4f7f\u4f7f\u7528 ICU \u533a\u57df\u8bbe\u7f6e\u63d0\u4f9b\u8005\uff0cinitdb \u4ecd\u4f1a\u9009\u62e9\u5e76\u521d\u59cb\u5316 libc \u533a\u57df\u8bbe\u7f6e\u3002</p>\n<p lang=\"zh\"><code class=\"command\">initdb</code>\u8fd0\u884c\u65f6\u4f1a\u6253\u5370\u51fa\u5b83\u9009\u62e9\u7684\u533a\u57df\u8bbe\u7f6e\u3002\u5982\u679c\u6709\u590d\u6742\u9700\u6c42\u6216\u8005\u6307\u5b9a\u4e86\u591a\u4e2a\u9009\u9879\uff0c\u5efa\u8bae\u68c0\u67e5\u7ed3\u679c\u662f\u5426\u7b26\u5408\u9884\u671f\u3002</p>\n<p lang=\"zh\">\u6709\u5173\u533a\u57df\u8bbe\u7f6e\u7684\u66f4\u591a\u7ec6\u8282\u89c1<a class=\"xref\" href=\"/docs/16/locale.html\" title=\"24.1.\u00a0\u533a\u57df\u8bbe\u7f6e\u652f\u6301\">\u7b2c\u00a024.1\u00a0\u8282</a>\u3002</p>\n<p lang=\"zh\">\u8981\u4fee\u6539\u9ed8\u8ba4\u7f16\u7801\uff0c\u8bf7\u4f7f\u7528<code class=\"option\">--encoding</code>\u3002\u66f4\u591a\u7ec6\u8282\u89c1<a class=\"xref\" href=\"/docs/16/multibyte.html\" title=\"24.3.\u00a0\u5b57\u7b26\u96c6\u652f\u6301\">\u7b2c\u00a024.3\u00a0\u8282</a>\u3002</p>\n</div>\n<div class=\"refsect1\" id=\"id-1.9.5.3.6\">\n<h2 lang=\"zh\">\u9009\u9879</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 lang=\"zh\">\u8be5\u9009\u9879\u6307\u5b9a<code class=\"filename\">pg_hba.conf</code>\u4e2d\u672c\u5730\u7528\u6237\u9ed8\u8ba4\u4f7f\u7528\u7684\u8ba4\u8bc1\u65b9\u6cd5\uff08<code class=\"literal\">host</code> \u548c <code class=\"literal\">local</code> \u884c\uff09\u3002\u6709\u6548\u503c\u6982\u89c8\u89c1<a class=\"xref\" href=\"/docs/16/auth-pg-hba-conf.html\" title=\"21.1.\u00a0pg_hba.conf \u6587\u4ef6\">\u7b2c\u00a021.1\u00a0\u8282</a>\u3002</p>\n<p lang=\"zh\"><code class=\"command\">initdb</code>\u4f1a\u4f7f\u7528\u6307\u5b9a\u7684\u8ba4\u8bc1\u65b9\u6cd5\u9884\u586b\u5145<code class=\"filename\">pg_hba.conf</code> \u6761\u76ee\uff0c\u65e2\u7528\u4e8e\u975e\u590d\u5236\u8fde\u63a5\uff0c\u4e5f\u7528\u4e8e\u590d\u5236\u8fde\u63a5\u3002</p>\n<p lang=\"zh\">\u9664\u975e\u4fe1\u4efb\u7cfb\u7edf\u4e0a\u7684\u6240\u6709\u672c\u5730\u7528\u6237\uff0c\u5426\u5219\u4e0d\u8981\u4f7f\u7528<code class=\"literal\">trust</code>\u3002\u4e3a\u4e86\u4fbf\u4e8e\u5b89\u88c5\uff0c\u9ed8\u8ba4\u4f7f\u7528<code class=\"literal\">trust</code>\u3002</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 lang=\"zh\">\n<p>\u8be5\u9009\u9879\u6307\u5b9a<code class=\"filename\">pg_hba.conf</code>\u4e2d\u672c\u5730\u7528\u6237\u901a\u8fc7 TCP/IP \u8fde\u63a5\u65f6\uff08<code class=\"literal\">host</code> \u884c\uff09\u4f7f\u7528\u7684\u8ba4\u8bc1\u65b9\u6cd5\u3002</p>\n</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 lang=\"zh\">\n<p>\u8be5\u9009\u9879\u6307\u5b9a<code class=\"filename\">pg_hba.conf</code>\u4e2d\u672c\u5730\u7528\u6237\u901a\u8fc7 Unix \u57df\u5957\u63a5\u5b57\u8fde\u63a5\u65f6\uff08<code class=\"literal\">local</code> \u884c\uff09\u4f7f\u7528\u7684\u8ba4\u8bc1\u65b9\u6cd5\u3002</p>\n</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 lang=\"zh\">\n<p>\u8be5\u9009\u9879\u6307\u5b9a\u6570\u636e\u5e93\u96c6\u7c07\u5e94\u5b58\u653e\u7684\u76ee\u5f55\u3002\u8fd9\u662f<code class=\"command\">initdb</code>\u6240\u9700\u7684\u552f\u4e00\u4fe1\u606f\uff0c\u4f46\u4e5f\u53ef\u4ee5\u901a\u8fc7\u8bbe\u7f6e<code class=\"envar\">PGDATA</code>\u73af\u5883\u53d8\u91cf\u6765\u7701\u53bb\u663e\u5f0f\u5199\u51fa\u5b83\uff1b\u8fd9\u901a\u5e38\u66f4\u65b9\u4fbf\uff0c\u56e0\u4e3a\u6570\u636e\u5e93\u670d\u52a1\u5668\uff08<code class=\"command\">postgres</code>\uff09\u4e4b\u540e\u4e5f\u53ef\u4ee5\u901a\u8fc7\u540c\u4e00\u53d8\u91cf\u627e\u5230\u6570\u636e\u76ee\u5f55\u3002</p>\n</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 lang=\"zh\">\u9009\u62e9\u6a21\u677f\u6570\u636e\u5e93\u7684\u7f16\u7801\u3002\u8fd9\u4e5f\u5c06\u6210\u4e3a\u4ee5\u540e\u521b\u5efa\u7684\u4efb\u4f55\u6570\u636e\u5e93\u7684\u9ed8\u8ba4\u7f16\u7801\uff0c\u9664\u975e\u5728\u521b\u5efa\u65f6\u8986\u76d6\u5b83\u3002<span class=\"productname\">PostgreSQL</span>\u670d\u52a1\u5668\u652f\u6301\u7684\u5b57\u7b26\u96c6\u89c1<a class=\"xref\" href=\"/docs/16/multibyte.html#MULTIBYTE-CHARSET-SUPPORTED\" title=\"24.3.1.\u00a0\u652f\u6301\u7684\u5b57\u7b26\u96c6\">\u7b2c\u00a024.3.1\u00a0\u8282</a>\u3002</p>\n<p lang=\"zh\">\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c\u6a21\u677f\u6570\u636e\u5e93\u7684\u7f16\u7801\u7531\u533a\u57df\u8bbe\u7f6e\u51b3\u5b9a\u3002\u5982\u679c\u6307\u5b9a --no-locale\uff08\u6216\u7b49\u4ef7\u5730\u5c06\u533a\u57df\u8bbe\u7f6e\u8bbe\u4e3a C \u6216 POSIX\uff09\uff0c\u5219 ICU \u63d0\u4f9b\u8005\u7684\u9ed8\u8ba4\u7f16\u7801\u4e3a UTF8\uff0clibc \u63d0\u4f9b\u8005\u7684\u9ed8\u8ba4\u7f16\u7801\u4e3a SQL_ASCII\u3002</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 lang=\"zh\">\u5141\u8bb8\u4e0e\u96c6\u7fa4\u6240\u6709\u8005\u540c\u7ec4\u7684\u7528\u6237\u8bfb\u53d6 initdb \u521b\u5efa\u7684\u6240\u6709\u96c6\u7fa4\u6587\u4ef6\u3002Windows \u4e0d\u652f\u6301 POSIX \u98ce\u683c\u7684\u7ec4\u6743\u9650\uff0c\u56e0\u6b64\u4f1a\u5ffd\u7565\u6b64\u9009\u9879\u3002</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 lang=\"zh\">\n<p>\u5f53\u4f7f\u7528 ICU \u63d0\u4f9b\u7a0b\u5e8f\u65f6\uff0c\u6307\u5b9a ICU \u533a\u57df\u8bbe\u7f6e\u3002\u533a\u57df\u8bbe\u7f6e\u652f\u6301\u89c1<a class=\"xref\" href=\"/docs/16/locale.html\" title=\"24.1.\u00a0\u533a\u57df\u8bbe\u7f6e\u652f\u6301\">\u7b2c\u00a024.1\u00a0\u8282</a>\u3002</p>\n</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 lang=\"zh\">\n<p>\u6307\u5b9a\u9644\u52a0\u7684\u6392\u5e8f\u89c4\u5219\uff0c\u4ee5\u5b9a\u5236\u9ed8\u8ba4\u6392\u5e8f\u89c4\u5219\u7684\u884c\u4e3a\u3002\u8be5\u9009\u9879\u4ec5\u652f\u6301 ICU\u3002</p>\n</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 lang=\"zh\">\n<p>\u5728\u6570\u636e\u9875\u4e0a\u4f7f\u7528\u6821\u9a8c\u548c\uff0c\u5e2e\u52a9\u68c0\u6d4b I/O \u7cfb\u7edf\u9020\u6210\u7684\u3001\u5426\u5219\u53ef\u80fd\u6084\u65e0\u58f0\u606f\u7684\u6570\u636e\u635f\u574f\u3002\u542f\u7528\u6821\u9a8c\u548c\u53ef\u80fd\u4f1a\u5e26\u6765\u660e\u663e\u7684\u6027\u80fd\u635f\u5931\u3002\u5982\u679c\u542f\u7528\uff0c\u5c31\u4f1a\u4e3a\u6240\u6709\u6570\u636e\u5e93\u4e2d\u7684\u6240\u6709\u5bf9\u8c61\u8ba1\u7b97\u6821\u9a8c\u548c\u3002\u6240\u6709\u6821\u9a8c\u548c\u5931\u8d25\u90fd\u4f1a\u5728 <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>\u89c6\u56fe\u4e2d\u62a5\u544a\u3002\u8be6\u89c1<a class=\"xref\" href=\"/docs/16/checksums.html\" title=\"30.2.\u00a0\u6570\u636e\u6821\u9a8c\u548c\">\u7b2c\u00a030.2\u00a0\u8282</a>\u3002</p>\n</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 lang=\"zh\">\n<p>\u8bbe\u7f6e\u6570\u636e\u5e93\u96c6\u7c07\u7684\u9ed8\u8ba4\u533a\u57df\u8bbe\u7f6e\u3002\u5982\u679c\u672a\u6307\u5b9a\u8be5\u9009\u9879\uff0c\u533a\u57df\u8bbe\u7f6e\u5c06\u7ee7\u627f\u81ea <code class=\"command\">initdb</code>\u8fd0\u884c\u65f6\u6240\u5728\u7684\u73af\u5883\u3002\u533a\u57df\u8bbe\u7f6e\u652f\u6301\u89c1<a class=\"xref\" href=\"/docs/16/locale.html\" title=\"24.1.\u00a0\u533a\u57df\u8bbe\u7f6e\u652f\u6301\">\u7b2c\u00a024.1\u00a0\u8282</a>\u3002</p>\n</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 lang=\"zh\">\n<p>\u7c7b\u4f3c\u4e8e<code class=\"option\">--locale</code>\uff0c\u4f46\u53ea\u5728\u6307\u5b9a\u7684\u7c7b\u522b\u4e2d\u8bbe\u7f6e\u533a\u57df\u8bbe\u7f6e\u3002</p>\n</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 lang=\"zh\">\n<p>\u7b49\u4ef7\u4e8e<code class=\"option\">--locale=C</code>\u3002</p>\n</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 lang=\"zh\">\n<p>\u8be5\u9009\u9879\u8bbe\u7f6e\u65b0\u96c6\u7c07\u4e2d\u521b\u5efa\u7684\u6570\u636e\u5e93\u6240\u4f7f\u7528\u7684\u533a\u57df\u8bbe\u7f6e\u63d0\u4f9b\u7a0b\u5e8f\u3002\u540e\u7eed\u521b\u5efa\u65b0\u6570\u636e\u5e93\u65f6\uff0c\u53ef\u4ee5\u5728<code class=\"command\">CREATE DATABASE</code>\u547d\u4ee4\u4e2d\u8986\u76d6\u5b83\u3002\u9ed8\u8ba4\u503c\u4e3a <code class=\"literal\">libc</code>\uff08\u89c1<a class=\"xref\" href=\"/docs/16/locale.html#LOCALE-PROVIDERS\" title=\"24.1.4.\u00a0\u533a\u57df\u8bbe\u7f6e\u63d0\u4f9b\u7a0b\u5e8f\">\u7b2c\u00a024.1.4\u00a0\u8282</a>\uff09\u3002</p>\n</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 lang=\"zh\">\n<p>\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c<code class=\"command\">initdb</code>\u4f1a\u7b49\u5f85\u6240\u6709\u6587\u4ef6\u90fd\u5b89\u5168\u5199\u5165\u78c1\u76d8\u3002\u8be5\u9009\u9879\u4f7f <code class=\"command\">initdb</code>\u5728\u4e0d\u7b49\u5f85\u7684\u60c5\u51b5\u4e0b\u8fd4\u56de\uff0c\u901f\u5ea6\u66f4\u5feb\uff0c\u4f46\u8fd9\u610f\u5473\u7740\u5982\u679c\u540e\u7eed\u64cd\u4f5c\u7cfb\u7edf\u5d29\u6e83\uff0c\u6570\u636e\u76ee\u5f55\u53ef\u80fd\u4f1a\u635f\u574f\u3002\u901a\u5e38\uff0c\u8be5\u9009\u9879\u9002\u7528\u4e8e\u6d4b\u8bd5\uff0c\u4f46\u4e0d\u5e94\u7528\u4e8e\u521b\u5efa\u751f\u4ea7\u73af\u5883\u5b89\u88c5\u3002</p>\n</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 lang=\"zh\">\n<p>\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c<code class=\"command\">initdb</code>\u4f1a\u5728\u5176\u8f93\u51fa\u672b\u5c3e\u5199\u51fa\u5982\u4f55\u542f\u52a8\u96c6\u7c07\u7684\u8bf4\u660e\u3002\u8be5\u9009\u9879\u4f1a\u7701\u7565\u8fd9\u4e9b\u8bf4\u660e\u3002\u5b83\u4e3b\u8981\u4f9b\u90a3\u4e9b\u5bf9<code class=\"command\">initdb</code>\u8fdb\u884c\u5e73\u53f0\u7279\u5b9a\u5c01\u88c5\u7684\u5de5\u5177\u4f7f\u7528\uff0c\u56e0\u4e3a\u5728\u8fd9\u79cd\u60c5\u51b5\u4e0b\u90a3\u4e9b\u8bf4\u660e\u5f88\u53ef\u80fd\u5e76\u4e0d\u6b63\u786e\u3002</p>\n</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 lang=\"zh\">\n<p>\u4f7f<code class=\"command\">initdb</code>\u4ece\u6587\u4ef6\u4e2d\u8bfb\u53d6\u5f15\u5bfc\u8d85\u7ea7\u7528\u6237\u7684\u5bc6\u7801\u3002\u6587\u4ef6\u7684\u7b2c\u4e00\u884c\u4f1a\u88ab\u5f53\u4f5c\u5bc6\u7801\u3002</p>\n</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 lang=\"zh\">\n<p>\u5c06\u6240\u6709\u6570\u636e\u5e93\u6587\u4ef6\u5b89\u5168\u5730\u5199\u5165\u78c1\u76d8\u5e76\u9000\u51fa\u3002\u8fd9\u4e0d\u4f1a\u6267\u884c\u4efb\u4f55\u5e38\u89c4\u7684 <span class=\"application\">initdb</span>\u64cd\u4f5c\u3002\u901a\u5e38\uff0c\u8be5\u9009\u9879\u53ef\u7528\u4e8e\u5728\u5c06<a class=\"xref\" href=\"/docs/16/runtime-config-wal.html#GUC-FSYNC\">fsync</a>\u4ece<code class=\"literal\">off</code>\u6539\u4e3a<code class=\"literal\">on</code>\u540e\uff0c\u786e\u4fdd\u80fd\u591f\u53ef\u9760\u6062\u590d\u3002</p>\n</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 lang=\"zh\">\n<p>\u8bbe\u7f6e\u9ed8\u8ba4\u6587\u672c\u68c0\u7d22\u914d\u7f6e\u3002\u66f4\u591a\u4fe1\u606f\u89c1<a class=\"xref\" href=\"/docs/16/runtime-config-client.html#GUC-DEFAULT-TEXT-SEARCH-CONFIG\">default_text_search_config</a>\u3002</p>\n</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 lang=\"zh\">\n<p>\u8bbe\u7f6e<a class=\"glossterm\" href=\"/docs/16/glossary.html#GLOSSARY-BOOTSTRAP-SUPERUSER\"></a><a class=\"glossterm\" href=\"/docs/16/glossary.html#GLOSSARY-BOOTSTRAP-SUPERUSER\" title=\"\u5f15\u5bfc\u8d85\u7ea7\u7528\u6237\">\u5f15\u5bfc\u8d85\u7ea7\u7528\u6237</a>\u7684\u7528\u6237\u540d\u3002\u9ed8\u8ba4\u503c\u662f\u8fd0\u884c<code class=\"command\">initdb</code>\u7684\u64cd\u4f5c\u7cfb\u7edf\u7528\u6237\u540d\u3002</p>\n</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 lang=\"zh\">\n<p>\u4f7f<code class=\"command\">initdb</code>\u63d0\u793a\u8f93\u5165\u8981\u8d4b\u7ed9\u5f15\u5bfc\u8d85\u7ea7\u7528\u6237\u7684\u5bc6\u7801\u3002\u5982\u679c\u4e0d\u6253\u7b97\u4f7f\u7528\u5bc6\u7801\u8ba4\u8bc1\uff0c\u8fd9\u4e00\u70b9\u5e76\u4e0d\u91cd\u8981\u3002\u5426\u5219\uff0c\u5728\u8bbe\u7f6e\u5bc6\u7801\u4e4b\u524d\u5c06\u65e0\u6cd5\u4f7f\u7528\u5bc6\u7801\u8ba4\u8bc1\u3002</p>\n</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 lang=\"zh\">\n<p>\u8be5\u9009\u9879\u6307\u5b9a\u9884\u5199\u5f0f\u65e5\u5fd7\uff08WAL\uff09\u5e94\u5b58\u653e\u7684\u76ee\u5f55\u3002</p>\n</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 lang=\"zh\">\u8bbe\u7f6e WAL \u6bb5\u5927\u5c0f\uff0c\u5355\u4f4d\u4e3a\u5146\u5b57\u8282\u3002\u8fd9\u662f WAL \u65e5\u5fd7\u4e2d\u6bcf\u4e2a\u72ec\u7acb\u6587\u4ef6\u7684\u5927\u5c0f\u3002\u9ed8\u8ba4\u5927\u5c0f\u4e3a 16 \u5146\u5b57\u8282\u3002\u53d6\u503c\u5fc5\u987b\u662f 1 \u5230 1024\uff08\u5146\u5b57\u8282\uff09\u4e4b\u95f4\u7684 2 \u7684\u5e42\u3002\u6b64\u9009\u9879\u53ea\u80fd\u5728\u521d\u59cb\u5316\u65f6\u8bbe\u7f6e\uff0c\u4e4b\u540e\u65e0\u6cd5\u66f4\u6539\u3002</p>\n<p lang=\"zh\">\u8c03\u6574\u8be5\u5927\u5c0f\u53ef\u80fd\u6709\u52a9\u4e8e\u63a7\u5236 WAL \u65e5\u5fd7\u4f20\u9001\u6216\u5f52\u6863\u7684\u7c92\u5ea6\u3002\u6b64\u5916\uff0c\u5728 WAL \u91cf\u5f88\u5927\u7684\u6570\u636e\u5e93\u4e2d\uff0c\u6bcf\u4e2a\u76ee\u5f55\u4e2d\u7684 WAL \u6587\u4ef6\u6570\u91cf\u53ef\u80fd\u4f1a\u6210\u4e3a\u6027\u80fd\u548c\u7ba1\u7406\u95ee\u9898\u3002\u589e\u5927 WAL \u6587\u4ef6\u5927\u5c0f\u4f1a\u51cf\u5c11 WAL \u6587\u4ef6\u6570\u91cf\u3002</p>\n</dd>\n</dl>\n</div>\n<p lang=\"zh\">\u8fd8\u63d0\u4f9b\u4e86\u5176\u4ed6\u4e00\u4e9b\u8f83\u5c11\u4f7f\u7528\u7684\u9009\u9879\uff1a</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 lang=\"zh\">\u5728 initdb \u671f\u95f4\u5f3a\u5236\u5c06\u670d\u52a1\u5668\u53c2\u6570 name \u8bbe\u4e3a value\uff0c\u5e76\u628a\u8be5\u8bbe\u7f6e\u5199\u5165\u751f\u6210\u7684 postgresql.conf \u6587\u4ef6\uff0c\u4f7f\u5176\u5728\u4e4b\u540e\u7684\u670d\u52a1\u5668\u8fd0\u884c\u4e2d\u4e5f\u751f\u6548\u3002\u6b64\u9009\u9879\u53ef\u591a\u6b21\u4f7f\u7528\uff0c\u4ee5\u8bbe\u7f6e\u591a\u4e2a\u53c2\u6570\u3002\u5b83\u4e3b\u8981\u7528\u4e8e\u73af\u5883\u6761\u4ef6\u5bfc\u81f4\u670d\u52a1\u5668\u5b8c\u5168\u65e0\u6cd5\u4f7f\u7528\u9ed8\u8ba4\u53c2\u6570\u542f\u52a8\u7684\u60c5\u51b5\u3002</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 lang=\"zh\">\n<p>\u6253\u5370\u5f15\u5bfc\u540e\u7aef\u7684\u8c03\u8bd5\u8f93\u51fa\uff0c\u4ee5\u53ca\u5c11\u91cf\u666e\u901a\u7528\u6237\u901a\u5e38\u4e0d\u611f\u5174\u8da3\u7684\u5176\u4ed6\u6d88\u606f\u3002\u5f15\u5bfc\u540e\u7aef\u662f <code class=\"command\">initdb</code>\u7528\u6765\u521b\u5efa\u7cfb\u7edf\u76ee\u5f55\u8868\u7684\u7a0b\u5e8f\u3002\u8be5\u9009\u9879\u4f1a\u4ea7\u751f\u5927\u91cf\u6781\u5176\u4e4f\u5473\u7684\u8f93\u51fa\u3002</p>\n</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 lang=\"zh\">\n<p>\u4f7f\u7528<code class=\"literal\">debug_discard_caches=1</code>\u9009\u9879\u8fd0\u884c\u5f15\u5bfc\u540e\u7aef\u3002\u8fd9\u4f1a\u82b1\u8d39\u5f88\u957f\u65f6\u95f4\uff0c\u53ea\u5bf9\u6df1\u5ea6\u8c03\u8bd5\u6709\u7528\u3002</p>\n</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 lang=\"zh\">\n<p>\u6307\u5b9a<code class=\"command\">initdb</code>\u521d\u59cb\u5316\u6570\u636e\u5e93\u96c6\u7c07\u65f6\u5e94\u5230\u54ea\u91cc\u67e5\u627e\u5176\u8f93\u5165\u6587\u4ef6\u3002\u901a\u5e38\u4e0d\u9700\u8981\u8fd9\u6837\u505a\u3002\u82e5\u9700\u8981\u663e\u5f0f\u6307\u5b9a\u5176\u4f4d\u7f6e\uff0c\u7cfb\u7edf\u4f1a\u63d0\u793a\u3002</p>\n</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 lang=\"zh\">\n<p>\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c\u5982\u679c<code class=\"command\">initdb</code>\u53d1\u73b0\u67d0\u4e2a\u9519\u8bef\u4f7f\u5176\u65e0\u6cd5\u5b8c\u6574\u521b\u5efa\u6570\u636e\u5e93\u96c6\u7c07\uff0c\u5c31\u4f1a\u5220\u9664\u5b83\u5728\u53d1\u73b0\u65e0\u6cd5\u5b8c\u6210\u4efb\u52a1\u4e4b\u524d\u53ef\u80fd\u5df2\u521b\u5efa\u7684\u6240\u6709\u6587\u4ef6\u3002\u8be5\u9009\u9879\u4f1a\u7981\u6b62\u8fd9\u79cd\u6e05\u7406\uff0c\u56e0\u6b64\u5bf9\u8c03\u8bd5\u6709\u7528\u3002</p>\n</p>\n</dd>\n</dl>\n</div>\n<p lang=\"zh\">\u5176\u4ed6\u9009\u9879\uff1a</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 lang=\"zh\">\n<p>\u6253\u5370<span class=\"application\">initdb</span>\u7248\u672c\u5e76\u9000\u51fa\u3002</p>\n</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 lang=\"zh\">\n<p>\u663e\u793a\u6709\u5173<span class=\"application\">initdb</span>\u547d\u4ee4\u884c\u53c2\u6570\u7684\u5e2e\u52a9\u5e76\u9000\u51fa\u3002</p>\n</p>\n</dd>\n</dl>\n</div>\n</div>\n<div class=\"refsect1\" id=\"id-1.9.5.3.7\">\n<h2 lang=\"zh\">\u73af\u5883</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 lang=\"zh\">\n<p>\u6307\u5b9a\u6570\u636e\u5e93\u96c6\u7c07\u5e94\u5b58\u653e\u7684\u76ee\u5f55\uff1b\u53ef\u4f7f\u7528<code class=\"option\">-D</code>\u9009\u9879\u8986\u76d6\u3002</p>\n</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 lang=\"zh\">\n<p>\u6307\u5b9a\u8bca\u65ad\u6d88\u606f\u662f\u5426\u4f7f\u7528\u989c\u8272\u3002\u53ef\u9009\u503c\u4e3a <code class=\"literal\">always</code>\u3001<code class=\"literal\">auto</code>\u548c <code class=\"literal\">never</code>\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-INITDB-ENVIRONMENT-TZ\"><span class=\"term\"><code class=\"envar\">TZ</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6307\u5b9a\u6240\u521b\u5efa\u6570\u636e\u5e93\u96c6\u7c07\u7684\u9ed8\u8ba4\u65f6\u533a\u3002\u8be5\u503c\u5e94\u4e3a\u5b8c\u6574\u7684\u65f6\u533a\u540d\u79f0\uff08\u89c1<a class=\"xref\" href=\"/docs/16/datatype-datetime.html#DATATYPE-TIMEZONES\" title=\"8.5.3.\u00a0\u65f6\u533a\">\u7b2c\u00a08.5.3\u00a0\u8282</a>\uff09\u3002</p>\n</p>\n</dd>\n</dl>\n</div>\n</div>\n<div class=\"refsect1\" id=\"id-1.9.5.3.8\">\n<h2 lang=\"zh\">\u6ce8\u89e3</h2>\n<p lang=\"zh\">\u4e5f\u53ef\u4ee5\u901a\u8fc7 pg_ctl initdb \u8c03\u7528 initdb\u3002</p>\n</div>\n<div class=\"refsect1\" id=\"id-1.9.5.3.9\">\n<h2 lang=\"zh\">\u53e6\u89c1</h2><span class=\"simplelist\"><a class=\"xref\" href=\"https://pg.center/docs/16/app-pg-ctl.html\" title=\"pg_ctl\"><span class=\"refentrytitle\"><span class=\"application\">pg_ctl</span></span></a>, <a class=\"xref\" href=\"https://pg.center/docs/16/app-postgres.html\" title=\"postgres\"><span class=\"refentrytitle\"><span class=\"application\">postgres</span></span></a>, <a class=\"xref\" href=\"https://pg.center/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", "localization": {"status": "complete", "sources": [{"url": "/docs/16/app-initdb.html", "method": "same-major semantic node", "sha256": "050203e8f5a8d6b5531ba2e5e6d6668b322087706c7596d76499420a605ef47e", "language": "zh", "matched_nodes": ["#APP-INITDB/div[2]/p[1]", "#APP-INITDB/div[3]/h2[0]", "#APP-INITDB/div[4]/p[10]", "#APP-INITDB/div[4]/p[11]", "#APP-INITDB/div[4]/p[12]", "#APP-INITDB/div[4]/p[1]", "#APP-INITDB/div[4]/p[2]", "#APP-INITDB/div[4]/p[3]", "#APP-INITDB/div[4]/p[4]", "#APP-INITDB/div[4]/p[5]", "#APP-INITDB/div[4]/p[6]", "#APP-INITDB/div[4]/p[7]", "#APP-INITDB/div[4]/p[8]", "#APP-INITDB/div[5]/div[1]/dl[0]/dd[11]", "#APP-INITDB/div[5]/div[1]/dl[0]/dd[13]", "#APP-INITDB/div[5]/div[1]/dl[0]/dd[15]", "#APP-INITDB/div[5]/div[1]/dl[0]/dd[17]", "#APP-INITDB/div[5]/div[1]/dl[0]/dd[19]", "#APP-INITDB/div[5]/div[1]/dl[0]/dd[1]/p[0]", "#APP-INITDB/div[5]/div[1]/dl[0]/dd[1]/p[1]", "#APP-INITDB/div[5]/div[1]/dl[0]/dd[1]/p[2]", "#APP-INITDB/div[5]/div[1]/dl[0]/dd[21]", "#APP-INITDB/div[5]/div[1]/dl[0]/dd[23]", "#APP-INITDB/div[5]/div[1]/dl[0]/dd[25]", "#APP-INITDB/div[5]/div[1]/dl[0]/dd[27]", "#APP-INITDB/div[5]/div[1]/dl[0]/dd[29]", "#APP-INITDB/div[5]/div[1]/dl[0]/dd[31]", "#APP-INITDB/div[5]/div[1]/dl[0]/dd[33]", "#APP-INITDB/div[5]/div[1]/dl[0]/dd[35]", "#APP-INITDB/div[5]/div[1]/dl[0]/dd[37]", "#APP-INITDB/div[5]/div[1]/dl[0]/dd[39]", "#APP-INITDB/div[5]/div[1]/dl[0]/dd[3]", "#APP-INITDB/div[5]/div[1]/dl[0]/dd[41]", "#APP-INITDB/div[5]/div[1]/dl[0]/dd[43]/p[1]", "#APP-INITDB/div[5]/div[1]/dl[0]/dd[5]", "#APP-INITDB/div[5]/div[1]/dl[0]/dd[7]", "#APP-INITDB/div[5]/div[1]/dl[0]/dd[9]/p[0]", "#APP-INITDB/div[5]/div[3]/dl[0]/dd[3]", "#APP-INITDB/div[5]/div[3]/dl[0]/dd[5]", "#APP-INITDB/div[5]/div[3]/dl[0]/dd[7]", "#APP-INITDB/div[5]/div[3]/dl[0]/dd[9]", "#APP-INITDB/div[5]/div[5]/dl[0]/dd[1]", "#APP-INITDB/div[5]/div[5]/dl[0]/dd[3]", "#APP-INITDB/div[5]/p[2]", "#APP-INITDB/div[5]/p[4]", "#APP-INITDB/div[6]/div[1]/dl[0]/dd[1]", "#APP-INITDB/div[6]/div[1]/dl[0]/dd[3]", "#APP-INITDB/div[6]/div[1]/dl[0]/dd[5]", "#APP-INITDB/div[6]/h2[0]", "#APP-INITDB/div[7]/h2[0]", "#APP-INITDB/div[8]/h2[0]"]}], "language": "zh", "original_text": {"/versions/16/description/0": "initdb \u2014 create a new PostgreSQL database cluster", "/versions/16/facts/0/label": "Documented executable", "/versions/16/facts/1/label": "Executable version", "/versions/16/facts/2/label": "Reference inventory", "/versions/16/facts/2/value": "Server applications", "/versions/16/facts/3/label": "Option definition groups", "/versions/16/tables/0/title": "Documented options", "/versions/16/tables/1/title": "Environment variables", "/versions/16/tables/0/rows/0/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.", "/versions/16/tables/0/rows/1/summary": "This option specifies the authentication method for local users via TCP/IP connections used in pg_hba.conf ( host lines).", "/versions/16/tables/0/rows/2/summary": "This option specifies the authentication method for local users via Unix-domain socket connections used in pg_hba.conf ( local lines).", "/versions/16/tables/0/rows/3/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.", "/versions/16/tables/0/rows/4/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 .", "/versions/16/tables/0/rows/5/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.", "/versions/16/tables/0/rows/6/summary": "Specifies the ICU locale when the ICU provider is used. Locale support is described in Section 24.1 .", "/versions/16/tables/0/rows/7/summary": "Specifies additional collation rules to customize the behavior of the default collation. This is supported for ICU only.", "/versions/16/tables/0/rows/8/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.", "/versions/16/tables/0/rows/9/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 .", "/versions/16/tables/0/columns/0/label": "Option and arguments", "/versions/16/tables/0/columns/1/label": "Description", "/versions/16/tables/0/rows/10/summary": "Like --locale , but only sets the locale in the specified category.", "/versions/16/tables/0/rows/11/summary": "Equivalent to --locale=C .", "/versions/16/tables/0/rows/12/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 ).", "/versions/16/tables/0/rows/13/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.", "/versions/16/tables/0/rows/14/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.", "/versions/16/tables/0/rows/15/summary": "Makes initdb read the bootstrap superuser's password from a file. The first line of the file is taken as the password.", "/versions/16/tables/0/rows/16/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 .", "/versions/16/tables/0/rows/17/summary": "Sets the default text search configuration. See default_text_search_config for further information.", "/versions/16/tables/0/rows/18/summary": "Sets the user name of the bootstrap superuser . This defaults to the name of the operating-system user running initdb .", "/versions/16/tables/0/rows/19/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.", "/versions/16/tables/0/rows/20/summary": "This option specifies the directory where the write-ahead log should be stored.", "/versions/16/tables/0/rows/21/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.", "/versions/16/tables/0/rows/22/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.", "/versions/16/tables/0/rows/23/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.", "/versions/16/tables/0/rows/24/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.", "/versions/16/tables/0/rows/25/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.", "/versions/16/tables/0/rows/26/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.", "/versions/16/tables/0/rows/27/summary": "Print the initdb version and exit.", "/versions/16/tables/0/rows/28/summary": "Show help about initdb command line arguments, and exit.", "/versions/16/tables/1/columns/0/label": "Variable", "/versions/16/tables/1/columns/1/label": "Meaning", "/versions/16/tables/1/rows/0/description": "Specifies the directory where the database cluster is to be stored; can be overridden using the -D option.", "/versions/16/tables/1/rows/1/description": "Specifies whether to use color in diagnostic messages. Possible values are always , auto and never .", "/versions/16/tables/1/rows/2/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 )."}, "fallback_fields": [], "source_language": "en", "original_snapshot_sha256": "1f34eaa7ff969284bff5cd3301bb2264d215ce39403b04234b08a64441565241"}, "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", "manual_language": "zh"}, "17": {"facts": [{"label": "\u624b\u518c\u4e2d\u7684\u53ef\u6267\u884c\u7a0b\u5e8f", "value": "initdb"}, {"label": "\u7a0b\u5e8f\u7248\u672c", "value": "17.11"}, {"label": "\u53c2\u8003\u6e05\u5355", "value": "\u670d\u52a1\u7aef\u7a0b\u5e8f"}, {"label": "\u9009\u9879\u5b9a\u4e49\u7ec4", "value": "32"}], "tables": [{"key": "options", "rows": [{"summary": "\u8be5\u9009\u9879\u6307\u5b9a pg_hba.conf \u4e2d\u672c\u5730\u7528\u6237\u9ed8\u8ba4\u4f7f\u7528\u7684\u8ba4\u8bc1\u65b9\u6cd5\uff08 host \u548c local \u884c\uff09\u3002\u6709\u6548\u503c\u6982\u89c8\u89c1 \u7b2c 20.1 \u8282 \u3002", "signature": {"url": "/docs/17/app-initdb.html#APP-INITDB-OPTION-AUTH", "text": "-A authmethod --auth= authmethod"}}, {"summary": "\u8be5\u9009\u9879\u6307\u5b9a pg_hba.conf \u4e2d\u672c\u5730\u7528\u6237\u901a\u8fc7 TCP/IP \u8fde\u63a5\u65f6\uff08 host \u884c\uff09\u4f7f\u7528\u7684\u8ba4\u8bc1\u65b9\u6cd5\u3002", "signature": {"url": "/docs/17/app-initdb.html#APP-INITDB-OPTION-AUTH-HOST", "text": "--auth-host= authmethod"}}, {"summary": "\u8be5\u9009\u9879\u6307\u5b9a pg_hba.conf \u4e2d\u672c\u5730\u7528\u6237\u901a\u8fc7 Unix \u57df\u5957\u63a5\u5b57\u8fde\u63a5\u65f6\uff08 local \u884c\uff09\u4f7f\u7528\u7684\u8ba4\u8bc1\u65b9\u6cd5\u3002", "signature": {"url": "/docs/17/app-initdb.html#APP-INITDB-OPTION-AUTH-LOCAL", "text": "--auth-local= authmethod"}}, {"summary": "\u8be5\u9009\u9879\u6307\u5b9a\u6570\u636e\u5e93\u96c6\u7c07\u5e94\u5b58\u653e\u7684\u76ee\u5f55\u3002\u8fd9\u662f initdb \u6240\u9700\u7684\u552f\u4e00\u4fe1\u606f\uff0c\u4f46\u4e5f\u53ef\u4ee5\u901a\u8fc7\u8bbe\u7f6e PGDATA \u73af\u5883\u53d8\u91cf\u6765\u7701\u53bb\u663e\u5f0f\u5199\u51fa\u5b83\uff1b\u8fd9\u901a\u5e38\u66f4\u65b9\u4fbf\uff0c\u56e0\u4e3a\u6570\u636e\u5e93\u670d\u52a1\u5668\uff08 postgres \uff09\u4e4b\u540e\u4e5f\u53ef\u4ee5\u901a\u8fc7\u540c\u4e00\u53d8\u91cf\u627e\u5230\u6570\u636e\u76ee\u5f55\u3002", "signature": {"url": "/docs/17/app-initdb.html#APP-INITDB-OPTION-PGDATA", "text": "-D directory --pgdata= directory"}}, {"summary": "\u9009\u62e9\u6a21\u677f\u6570\u636e\u5e93\u7684\u7f16\u7801\u3002\u8fd9\u4e5f\u5c06\u6210\u4e3a\u4ee5\u540e\u521b\u5efa\u7684\u4efb\u4f55\u6570\u636e\u5e93\u7684\u9ed8\u8ba4\u7f16\u7801\uff0c\u9664\u975e\u5728\u521b\u5efa\u65f6\u8986\u76d6\u5b83\u3002 PostgreSQL \u670d\u52a1\u5668\u652f\u6301\u7684\u5b57\u7b26\u96c6\u89c1 \u7b2c 23.3.1 \u8282 \u3002", "signature": {"url": "/docs/17/app-initdb.html#APP-INITDB-OPTION-ENCODING", "text": "-E encoding --encoding= encoding"}}, {"summary": "\u5141\u8bb8\u4e0e\u96c6\u7c07\u62e5\u6709\u8005\u540c\u7ec4\u7684\u7528\u6237\u8bfb\u53d6\u7531 initdb \u521b\u5efa\u7684\u6240\u6709\u96c6\u7c07\u6587\u4ef6\u3002\u8be5\u9009\u9879\u5728 Windows \u4e0a\u4f1a\u88ab\u5ffd\u7565\uff0c\u56e0\u4e3a\u5b83\u4e0d\u652f\u6301 POSIX \u98ce\u683c\u7684\u7ec4\u6743\u9650\u3002", "signature": {"url": "/docs/17/app-initdb.html#APP-INITDB-ALLOW-GROUP-ACCESS", "text": "-g --allow-group-access"}}, {"summary": "\u5f53\u4f7f\u7528 ICU \u63d0\u4f9b\u7a0b\u5e8f\u65f6\uff0c\u6307\u5b9a ICU \u533a\u57df\u8bbe\u7f6e\u3002\u533a\u57df\u8bbe\u7f6e\u652f\u6301\u89c1 \u7b2c 23.1 \u8282 \u3002", "signature": {"url": "/docs/17/app-initdb.html#APP-INITDB-ICU-LOCALE", "text": "--icu-locale= locale"}}, {"summary": "\u6307\u5b9a\u9644\u52a0\u7684\u6392\u5e8f\u89c4\u5219\uff0c\u4ee5\u5b9a\u5236\u9ed8\u8ba4\u6392\u5e8f\u89c4\u5219\u7684\u884c\u4e3a\u3002\u8be5\u9009\u9879\u4ec5\u652f\u6301 ICU\u3002", "signature": {"url": "/docs/17/app-initdb.html#APP-INITDB-ICU-RULES", "text": "--icu-rules= rules"}}, {"summary": "\u5728\u6570\u636e\u9875\u4e0a\u4f7f\u7528\u6821\u9a8c\u548c\uff0c\u5e2e\u52a9\u68c0\u6d4b I/O \u7cfb\u7edf\u9020\u6210\u7684\u3001\u5426\u5219\u53ef\u80fd\u6084\u65e0\u58f0\u606f\u7684\u6570\u636e\u635f\u574f\u3002\u542f\u7528\u6821\u9a8c\u548c\u53ef\u80fd\u4f1a\u5e26\u6765\u660e\u663e\u7684\u6027\u80fd\u635f\u5931\u3002\u5982\u679c\u542f\u7528\uff0c\u5c31\u4f1a\u4e3a\u6240\u6709\u6570\u636e\u5e93\u4e2d\u7684\u6240\u6709\u5bf9\u8c61\u8ba1\u7b97\u6821\u9a8c\u548c\u3002\u6240\u6709\u6821\u9a8c\u548c\u5931\u8d25\u90fd\u4f1a\u5728 pg_stat_database \u89c6\u56fe\u4e2d\u62a5\u544a\u3002\u8be6\u89c1 \u7b2c 28.2 \u8282 \u3002", "signature": {"url": "/docs/17/app-initdb.html#APP-INITDB-DATA-CHECKSUMS", "text": "-k --data-checksums"}}, {"summary": "\u8bbe\u7f6e\u6570\u636e\u5e93\u96c6\u7c07\u7684\u9ed8\u8ba4\u533a\u57df\u8bbe\u7f6e\u3002\u5982\u679c\u672a\u6307\u5b9a\u8be5\u9009\u9879\uff0c\u533a\u57df\u8bbe\u7f6e\u5c06\u7ee7\u627f\u81ea initdb \u8fd0\u884c\u65f6\u6240\u5728\u7684\u73af\u5883\u3002\u533a\u57df\u8bbe\u7f6e\u652f\u6301\u89c1 \u7b2c 23.1 \u8282 \u3002", "signature": {"url": "/docs/17/app-initdb.html#APP-INITDB-OPTION-LOCALE", "text": "--locale= locale"}}, {"summary": "\u7c7b\u4f3c\u4e8e --locale \uff0c\u4f46\u53ea\u5728\u6307\u5b9a\u7684\u7c7b\u522b\u4e2d\u8bbe\u7f6e\u533a\u57df\u8bbe\u7f6e\u3002", "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": "\u7b49\u4ef7\u4e8e --locale=C \u3002", "signature": {"url": "/docs/17/app-initdb.html#APP-INITDB-OPTION-NO-LOCALE", "text": "--no-locale"}}, {"summary": "\u5f53\u4f7f\u7528 builtin \u63d0\u4f9b\u7a0b\u5e8f\u65f6\uff0c\u6307\u5b9a\u533a\u57df\u8bbe\u7f6e\u540d\u79f0\u3002\u533a\u57df\u8bbe\u7f6e\u652f\u6301\u89c1 \u7b2c 23.1 \u8282 \u3002", "signature": {"url": "/docs/17/app-initdb.html#APP-INITDB-BUILTIN-LOCALE", "text": "--builtin-locale= locale"}}, {"summary": "\u8be5\u9009\u9879\u8bbe\u7f6e\u65b0\u96c6\u7c07\u4e2d\u521b\u5efa\u7684\u6570\u636e\u5e93\u6240\u4f7f\u7528\u7684\u533a\u57df\u8bbe\u7f6e\u63d0\u4f9b\u7a0b\u5e8f\u3002\u540e\u7eed\u521b\u5efa\u65b0\u6570\u636e\u5e93\u65f6\uff0c\u53ef\u4ee5\u5728 CREATE DATABASE \u547d\u4ee4\u4e2d\u8986\u76d6\u5b83\u3002\u9ed8\u8ba4\u503c\u4e3a libc \uff08\u89c1 \u7b2c 23.1.4 \u8282 \uff09\u3002", "signature": {"url": "/docs/17/app-initdb.html#APP-INITDB-OPTION-LOCALE-PROVIDER", "text": "--locale-provider={ builtin | libc | icu }"}}, {"summary": "\u4f7f initdb \u4ece\u6587\u4ef6\u4e2d\u8bfb\u53d6\u5f15\u5bfc\u8d85\u7ea7\u7528\u6237\u7684\u5bc6\u7801\u3002\u6587\u4ef6\u7684\u7b2c\u4e00\u884c\u4f1a\u88ab\u5f53\u4f5c\u5bc6\u7801\u3002", "signature": {"url": "/docs/17/app-initdb.html#APP-INITDB-OPTION-PWFILE", "text": "--pwfile= filename"}}, {"summary": "\u8bbe\u7f6e\u9ed8\u8ba4\u6587\u672c\u68c0\u7d22\u914d\u7f6e\u3002\u66f4\u591a\u4fe1\u606f\u89c1 default_text_search_config \u3002", "signature": {"url": "/docs/17/app-initdb.html#APP-INITDB-OPTION-TEXT-SEARCH-CONFIG", "text": "-T config --text-search-config= config"}}, {"summary": "\u8bbe\u7f6e \u5f15\u5bfc\u8d85\u7ea7\u7528\u6237 \u7684\u7528\u6237\u540d\u3002\u9ed8\u8ba4\u503c\u662f\u8fd0\u884c initdb \u7684\u64cd\u4f5c\u7cfb\u7edf\u7528\u6237\u540d\u3002", "signature": {"url": "/docs/17/app-initdb.html#APP-INITDB-OPTION-USERNAME", "text": "-U username --username= username"}}, {"summary": "\u4f7f initdb \u63d0\u793a\u8f93\u5165\u8981\u8d4b\u7ed9\u5f15\u5bfc\u8d85\u7ea7\u7528\u6237\u7684\u5bc6\u7801\u3002\u5982\u679c\u4e0d\u6253\u7b97\u4f7f\u7528\u5bc6\u7801\u8ba4\u8bc1\uff0c\u8fd9\u4e00\u70b9\u5e76\u4e0d\u91cd\u8981\u3002\u5426\u5219\uff0c\u5728\u8bbe\u7f6e\u5bc6\u7801\u4e4b\u524d\u5c06\u65e0\u6cd5\u4f7f\u7528\u5bc6\u7801\u8ba4\u8bc1\u3002", "signature": {"url": "/docs/17/app-initdb.html#APP-INITDB-OPTION-PWPROMPT", "text": "-W --pwprompt"}}, {"summary": "\u8be5\u9009\u9879\u6307\u5b9a\u9884\u5199\u5f0f\u65e5\u5fd7\uff08WAL\uff09\u5e94\u5b58\u653e\u7684\u76ee\u5f55\u3002", "signature": {"url": "/docs/17/app-initdb.html#APP-INITDB-OPTION-WALDIR", "text": "-X directory --waldir= directory"}}, {"summary": "\u8bbe\u7f6e WAL \u6bb5\u5927\u5c0f\uff0c\u5355\u4f4d\u4e3a\u5146\u5b57\u8282\u3002\u8fd9\u662f WAL \u65e5\u5fd7\u4e2d\u6bcf\u4e2a\u72ec\u7acb\u6587\u4ef6\u7684\u5927\u5c0f\u3002\u9ed8\u8ba4\u5927\u5c0f\u4e3a 16 \u5146\u5b57\u8282\u3002\u53d6\u503c\u5fc5\u987b\u662f 1 \u5230 1024\uff08\u5146\u5b57\u8282\uff09\u4e4b\u95f4\u7684 2 \u7684\u5e42\u3002\u6b64\u9009\u9879\u53ea\u80fd\u5728\u521d\u59cb\u5316\u65f6\u8bbe\u7f6e\uff0c\u4e4b\u540e\u65e0\u6cd5\u66f4\u6539\u3002", "signature": {"url": "/docs/17/app-initdb.html#APP-INITDB-OPTION-WAL-SEGSIZE", "text": "--wal-segsize= size"}}, {"summary": "\u5728 initdb \u671f\u95f4\u5f3a\u5236\u5c06\u670d\u52a1\u5668\u53c2\u6570 name \u8bbe\u4e3a value\uff0c\u5e76\u628a\u8be5\u8bbe\u7f6e\u5199\u5165\u751f\u6210\u7684 postgresql.conf \u6587\u4ef6\uff0c\u4f7f\u5176\u5728\u4e4b\u540e\u7684\u670d\u52a1\u5668\u8fd0\u884c\u4e2d\u4e5f\u751f\u6548\u3002\u6b64\u9009\u9879\u53ef\u591a\u6b21\u4f7f\u7528\uff0c\u4ee5\u8bbe\u7f6e\u591a\u4e2a\u53c2\u6570\u3002\u5b83\u4e3b\u8981\u7528\u4e8e\u73af\u5883\u6761\u4ef6\u5bfc\u81f4\u670d\u52a1\u5668\u5b8c\u5168\u65e0\u6cd5\u4f7f\u7528\u9ed8\u8ba4\u53c2\u6570\u542f\u52a8\u7684\u60c5\u51b5\u3002", "signature": {"url": "/docs/17/app-initdb.html#APP-INITDB-OPTION-SET", "text": "-c name = value --set name = value"}}, {"summary": "\u6253\u5370\u5f15\u5bfc\u540e\u7aef\u7684\u8c03\u8bd5\u8f93\u51fa\uff0c\u4ee5\u53ca\u5c11\u91cf\u666e\u901a\u7528\u6237\u901a\u5e38\u4e0d\u611f\u5174\u8da3\u7684\u5176\u4ed6\u6d88\u606f\u3002\u5f15\u5bfc\u540e\u7aef\u662f initdb \u7528\u6765\u521b\u5efa\u7cfb\u7edf\u76ee\u5f55\u8868\u7684\u7a0b\u5e8f\u3002\u8be5\u9009\u9879\u4f1a\u4ea7\u751f\u5927\u91cf\u6781\u5176\u4e4f\u5473\u7684\u8f93\u51fa\u3002", "signature": {"url": "/docs/17/app-initdb.html#APP-INITDB-OPTION-DEBUG", "text": "-d --debug"}}, {"summary": "\u4f7f\u7528 debug_discard_caches=1 \u9009\u9879\u8fd0\u884c\u5f15\u5bfc\u540e\u7aef\u3002\u8fd9\u4f1a\u82b1\u8d39\u5f88\u957f\u65f6\u95f4\uff0c\u53ea\u5bf9\u6df1\u5ea6\u8c03\u8bd5\u6709\u7528\u3002", "signature": {"url": "/docs/17/app-initdb.html#APP-INITDB-OPTION-DISCARD-CACHES", "text": "--discard-caches"}}, {"summary": "\u6307\u5b9a initdb \u521d\u59cb\u5316\u6570\u636e\u5e93\u96c6\u7c07\u65f6\u5e94\u5230\u54ea\u91cc\u67e5\u627e\u5176\u8f93\u5165\u6587\u4ef6\u3002\u901a\u5e38\u4e0d\u9700\u8981\u8fd9\u6837\u505a\u3002\u82e5\u9700\u8981\u663e\u5f0f\u6307\u5b9a\u5176\u4f4d\u7f6e\uff0c\u7cfb\u7edf\u4f1a\u63d0\u793a\u3002", "signature": {"url": "/docs/17/app-initdb.html#APP-INITDB-OPTION-L", "text": "-L directory"}}, {"summary": "\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c\u5982\u679c initdb \u53d1\u73b0\u67d0\u4e2a\u9519\u8bef\u4f7f\u5176\u65e0\u6cd5\u5b8c\u6574\u521b\u5efa\u6570\u636e\u5e93\u96c6\u7c07\uff0c\u5c31\u4f1a\u5220\u9664\u5b83\u5728\u53d1\u73b0\u65e0\u6cd5\u5b8c\u6210\u4efb\u52a1\u4e4b\u524d\u53ef\u80fd\u5df2\u521b\u5efa\u7684\u6240\u6709\u6587\u4ef6\u3002\u8be5\u9009\u9879\u4f1a\u7981\u6b62\u8fd9\u79cd\u6e05\u7406\uff0c\u56e0\u6b64\u5bf9\u8c03\u8bd5\u6709\u7528\u3002", "signature": {"url": "/docs/17/app-initdb.html#APP-INITDB-OPTION-NO-CLEAN", "text": "-n --no-clean"}}, {"summary": "\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c initdb \u4f1a\u7b49\u5f85\u6240\u6709\u6587\u4ef6\u90fd\u5b89\u5168\u5199\u5165\u78c1\u76d8\u3002\u8be5\u9009\u9879\u4f7f initdb \u5728\u4e0d\u7b49\u5f85\u7684\u60c5\u51b5\u4e0b\u8fd4\u56de\uff0c\u901f\u5ea6\u66f4\u5feb\uff0c\u4f46\u8fd9\u610f\u5473\u7740\u5982\u679c\u540e\u7eed\u64cd\u4f5c\u7cfb\u7edf\u5d29\u6e83\uff0c\u6570\u636e\u76ee\u5f55\u53ef\u80fd\u4f1a\u635f\u574f\u3002\u901a\u5e38\uff0c\u8be5\u9009\u9879\u9002\u7528\u4e8e\u6d4b\u8bd5\uff0c\u4f46\u4e0d\u5e94\u7528\u4e8e\u521b\u5efa\u751f\u4ea7\u73af\u5883\u5b89\u88c5\u3002", "signature": {"url": "/docs/17/app-initdb.html#APP-INITDB-OPTION-NO-SYNC", "text": "-N --no-sync"}}, {"summary": "\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c initdb \u4f1a\u5728\u5176\u8f93\u51fa\u672b\u5c3e\u5199\u51fa\u5982\u4f55\u542f\u52a8\u96c6\u7c07\u7684\u8bf4\u660e\u3002\u8be5\u9009\u9879\u4f1a\u7701\u7565\u8fd9\u4e9b\u8bf4\u660e\u3002\u5b83\u4e3b\u8981\u4f9b\u90a3\u4e9b\u5bf9 initdb \u8fdb\u884c\u5e73\u53f0\u7279\u5b9a\u5c01\u88c5\u7684\u5de5\u5177\u4f7f\u7528\uff0c\u56e0\u4e3a\u5728\u8fd9\u79cd\u60c5\u51b5\u4e0b\u90a3\u4e9b\u8bf4\u660e\u5f88\u53ef\u80fd\u5e76\u4e0d\u6b63\u786e\u3002", "signature": {"url": "/docs/17/app-initdb.html#APP-INITDB-OPTION-NO-INSTRUCTIONS", "text": "--no-instructions"}}, {"summary": "\u663e\u793a\u5185\u90e8\u8bbe\u7f6e\u5e76\u9000\u51fa\uff0c\u4e0d\u6267\u884c\u5176\u4ed6\u64cd\u4f5c\u3002\u53ef\u7528\u4e8e\u8c03\u8bd5 initdb \u7684\u5b89\u88c5\u3002", "signature": {"url": "/docs/17/app-initdb.html#APP-INITDB-OPTION-SHOW", "text": "-s --show"}}, {"summary": "\u8bbe\u4e3a fsync \uff08\u9ed8\u8ba4\u503c\uff09\u65f6\uff0c initdb \u4f1a\u9012\u5f52\u6253\u5f00\u5e76\u540c\u6b65\u6570\u636e\u76ee\u5f55\u4e2d\u7684\u6240\u6709\u6587\u4ef6\u3002\u67e5\u627e\u6587\u4ef6\u65f6\u4f1a\u8ddf\u968f WAL \u76ee\u5f55\u548c\u6bcf\u4e2a\u5df2\u914d\u7f6e\u8868\u7a7a\u95f4\u7684\u7b26\u53f7\u94fe\u63a5\u3002", "signature": {"url": "/docs/17/app-initdb.html#APP-INITDB-OPTION-SYNC-METHOD", "text": "--sync-method= method"}}, {"summary": "\u5c06\u6240\u6709\u6570\u636e\u5e93\u6587\u4ef6\u5b89\u5168\u5730\u5199\u5165\u78c1\u76d8\u5e76\u9000\u51fa\u3002\u8fd9\u4e0d\u4f1a\u6267\u884c\u4efb\u4f55\u5e38\u89c4\u7684 initdb \u64cd\u4f5c\u3002\u901a\u5e38\uff0c\u8be5\u9009\u9879\u53ef\u7528\u4e8e\u5728\u5c06 fsync \u4ece off \u6539\u4e3a on \u540e\uff0c\u786e\u4fdd\u80fd\u591f\u53ef\u9760\u6062\u590d\u3002", "signature": {"url": "/docs/17/app-initdb.html#APP-INITDB-OPTION-SYNC-ONLY", "text": "-S --sync-only"}}, {"summary": "\u6253\u5370 initdb \u7248\u672c\u5e76\u9000\u51fa\u3002", "signature": {"url": "/docs/17/app-initdb.html#APP-INITDB-OPTION-VERSION", "text": "-V --version"}}, {"summary": "\u663e\u793a\u6709\u5173 initdb \u547d\u4ee4\u884c\u53c2\u6570\u7684\u5e2e\u52a9\u5e76\u9000\u51fa\u3002", "signature": {"url": "/docs/17/app-initdb.html#APP-INITDB-OPTION-HELP", "text": "-? --help"}}], "title": "\u624b\u518c\u4e2d\u7684\u9009\u9879", "columns": [{"key": "signature", "label": "\u9009\u9879\u4e0e\u53c2\u6570"}, {"key": "summary", "label": "\u8bf4\u660e"}]}, {"key": "environment", "rows": [{"name": "PGDATA", "description": "\u6307\u5b9a\u6570\u636e\u5e93\u96c6\u7c07\u5e94\u5b58\u653e\u7684\u76ee\u5f55\uff1b\u53ef\u4f7f\u7528 -D \u9009\u9879\u8986\u76d6\u3002"}, {"name": "PG_COLOR", "description": "\u6307\u5b9a\u8bca\u65ad\u6d88\u606f\u662f\u5426\u4f7f\u7528\u989c\u8272\u3002\u53ef\u9009\u503c\u4e3a always \u3001 auto \u548c never \u3002"}, {"name": "TZ", "description": "\u6307\u5b9a\u6240\u521b\u5efa\u6570\u636e\u5e93\u96c6\u7c07\u7684\u9ed8\u8ba4\u65f6\u533a\u3002\u8be5\u503c\u5e94\u4e3a\u5b8c\u6574\u7684\u65f6\u533a\u540d\u79f0\uff08\u89c1 \u7b2c 8.5.3 \u8282 \uff09\u3002"}], "title": "\u73af\u5883\u53d8\u91cf", "columns": [{"key": "name", "label": "\u53d8\u91cf"}, {"key": "description", "label": "\u542b\u4e49"}]}], "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": "https://pg.center/docs/17/app-initdb.html", "file": "app-initdb.html", "label": "17.11 English manual \u00b7 app-initdb.html", "anchor": "", "sha256": "26c920120a4b5aa7feb0fe2c0055c8137da185fda8df17f52483dff750bf0b28", "language": "en", "original_url": "/docs/17/app-initdb.html"}, {"url": "https://pg.center/docs/17/reference-server.html", "file": "reference-server.html", "label": "Server applications inventory", "anchor": "", "sha256": "01f07993ff020684f4c290d17cdafa26fb17ea5c1d476bc3a5efc68bf8ddd9b9", "language": "en", "original_url": "/docs/17/reference-server.html"}], "sections": [], "synopsis": ["initdb [ option ...] [ --pgdata | -D ] directory"], "signature": "initdb [ option ...] [ --pgdata | -D ] directory", "description": ["initdb \u2014 \u521b\u5efa\u4e00\u4e2a\u65b0\u7684 PostgreSQL \u6570\u636e\u5e93\u96c6\u7c07"], "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 lang=\"zh\">initdb \u2014 \u521b\u5efa\u4e00\u4e2a\u65b0\u7684<span class=\"productname\">PostgreSQL</span>\u6570\u636e\u5e93\u96c6\u7c07</p>\n</div>\n<div class=\"refsynopsisdiv\">\n<h2 lang=\"zh\">\u5927\u7eb2</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 lang=\"zh\">\u8bf4\u660e</h2>\n<p lang=\"zh\"><code class=\"command\">initdb</code>\u521b\u5efa\u4e00\u4e2a\u65b0\u7684<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=\"\u6570\u636e\u5e93\u96c6\u7c07\">\u6570\u636e\u5e93\u96c6\u7c07</a>\u3002</p>\n<p lang=\"zh\">\u521b\u5efa\u6570\u636e\u5e93\u96c6\u7c07\u5305\u62ec\u521b\u5efa\u7528\u4e8e\u5b58\u653e\u96c6\u7c07\u6570\u636e\u7684<a class=\"glossterm\" href=\"/docs/17/glossary.html#GLOSSARY-DATA-DIRECTORY\"></a><a class=\"glossterm\" href=\"/docs/17/glossary.html#GLOSSARY-DATA-DIRECTORY\" title=\"\u6570\u636e\u76ee\u5f55\">\u76ee\u5f55</a>\uff0c\u751f\u6210\u5171\u4eab\u7cfb\u7edf\u76ee\u5f55\u8868\uff08\u5c5e\u4e8e\u6574\u4e2a\u96c6\u7c07\u800c\u4e0d\u662f\u67d0\u4e2a\u7279\u5b9a\u6570\u636e\u5e93\u7684\u8868\uff09\uff0c\u4ee5\u53ca\u521b\u5efa <code class=\"literal\">postgres</code>\u3001<code class=\"literal\">template1</code> \u548c <code class=\"literal\">template0</code> \u6570\u636e\u5e93\u3002<code class=\"literal\">postgres</code> \u6570\u636e\u5e93\u662f\u4e00\u4e2a\u9ed8\u8ba4\u6570\u636e\u5e93\uff0c\u4f9b\u7528\u6237\u3001\u5de5\u5177\u7a0b\u5e8f\u548c\u7b2c\u4e09\u65b9\u5e94\u7528\u7a0b\u5e8f\u4f7f\u7528\u3002<code class=\"literal\">template1</code> \u548c <code class=\"literal\">template0</code> \u7528\u4f5c\u540e\u7eed<code class=\"command\">CREATE DATABASE</code>\u547d\u4ee4\u590d\u5236\u7684\u6e90\u6570\u636e\u5e93\u3002<code class=\"literal\">template0</code> \u4e0d\u5e94\u88ab\u4fee\u6539\uff0c\u4f46\u53ef\u4ee5\u5411 <code class=\"literal\">template1</code> \u4e2d\u6dfb\u52a0\u5bf9\u8c61\uff0c\u8fd9\u4e9b\u5bf9\u8c61\u9ed8\u8ba4\u4f1a\u88ab\u590d\u5236\u5230\u4ee5\u540e\u521b\u5efa\u7684\u6570\u636e\u5e93\u4e2d\u3002\u66f4\u591a\u7ec6\u8282\u89c1<a class=\"xref\" href=\"/docs/17/manage-ag-templatedbs.html\" title=\"22.3.\u00a0\u6a21\u677f\u6570\u636e\u5e93\">\u7b2c\u00a022.3\u00a0\u8282</a>\u3002</p>\n<p lang=\"zh\">\u867d\u7136<code class=\"command\">initdb</code>\u4f1a\u5c1d\u8bd5\u521b\u5efa\u6307\u5b9a\u7684\u6570\u636e\u76ee\u5f55\uff0c\u4f46\u5982\u679c\u6240\u9700\u6570\u636e\u76ee\u5f55\u7684\u7236\u76ee\u5f55\u5f52 root \u6240\u6709\uff0c\u5b83\u53ef\u80fd\u6ca1\u6709\u8db3\u591f\u7684\u6743\u9650\u3002\u8981\u5728\u8fd9\u79cd\u73af\u5883\u4e2d\u521d\u59cb\u5316\uff0c\u53ef\u5148\u7531 root \u521b\u5efa\u4e00\u4e2a\u7a7a\u7684\u6570\u636e\u76ee\u5f55\uff0c\u7136\u540e\u7528<code class=\"command\">chown</code>\u5c06\u8be5\u76ee\u5f55\u7684\u6240\u6709\u6743\u8d4b\u4e88\u6570\u636e\u5e93\u7528\u6237\u8d26\u6237\uff0c\u518d\u7528 <code class=\"command\">su</code>\u5207\u6362\u4e3a\u8be5\u6570\u636e\u5e93\u7528\u6237\u6765\u8fd0\u884c<code class=\"command\">initdb</code>\u3002</p>\n<p lang=\"zh\"><code class=\"command\">initdb</code>\u5fc5\u987b\u4ee5\u5c06\u62e5\u6709\u670d\u52a1\u5668\u8fdb\u7a0b\u7684\u7528\u6237\u8eab\u4efd\u8fd0\u884c\uff0c\u56e0\u4e3a\u670d\u52a1\u5668\u9700\u8981\u8bbf\u95ee <code class=\"command\">initdb</code>\u521b\u5efa\u7684\u6587\u4ef6\u548c\u76ee\u5f55\u3002\u7531\u4e8e\u670d\u52a1\u5668\u4e0d\u80fd\u4ee5 root \u8eab\u4efd\u8fd0\u884c\uff0c\u56e0\u6b64\u4e5f\u7edd\u4e0d\u80fd\u4ee5 root \u8eab\u4efd\u8fd0\u884c<code class=\"command\">initdb</code>\u3002\uff08\u5b9e\u9645\u4e0a\u5b83\u4f1a\u62d2\u7edd\u8fd9\u6837\u505a\u3002\uff09</p>\n<p lang=\"zh\">\u51fa\u4e8e\u5b89\u5168\u539f\u56e0\uff0c<code class=\"command\">initdb</code>\u521b\u5efa\u7684\u65b0\u96c6\u7c07\u9ed8\u8ba4\u53ea\u6709\u96c6\u7c07\u62e5\u6709\u8005\u53ef\u4ee5\u8bbf\u95ee\u3002<code class=\"option\">--allow-group-access</code> \u9009\u9879\u5141\u8bb8\u4e0e\u96c6\u7c07\u62e5\u6709\u8005\u540c\u7ec4\u7684\u4efb\u4f55\u7528\u6237\u8bfb\u53d6\u96c6\u7c07\u4e2d\u7684\u6587\u4ef6\u3002\u8fd9\u5bf9\u7531\u975e\u7279\u6743\u7528\u6237\u6267\u884c\u5907\u4efd\u5f88\u6709\u7528\u3002</p>\n<p lang=\"zh\"><code class=\"command\">initdb</code>\u4f1a\u521d\u59cb\u5316\u6570\u636e\u5e93\u96c6\u7c07\u7684\u9ed8\u8ba4\u533a\u57df\u8bbe\u7f6e\u548c\u5b57\u7b26\u96c6\u7f16\u7801\u3002\u8fd9\u4e9b\u8bbe\u7f6e\u4e5f\u53ef\u4ee5\u5728\u521b\u5efa\u6bcf\u4e2a\u6570\u636e\u5e93\u65f6\u5206\u522b\u8bbe\u7f6e\u3002<code class=\"command\">initdb</code>\u4e3a\u6a21\u677f\u6570\u636e\u5e93\u786e\u5b9a\u8fd9\u4e9b\u8bbe\u7f6e\uff0c\u5b83\u4eec\u5c06\u4f5c\u4e3a\u6240\u6709\u5176\u4ed6\u6570\u636e\u5e93\u7684\u9ed8\u8ba4\u503c\u3002</p>\n<p lang=\"zh\">\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c<code class=\"command\">initdb</code>\u4f7f\u7528<code class=\"literal\">libc</code>\u533a\u57df\u8bbe\u7f6e\u63d0\u4f9b\u7a0b\u5e8f\uff08\u89c1<a class=\"xref\" href=\"/docs/17/locale.html#LOCALE-PROVIDERS\" title=\"23.1.4.\u00a0\u533a\u57df\u8bbe\u7f6e\u63d0\u4f9b\u7a0b\u5e8f\">\u7b2c\u00a023.1.4\u00a0\u8282</a>\uff09\u3002<code class=\"literal\">libc</code>\u533a\u57df\u8bbe\u7f6e\u63d0\u4f9b\u7a0b\u5e8f\u4f1a\u4ece\u73af\u5883\u4e2d\u83b7\u53d6\u533a\u57df\u8bbe\u7f6e\uff0c\u5e76\u6839\u636e\u533a\u57df\u8bbe\u7f6e\u786e\u5b9a\u7f16\u7801\u3002</p>\n<p lang=\"zh\">\u8981\u4e3a\u96c6\u7c07\u9009\u62e9\u4e0d\u540c\u7684\u533a\u57df\u8bbe\u7f6e\uff0c\u8bf7\u4f7f\u7528<code class=\"option\">--locale</code>\u3002\u6b64\u5916\u8fd8\u6709\u5355\u72ec\u7684 <code class=\"option\">--lc-*</code> \u548c <code class=\"option\">--icu-locale</code> \u9009\u9879\uff08\u89c1\u4e0b\u6587\uff09\uff0c\u7528\u4e8e\u4e3a\u5404\u4e2a\u533a\u57df\u8bbe\u7f6e\u7c7b\u522b\u8bbe\u7f6e\u503c\u3002\u8bf7\u6ce8\u610f\uff0c\u4e0d\u540c\u533a\u57df\u8bbe\u7f6e\u7c7b\u522b\u4e4b\u95f4\u82e5\u8bbe\u7f6e\u4e0d\u4e00\u81f4\uff0c\u53ef\u80fd\u4ea7\u751f\u4e0d\u5408\u7406\u7684\u7ed3\u679c\uff0c\u56e0\u6b64\u5e94\u8c28\u614e\u4f7f\u7528\u3002</p>\n<p lang=\"zh\">\u4e5f\u53ef\u4ee5\u6307\u5b9a --locale-provider=icu\uff0c\u8ba9 initdb \u4f7f\u7528 ICU \u5e93\u63d0\u4f9b\u533a\u57df\u8bbe\u7f6e\u670d\u52a1\u3002\u670d\u52a1\u5668\u5fc5\u987b\u5728\u6784\u5efa\u65f6\u542f\u7528 ICU \u652f\u6301\u3002\u4f7f\u7528 --icu-locale \u9009\u9879\u9009\u62e9\u5177\u4f53\u7684 ICU \u533a\u57df ID\u3002\u6ce8\u610f\uff0c\u51fa\u4e8e\u5b9e\u73b0\u65b9\u9762\u7684\u539f\u56e0\u4ee5\u53ca\u5bf9\u65e7\u4ee3\u7801\u7684\u517c\u5bb9\uff0c\u5373\u4f7f\u4f7f\u7528 ICU \u533a\u57df\u8bbe\u7f6e\u63d0\u4f9b\u8005\uff0cinitdb \u4ecd\u4f1a\u9009\u62e9\u5e76\u521d\u59cb\u5316 libc \u533a\u57df\u8bbe\u7f6e\u3002</p>\n<p lang=\"zh\"><code class=\"command\">initdb</code>\u8fd0\u884c\u65f6\u4f1a\u6253\u5370\u51fa\u5b83\u9009\u62e9\u7684\u533a\u57df\u8bbe\u7f6e\u3002\u5982\u679c\u6709\u590d\u6742\u9700\u6c42\u6216\u8005\u6307\u5b9a\u4e86\u591a\u4e2a\u9009\u9879\uff0c\u5efa\u8bae\u68c0\u67e5\u7ed3\u679c\u662f\u5426\u7b26\u5408\u9884\u671f\u3002</p>\n<p lang=\"zh\">\u6709\u5173\u533a\u57df\u8bbe\u7f6e\u7684\u66f4\u591a\u7ec6\u8282\u89c1<a class=\"xref\" href=\"/docs/17/locale.html\" title=\"23.1.\u00a0\u533a\u57df\u8bbe\u7f6e\u652f\u6301\">\u7b2c\u00a023.1\u00a0\u8282</a>\u3002</p>\n<p lang=\"zh\">\u8981\u4fee\u6539\u9ed8\u8ba4\u7f16\u7801\uff0c\u8bf7\u4f7f\u7528<code class=\"option\">--encoding</code>\u3002\u66f4\u591a\u7ec6\u8282\u89c1<a class=\"xref\" href=\"/docs/17/multibyte.html\" title=\"23.3.\u00a0\u5b57\u7b26\u96c6\u652f\u6301\">\u7b2c\u00a023.3\u00a0\u8282</a>\u3002</p>\n</div>\n<div class=\"refsect1\" id=\"id-1.9.5.3.6\">\n<h2 lang=\"zh\">\u9009\u9879</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 lang=\"zh\">\u8be5\u9009\u9879\u6307\u5b9a<code class=\"filename\">pg_hba.conf</code>\u4e2d\u672c\u5730\u7528\u6237\u9ed8\u8ba4\u4f7f\u7528\u7684\u8ba4\u8bc1\u65b9\u6cd5\uff08<code class=\"literal\">host</code> \u548c <code class=\"literal\">local</code> \u884c\uff09\u3002\u6709\u6548\u503c\u6982\u89c8\u89c1<a class=\"xref\" href=\"/docs/17/auth-pg-hba-conf.html\" title=\"20.1.\u00a0pg_hba.conf \u6587\u4ef6\">\u7b2c\u00a020.1\u00a0\u8282</a>\u3002</p>\n<p lang=\"zh\"><code class=\"command\">initdb</code>\u4f1a\u4f7f\u7528\u6307\u5b9a\u7684\u8ba4\u8bc1\u65b9\u6cd5\u9884\u586b\u5145<code class=\"filename\">pg_hba.conf</code> \u6761\u76ee\uff0c\u65e2\u7528\u4e8e\u975e\u590d\u5236\u8fde\u63a5\uff0c\u4e5f\u7528\u4e8e\u590d\u5236\u8fde\u63a5\u3002</p>\n<p lang=\"zh\">\u9664\u975e\u4fe1\u4efb\u7cfb\u7edf\u4e0a\u7684\u6240\u6709\u672c\u5730\u7528\u6237\uff0c\u5426\u5219\u4e0d\u8981\u4f7f\u7528<code class=\"literal\">trust</code>\u3002\u4e3a\u4e86\u4fbf\u4e8e\u5b89\u88c5\uff0c\u9ed8\u8ba4\u4f7f\u7528<code class=\"literal\">trust</code>\u3002</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 lang=\"zh\">\n<p>\u8be5\u9009\u9879\u6307\u5b9a<code class=\"filename\">pg_hba.conf</code>\u4e2d\u672c\u5730\u7528\u6237\u901a\u8fc7 TCP/IP \u8fde\u63a5\u65f6\uff08<code class=\"literal\">host</code> \u884c\uff09\u4f7f\u7528\u7684\u8ba4\u8bc1\u65b9\u6cd5\u3002</p>\n</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 lang=\"zh\">\n<p>\u8be5\u9009\u9879\u6307\u5b9a<code class=\"filename\">pg_hba.conf</code>\u4e2d\u672c\u5730\u7528\u6237\u901a\u8fc7 Unix \u57df\u5957\u63a5\u5b57\u8fde\u63a5\u65f6\uff08<code class=\"literal\">local</code> \u884c\uff09\u4f7f\u7528\u7684\u8ba4\u8bc1\u65b9\u6cd5\u3002</p>\n</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 lang=\"zh\">\n<p>\u8be5\u9009\u9879\u6307\u5b9a\u6570\u636e\u5e93\u96c6\u7c07\u5e94\u5b58\u653e\u7684\u76ee\u5f55\u3002\u8fd9\u662f<code class=\"command\">initdb</code>\u6240\u9700\u7684\u552f\u4e00\u4fe1\u606f\uff0c\u4f46\u4e5f\u53ef\u4ee5\u901a\u8fc7\u8bbe\u7f6e<code class=\"envar\">PGDATA</code>\u73af\u5883\u53d8\u91cf\u6765\u7701\u53bb\u663e\u5f0f\u5199\u51fa\u5b83\uff1b\u8fd9\u901a\u5e38\u66f4\u65b9\u4fbf\uff0c\u56e0\u4e3a\u6570\u636e\u5e93\u670d\u52a1\u5668\uff08<code class=\"command\">postgres</code>\uff09\u4e4b\u540e\u4e5f\u53ef\u4ee5\u901a\u8fc7\u540c\u4e00\u53d8\u91cf\u627e\u5230\u6570\u636e\u76ee\u5f55\u3002</p>\n</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 lang=\"zh\">\u9009\u62e9\u6a21\u677f\u6570\u636e\u5e93\u7684\u7f16\u7801\u3002\u8fd9\u4e5f\u5c06\u6210\u4e3a\u4ee5\u540e\u521b\u5efa\u7684\u4efb\u4f55\u6570\u636e\u5e93\u7684\u9ed8\u8ba4\u7f16\u7801\uff0c\u9664\u975e\u5728\u521b\u5efa\u65f6\u8986\u76d6\u5b83\u3002<span class=\"productname\">PostgreSQL</span>\u670d\u52a1\u5668\u652f\u6301\u7684\u5b57\u7b26\u96c6\u89c1<a class=\"xref\" href=\"/docs/17/multibyte.html#MULTIBYTE-CHARSET-SUPPORTED\" title=\"23.3.1.\u00a0\u652f\u6301\u7684\u5b57\u7b26\u96c6\">\u7b2c\u00a023.3.1\u00a0\u8282</a>\u3002</p>\n<p lang=\"zh\">\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c\u6a21\u677f\u6570\u636e\u5e93\u7684\u7f16\u7801\u7531\u533a\u57df\u8bbe\u7f6e\u51b3\u5b9a\u3002\u5982\u679c\u6307\u5b9a --no-locale\uff08\u6216\u7b49\u4ef7\u5730\u5c06\u533a\u57df\u8bbe\u7f6e\u8bbe\u4e3a C \u6216 POSIX\uff09\uff0c\u5219 ICU \u63d0\u4f9b\u8005\u7684\u9ed8\u8ba4\u7f16\u7801\u4e3a UTF8\uff0clibc \u63d0\u4f9b\u8005\u7684\u9ed8\u8ba4\u7f16\u7801\u4e3a SQL_ASCII\u3002</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 lang=\"zh\">\u5141\u8bb8\u4e0e\u96c6\u7fa4\u6240\u6709\u8005\u540c\u7ec4\u7684\u7528\u6237\u8bfb\u53d6 initdb \u521b\u5efa\u7684\u6240\u6709\u96c6\u7fa4\u6587\u4ef6\u3002Windows \u4e0d\u652f\u6301 POSIX \u98ce\u683c\u7684\u7ec4\u6743\u9650\uff0c\u56e0\u6b64\u4f1a\u5ffd\u7565\u6b64\u9009\u9879\u3002</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 lang=\"zh\">\n<p>\u5f53\u4f7f\u7528 ICU \u63d0\u4f9b\u7a0b\u5e8f\u65f6\uff0c\u6307\u5b9a ICU \u533a\u57df\u8bbe\u7f6e\u3002\u533a\u57df\u8bbe\u7f6e\u652f\u6301\u89c1<a class=\"xref\" href=\"/docs/17/locale.html\" title=\"23.1.\u00a0\u533a\u57df\u8bbe\u7f6e\u652f\u6301\">\u7b2c\u00a023.1\u00a0\u8282</a>\u3002</p>\n</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 lang=\"zh\">\n<p>\u6307\u5b9a\u9644\u52a0\u7684\u6392\u5e8f\u89c4\u5219\uff0c\u4ee5\u5b9a\u5236\u9ed8\u8ba4\u6392\u5e8f\u89c4\u5219\u7684\u884c\u4e3a\u3002\u8be5\u9009\u9879\u4ec5\u652f\u6301 ICU\u3002</p>\n</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 lang=\"zh\">\n<p>\u5728\u6570\u636e\u9875\u4e0a\u4f7f\u7528\u6821\u9a8c\u548c\uff0c\u5e2e\u52a9\u68c0\u6d4b I/O \u7cfb\u7edf\u9020\u6210\u7684\u3001\u5426\u5219\u53ef\u80fd\u6084\u65e0\u58f0\u606f\u7684\u6570\u636e\u635f\u574f\u3002\u542f\u7528\u6821\u9a8c\u548c\u53ef\u80fd\u4f1a\u5e26\u6765\u660e\u663e\u7684\u6027\u80fd\u635f\u5931\u3002\u5982\u679c\u542f\u7528\uff0c\u5c31\u4f1a\u4e3a\u6240\u6709\u6570\u636e\u5e93\u4e2d\u7684\u6240\u6709\u5bf9\u8c61\u8ba1\u7b97\u6821\u9a8c\u548c\u3002\u6240\u6709\u6821\u9a8c\u548c\u5931\u8d25\u90fd\u4f1a\u5728 <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>\u89c6\u56fe\u4e2d\u62a5\u544a\u3002\u8be6\u89c1<a class=\"xref\" href=\"/docs/17/checksums.html\" title=\"28.2.\u00a0\u6570\u636e\u6821\u9a8c\u548c\">\u7b2c\u00a028.2\u00a0\u8282</a>\u3002</p>\n</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 lang=\"zh\">\u8bbe\u7f6e\u6570\u636e\u5e93\u96c6\u7c07\u7684\u9ed8\u8ba4\u533a\u57df\u8bbe\u7f6e\u3002\u5982\u679c\u672a\u6307\u5b9a\u8be5\u9009\u9879\uff0c\u533a\u57df\u8bbe\u7f6e\u5c06\u7ee7\u627f\u81ea <code class=\"command\">initdb</code>\u8fd0\u884c\u65f6\u6240\u5728\u7684\u73af\u5883\u3002\u533a\u57df\u8bbe\u7f6e\u652f\u6301\u89c1<a class=\"xref\" href=\"/docs/17/locale.html\" title=\"23.1.\u00a0\u533a\u57df\u8bbe\u7f6e\u652f\u6301\">\u7b2c\u00a023.1\u00a0\u8282</a>\u3002</p>\n<p lang=\"zh\">\u5982\u679c<code class=\"option\">--locale-provider</code>\u4e3a<code class=\"literal\">builtin</code>\uff0c\u5219\u5fc5\u987b\u6307\u5b9a<code class=\"option\">--locale</code>\u6216<code class=\"option\">--builtin-locale</code>\uff0c\u5e76\u5c06\u5176\u8bbe\u7f6e\u4e3a<code class=\"literal\">C</code>\u6216<code class=\"literal\">C.UTF-8</code>\u3002</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 lang=\"zh\">\n<p>\u7c7b\u4f3c\u4e8e<code class=\"option\">--locale</code>\uff0c\u4f46\u53ea\u5728\u6307\u5b9a\u7684\u7c7b\u522b\u4e2d\u8bbe\u7f6e\u533a\u57df\u8bbe\u7f6e\u3002</p>\n</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 lang=\"zh\">\n<p>\u7b49\u4ef7\u4e8e<code class=\"option\">--locale=C</code>\u3002</p>\n</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 lang=\"zh\">\n<p>\u5f53\u4f7f\u7528 builtin \u63d0\u4f9b\u7a0b\u5e8f\u65f6\uff0c\u6307\u5b9a\u533a\u57df\u8bbe\u7f6e\u540d\u79f0\u3002\u533a\u57df\u8bbe\u7f6e\u652f\u6301\u89c1<a class=\"xref\" href=\"/docs/17/locale.html\" title=\"23.1.\u00a0\u533a\u57df\u8bbe\u7f6e\u652f\u6301\">\u7b2c\u00a023.1\u00a0\u8282</a>\u3002</p>\n</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 lang=\"zh\">\n<p>\u8be5\u9009\u9879\u8bbe\u7f6e\u65b0\u96c6\u7c07\u4e2d\u521b\u5efa\u7684\u6570\u636e\u5e93\u6240\u4f7f\u7528\u7684\u533a\u57df\u8bbe\u7f6e\u63d0\u4f9b\u7a0b\u5e8f\u3002\u540e\u7eed\u521b\u5efa\u65b0\u6570\u636e\u5e93\u65f6\uff0c\u53ef\u4ee5\u5728<code class=\"command\">CREATE DATABASE</code>\u547d\u4ee4\u4e2d\u8986\u76d6\u5b83\u3002\u9ed8\u8ba4\u503c\u4e3a <code class=\"literal\">libc</code>\uff08\u89c1<a class=\"xref\" href=\"/docs/17/locale.html#LOCALE-PROVIDERS\" title=\"23.1.4.\u00a0\u533a\u57df\u8bbe\u7f6e\u63d0\u4f9b\u7a0b\u5e8f\">\u7b2c\u00a023.1.4\u00a0\u8282</a>\uff09\u3002</p>\n</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 lang=\"zh\">\n<p>\u4f7f<code class=\"command\">initdb</code>\u4ece\u6587\u4ef6\u4e2d\u8bfb\u53d6\u5f15\u5bfc\u8d85\u7ea7\u7528\u6237\u7684\u5bc6\u7801\u3002\u6587\u4ef6\u7684\u7b2c\u4e00\u884c\u4f1a\u88ab\u5f53\u4f5c\u5bc6\u7801\u3002</p>\n</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 lang=\"zh\">\n<p>\u8bbe\u7f6e\u9ed8\u8ba4\u6587\u672c\u68c0\u7d22\u914d\u7f6e\u3002\u66f4\u591a\u4fe1\u606f\u89c1<a class=\"xref\" href=\"/docs/17/runtime-config-client.html#GUC-DEFAULT-TEXT-SEARCH-CONFIG\">default_text_search_config</a>\u3002</p>\n</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 lang=\"zh\">\n<p>\u8bbe\u7f6e<a class=\"glossterm\" href=\"/docs/17/glossary.html#GLOSSARY-BOOTSTRAP-SUPERUSER\"></a><a class=\"glossterm\" href=\"/docs/17/glossary.html#GLOSSARY-BOOTSTRAP-SUPERUSER\" title=\"\u5f15\u5bfc\u8d85\u7ea7\u7528\u6237\">\u5f15\u5bfc\u8d85\u7ea7\u7528\u6237</a>\u7684\u7528\u6237\u540d\u3002\u9ed8\u8ba4\u503c\u662f\u8fd0\u884c<code class=\"command\">initdb</code>\u7684\u64cd\u4f5c\u7cfb\u7edf\u7528\u6237\u540d\u3002</p>\n</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 lang=\"zh\">\n<p>\u4f7f<code class=\"command\">initdb</code>\u63d0\u793a\u8f93\u5165\u8981\u8d4b\u7ed9\u5f15\u5bfc\u8d85\u7ea7\u7528\u6237\u7684\u5bc6\u7801\u3002\u5982\u679c\u4e0d\u6253\u7b97\u4f7f\u7528\u5bc6\u7801\u8ba4\u8bc1\uff0c\u8fd9\u4e00\u70b9\u5e76\u4e0d\u91cd\u8981\u3002\u5426\u5219\uff0c\u5728\u8bbe\u7f6e\u5bc6\u7801\u4e4b\u524d\u5c06\u65e0\u6cd5\u4f7f\u7528\u5bc6\u7801\u8ba4\u8bc1\u3002</p>\n</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 lang=\"zh\">\n<p>\u8be5\u9009\u9879\u6307\u5b9a\u9884\u5199\u5f0f\u65e5\u5fd7\uff08WAL\uff09\u5e94\u5b58\u653e\u7684\u76ee\u5f55\u3002</p>\n</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 lang=\"zh\">\u8bbe\u7f6e WAL \u6bb5\u5927\u5c0f\uff0c\u5355\u4f4d\u4e3a\u5146\u5b57\u8282\u3002\u8fd9\u662f WAL \u65e5\u5fd7\u4e2d\u6bcf\u4e2a\u72ec\u7acb\u6587\u4ef6\u7684\u5927\u5c0f\u3002\u9ed8\u8ba4\u5927\u5c0f\u4e3a 16 \u5146\u5b57\u8282\u3002\u53d6\u503c\u5fc5\u987b\u662f 1 \u5230 1024\uff08\u5146\u5b57\u8282\uff09\u4e4b\u95f4\u7684 2 \u7684\u5e42\u3002\u6b64\u9009\u9879\u53ea\u80fd\u5728\u521d\u59cb\u5316\u65f6\u8bbe\u7f6e\uff0c\u4e4b\u540e\u65e0\u6cd5\u66f4\u6539\u3002</p>\n<p lang=\"zh\">\u8c03\u6574\u8be5\u5927\u5c0f\u53ef\u80fd\u6709\u52a9\u4e8e\u63a7\u5236 WAL \u65e5\u5fd7\u4f20\u9001\u6216\u5f52\u6863\u7684\u7c92\u5ea6\u3002\u6b64\u5916\uff0c\u5728 WAL \u91cf\u5f88\u5927\u7684\u6570\u636e\u5e93\u4e2d\uff0c\u6bcf\u4e2a\u76ee\u5f55\u4e2d\u7684 WAL \u6587\u4ef6\u6570\u91cf\u53ef\u80fd\u4f1a\u6210\u4e3a\u6027\u80fd\u548c\u7ba1\u7406\u95ee\u9898\u3002\u589e\u5927 WAL \u6587\u4ef6\u5927\u5c0f\u4f1a\u51cf\u5c11 WAL \u6587\u4ef6\u6570\u91cf\u3002</p>\n</dd>\n</dl>\n</div>\n<p lang=\"zh\">\u8fd8\u63d0\u4f9b\u4e86\u5176\u4ed6\u4e00\u4e9b\u8f83\u5c11\u4f7f\u7528\u7684\u9009\u9879\uff1a</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 lang=\"zh\">\u5728 initdb \u671f\u95f4\u5f3a\u5236\u5c06\u670d\u52a1\u5668\u53c2\u6570 name \u8bbe\u4e3a value\uff0c\u5e76\u628a\u8be5\u8bbe\u7f6e\u5199\u5165\u751f\u6210\u7684 postgresql.conf \u6587\u4ef6\uff0c\u4f7f\u5176\u5728\u4e4b\u540e\u7684\u670d\u52a1\u5668\u8fd0\u884c\u4e2d\u4e5f\u751f\u6548\u3002\u6b64\u9009\u9879\u53ef\u591a\u6b21\u4f7f\u7528\uff0c\u4ee5\u8bbe\u7f6e\u591a\u4e2a\u53c2\u6570\u3002\u5b83\u4e3b\u8981\u7528\u4e8e\u73af\u5883\u6761\u4ef6\u5bfc\u81f4\u670d\u52a1\u5668\u5b8c\u5168\u65e0\u6cd5\u4f7f\u7528\u9ed8\u8ba4\u53c2\u6570\u542f\u52a8\u7684\u60c5\u51b5\u3002</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 lang=\"zh\">\n<p>\u6253\u5370\u5f15\u5bfc\u540e\u7aef\u7684\u8c03\u8bd5\u8f93\u51fa\uff0c\u4ee5\u53ca\u5c11\u91cf\u666e\u901a\u7528\u6237\u901a\u5e38\u4e0d\u611f\u5174\u8da3\u7684\u5176\u4ed6\u6d88\u606f\u3002\u5f15\u5bfc\u540e\u7aef\u662f <code class=\"command\">initdb</code>\u7528\u6765\u521b\u5efa\u7cfb\u7edf\u76ee\u5f55\u8868\u7684\u7a0b\u5e8f\u3002\u8be5\u9009\u9879\u4f1a\u4ea7\u751f\u5927\u91cf\u6781\u5176\u4e4f\u5473\u7684\u8f93\u51fa\u3002</p>\n</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 lang=\"zh\">\n<p>\u4f7f\u7528<code class=\"literal\">debug_discard_caches=1</code>\u9009\u9879\u8fd0\u884c\u5f15\u5bfc\u540e\u7aef\u3002\u8fd9\u4f1a\u82b1\u8d39\u5f88\u957f\u65f6\u95f4\uff0c\u53ea\u5bf9\u6df1\u5ea6\u8c03\u8bd5\u6709\u7528\u3002</p>\n</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 lang=\"zh\">\n<p>\u6307\u5b9a<code class=\"command\">initdb</code>\u521d\u59cb\u5316\u6570\u636e\u5e93\u96c6\u7c07\u65f6\u5e94\u5230\u54ea\u91cc\u67e5\u627e\u5176\u8f93\u5165\u6587\u4ef6\u3002\u901a\u5e38\u4e0d\u9700\u8981\u8fd9\u6837\u505a\u3002\u82e5\u9700\u8981\u663e\u5f0f\u6307\u5b9a\u5176\u4f4d\u7f6e\uff0c\u7cfb\u7edf\u4f1a\u63d0\u793a\u3002</p>\n</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 lang=\"zh\">\n<p>\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c\u5982\u679c<code class=\"command\">initdb</code>\u53d1\u73b0\u67d0\u4e2a\u9519\u8bef\u4f7f\u5176\u65e0\u6cd5\u5b8c\u6574\u521b\u5efa\u6570\u636e\u5e93\u96c6\u7c07\uff0c\u5c31\u4f1a\u5220\u9664\u5b83\u5728\u53d1\u73b0\u65e0\u6cd5\u5b8c\u6210\u4efb\u52a1\u4e4b\u524d\u53ef\u80fd\u5df2\u521b\u5efa\u7684\u6240\u6709\u6587\u4ef6\u3002\u8be5\u9009\u9879\u4f1a\u7981\u6b62\u8fd9\u79cd\u6e05\u7406\uff0c\u56e0\u6b64\u5bf9\u8c03\u8bd5\u6709\u7528\u3002</p>\n</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 lang=\"zh\">\n<p>\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c<code class=\"command\">initdb</code>\u4f1a\u7b49\u5f85\u6240\u6709\u6587\u4ef6\u90fd\u5b89\u5168\u5199\u5165\u78c1\u76d8\u3002\u8be5\u9009\u9879\u4f7f <code class=\"command\">initdb</code>\u5728\u4e0d\u7b49\u5f85\u7684\u60c5\u51b5\u4e0b\u8fd4\u56de\uff0c\u901f\u5ea6\u66f4\u5feb\uff0c\u4f46\u8fd9\u610f\u5473\u7740\u5982\u679c\u540e\u7eed\u64cd\u4f5c\u7cfb\u7edf\u5d29\u6e83\uff0c\u6570\u636e\u76ee\u5f55\u53ef\u80fd\u4f1a\u635f\u574f\u3002\u901a\u5e38\uff0c\u8be5\u9009\u9879\u9002\u7528\u4e8e\u6d4b\u8bd5\uff0c\u4f46\u4e0d\u5e94\u7528\u4e8e\u521b\u5efa\u751f\u4ea7\u73af\u5883\u5b89\u88c5\u3002</p>\n</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 lang=\"zh\">\n<p>\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c<code class=\"command\">initdb</code>\u4f1a\u5728\u5176\u8f93\u51fa\u672b\u5c3e\u5199\u51fa\u5982\u4f55\u542f\u52a8\u96c6\u7c07\u7684\u8bf4\u660e\u3002\u8be5\u9009\u9879\u4f1a\u7701\u7565\u8fd9\u4e9b\u8bf4\u660e\u3002\u5b83\u4e3b\u8981\u4f9b\u90a3\u4e9b\u5bf9<code class=\"command\">initdb</code>\u8fdb\u884c\u5e73\u53f0\u7279\u5b9a\u5c01\u88c5\u7684\u5de5\u5177\u4f7f\u7528\uff0c\u56e0\u4e3a\u5728\u8fd9\u79cd\u60c5\u51b5\u4e0b\u90a3\u4e9b\u8bf4\u660e\u5f88\u53ef\u80fd\u5e76\u4e0d\u6b63\u786e\u3002</p>\n</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 lang=\"zh\">\n<p>\u663e\u793a\u5185\u90e8\u8bbe\u7f6e\u5e76\u9000\u51fa\uff0c\u4e0d\u6267\u884c\u5176\u4ed6\u64cd\u4f5c\u3002\u53ef\u7528\u4e8e\u8c03\u8bd5<span class=\"application\">initdb</span>\u7684\u5b89\u88c5\u3002</p>\n</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 lang=\"zh\">\u8bbe\u4e3a<code class=\"literal\">fsync</code>\uff08\u9ed8\u8ba4\u503c\uff09\u65f6\uff0c<code class=\"command\">initdb</code>\u4f1a\u9012\u5f52\u6253\u5f00\u5e76\u540c\u6b65\u6570\u636e\u76ee\u5f55\u4e2d\u7684\u6240\u6709\u6587\u4ef6\u3002\u67e5\u627e\u6587\u4ef6\u65f6\u4f1a\u8ddf\u968f WAL \u76ee\u5f55\u548c\u6bcf\u4e2a\u5df2\u914d\u7f6e\u8868\u7a7a\u95f4\u7684\u7b26\u53f7\u94fe\u63a5\u3002</p>\n<p lang=\"zh\">\u5728 Linux \u4e0a\uff0c\u4e5f\u53ef\u4ee5\u6539\u7528<code class=\"literal\">syncfs</code>\uff0c\u8bf7\u6c42\u64cd\u4f5c\u7cfb\u7edf\u540c\u6b65\u5305\u542b\u6570\u636e\u76ee\u5f55\u3001WAL \u6587\u4ef6\u4ee5\u53ca\u6bcf\u4e2a\u8868\u7a7a\u95f4\u7684\u6574\u4e2a\u6587\u4ef6\u7cfb\u7edf\u3002\u4f7f\u7528<code class=\"literal\">syncfs</code>\u65f6\u9700\u6ce8\u610f\u7684\u4e8b\u9879\u89c1<a class=\"xref\" href=\"/docs/17/runtime-config-error-handling.html#GUC-RECOVERY-INIT-SYNC-METHOD\">recovery_init_sync_method</a>\u3002</p>\n<p lang=\"zh\">\u4f7f\u7528<code class=\"option\">--no-sync</code>\u65f6\uff0c\u8be5\u9009\u9879\u4e0d\u8d77\u4f5c\u7528\u3002</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 lang=\"zh\">\n<p>\u5c06\u6240\u6709\u6570\u636e\u5e93\u6587\u4ef6\u5b89\u5168\u5730\u5199\u5165\u78c1\u76d8\u5e76\u9000\u51fa\u3002\u8fd9\u4e0d\u4f1a\u6267\u884c\u4efb\u4f55\u5e38\u89c4\u7684 <span class=\"application\">initdb</span>\u64cd\u4f5c\u3002\u901a\u5e38\uff0c\u8be5\u9009\u9879\u53ef\u7528\u4e8e\u5728\u5c06<a class=\"xref\" href=\"/docs/17/runtime-config-wal.html#GUC-FSYNC\">fsync</a>\u4ece<code class=\"literal\">off</code>\u6539\u4e3a<code class=\"literal\">on</code>\u540e\uff0c\u786e\u4fdd\u80fd\u591f\u53ef\u9760\u6062\u590d\u3002</p>\n</p>\n</dd>\n</dl>\n</div>\n<p lang=\"zh\">\u5176\u4ed6\u9009\u9879\uff1a</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 lang=\"zh\">\n<p>\u6253\u5370<span class=\"application\">initdb</span>\u7248\u672c\u5e76\u9000\u51fa\u3002</p>\n</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 lang=\"zh\">\n<p>\u663e\u793a\u6709\u5173<span class=\"application\">initdb</span>\u547d\u4ee4\u884c\u53c2\u6570\u7684\u5e2e\u52a9\u5e76\u9000\u51fa\u3002</p>\n</p>\n</dd>\n</dl>\n</div>\n</div>\n<div class=\"refsect1\" id=\"id-1.9.5.3.7\">\n<h2 lang=\"zh\">\u73af\u5883</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 lang=\"zh\">\n<p>\u6307\u5b9a\u6570\u636e\u5e93\u96c6\u7c07\u5e94\u5b58\u653e\u7684\u76ee\u5f55\uff1b\u53ef\u4f7f\u7528<code class=\"option\">-D</code>\u9009\u9879\u8986\u76d6\u3002</p>\n</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 lang=\"zh\">\n<p>\u6307\u5b9a\u8bca\u65ad\u6d88\u606f\u662f\u5426\u4f7f\u7528\u989c\u8272\u3002\u53ef\u9009\u503c\u4e3a <code class=\"literal\">always</code>\u3001<code class=\"literal\">auto</code>\u548c <code class=\"literal\">never</code>\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-INITDB-ENVIRONMENT-TZ\"><span class=\"term\"><code class=\"envar\">TZ</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6307\u5b9a\u6240\u521b\u5efa\u6570\u636e\u5e93\u96c6\u7c07\u7684\u9ed8\u8ba4\u65f6\u533a\u3002\u8be5\u503c\u5e94\u4e3a\u5b8c\u6574\u7684\u65f6\u533a\u540d\u79f0\uff08\u89c1<a class=\"xref\" href=\"/docs/17/datatype-datetime.html#DATATYPE-TIMEZONES\" title=\"8.5.3.\u00a0\u65f6\u533a\">\u7b2c\u00a08.5.3\u00a0\u8282</a>\uff09\u3002</p>\n</p>\n</dd>\n</dl>\n</div>\n</div>\n<div class=\"refsect1\" id=\"id-1.9.5.3.8\">\n<h2 lang=\"zh\">\u6ce8\u89e3</h2>\n<p lang=\"zh\">\u4e5f\u53ef\u4ee5\u901a\u8fc7 pg_ctl initdb \u8c03\u7528 initdb\u3002</p>\n</div>\n<div class=\"refsect1\" id=\"id-1.9.5.3.9\">\n<h2 lang=\"zh\">\u53e6\u89c1</h2><span class=\"simplelist\"><a class=\"xref\" href=\"https://pg.center/docs/17/app-pg-ctl.html\" title=\"pg_ctl\"><span class=\"refentrytitle\"><span class=\"application\">pg_ctl</span></span></a>, <a class=\"xref\" href=\"https://pg.center/docs/17/app-postgres.html\" title=\"postgres\"><span class=\"refentrytitle\"><span class=\"application\">postgres</span></span></a>, <a class=\"xref\" href=\"https://pg.center/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", "localization": {"status": "complete", "sources": [{"url": "/docs/17/app-initdb.html", "method": "same-major semantic node", "sha256": "9996a0235bd5ebf37d2b9ac39fe5cb5fb4cb123ae5e6d345675345a3fe441b44", "language": "zh", "matched_nodes": ["#APP-INITDB/div[2]/p[1]", "#APP-INITDB/div[3]/h2[0]", "#APP-INITDB/div[4]/p[10]", "#APP-INITDB/div[4]/p[11]", "#APP-INITDB/div[4]/p[12]", "#APP-INITDB/div[4]/p[1]", "#APP-INITDB/div[4]/p[2]", "#APP-INITDB/div[4]/p[3]", "#APP-INITDB/div[4]/p[4]", "#APP-INITDB/div[4]/p[5]", "#APP-INITDB/div[4]/p[6]", "#APP-INITDB/div[4]/p[7]", "#APP-INITDB/div[4]/p[8]", "#APP-INITDB/div[5]/div[1]/dl[0]/dd[11]", "#APP-INITDB/div[5]/div[1]/dl[0]/dd[13]", "#APP-INITDB/div[5]/div[1]/dl[0]/dd[15]", "#APP-INITDB/div[5]/div[1]/dl[0]/dd[17]", "#APP-INITDB/div[5]/div[1]/dl[0]/dd[19]/p[0]", "#APP-INITDB/div[5]/div[1]/dl[0]/dd[19]/p[1]", "#APP-INITDB/div[5]/div[1]/dl[0]/dd[1]/p[0]", "#APP-INITDB/div[5]/div[1]/dl[0]/dd[1]/p[1]", "#APP-INITDB/div[5]/div[1]/dl[0]/dd[1]/p[2]", "#APP-INITDB/div[5]/div[1]/dl[0]/dd[21]", "#APP-INITDB/div[5]/div[1]/dl[0]/dd[23]", "#APP-INITDB/div[5]/div[1]/dl[0]/dd[25]", "#APP-INITDB/div[5]/div[1]/dl[0]/dd[27]", "#APP-INITDB/div[5]/div[1]/dl[0]/dd[29]", "#APP-INITDB/div[5]/div[1]/dl[0]/dd[31]", "#APP-INITDB/div[5]/div[1]/dl[0]/dd[33]", "#APP-INITDB/div[5]/div[1]/dl[0]/dd[35]", "#APP-INITDB/div[5]/div[1]/dl[0]/dd[37]", "#APP-INITDB/div[5]/div[1]/dl[0]/dd[39]/p[1]", "#APP-INITDB/div[5]/div[1]/dl[0]/dd[3]", "#APP-INITDB/div[5]/div[1]/dl[0]/dd[5]", "#APP-INITDB/div[5]/div[1]/dl[0]/dd[7]", "#APP-INITDB/div[5]/div[1]/dl[0]/dd[9]/p[0]", "#APP-INITDB/div[5]/div[3]/dl[0]/dd[11]", "#APP-INITDB/div[5]/div[3]/dl[0]/dd[13]", "#APP-INITDB/div[5]/div[3]/dl[0]/dd[15]", "#APP-INITDB/div[5]/div[3]/dl[0]/dd[17]/p[0]", "#APP-INITDB/div[5]/div[3]/dl[0]/dd[17]/p[1]", "#APP-INITDB/div[5]/div[3]/dl[0]/dd[17]/p[2]", "#APP-INITDB/div[5]/div[3]/dl[0]/dd[19]", "#APP-INITDB/div[5]/div[3]/dl[0]/dd[3]", "#APP-INITDB/div[5]/div[3]/dl[0]/dd[5]", "#APP-INITDB/div[5]/div[3]/dl[0]/dd[7]", "#APP-INITDB/div[5]/div[3]/dl[0]/dd[9]", "#APP-INITDB/div[5]/div[5]/dl[0]/dd[1]", "#APP-INITDB/div[5]/div[5]/dl[0]/dd[3]", "#APP-INITDB/div[5]/p[2]", "#APP-INITDB/div[5]/p[4]", "#APP-INITDB/div[6]/div[1]/dl[0]/dd[1]", "#APP-INITDB/div[6]/div[1]/dl[0]/dd[3]", "#APP-INITDB/div[6]/div[1]/dl[0]/dd[5]", "#APP-INITDB/div[6]/h2[0]", "#APP-INITDB/div[7]/h2[0]", "#APP-INITDB/div[8]/h2[0]"]}], "language": "zh", "original_text": {"/versions/17/description/0": "initdb \u2014 create a new PostgreSQL database cluster", "/versions/17/facts/0/label": "Documented executable", "/versions/17/facts/1/label": "Executable version", "/versions/17/facts/2/label": "Reference inventory", "/versions/17/facts/2/value": "Server applications", "/versions/17/facts/3/label": "Option definition groups", "/versions/17/tables/0/title": "Documented options", "/versions/17/tables/1/title": "Environment variables", "/versions/17/tables/0/rows/0/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.", "/versions/17/tables/0/rows/1/summary": "This option specifies the authentication method for local users via TCP/IP connections used in pg_hba.conf ( host lines).", "/versions/17/tables/0/rows/2/summary": "This option specifies the authentication method for local users via Unix-domain socket connections used in pg_hba.conf ( local lines).", "/versions/17/tables/0/rows/3/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.", "/versions/17/tables/0/rows/4/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 .", "/versions/17/tables/0/rows/5/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.", "/versions/17/tables/0/rows/6/summary": "Specifies the ICU locale when the ICU provider is used. Locale support is described in Section 23.1 .", "/versions/17/tables/0/rows/7/summary": "Specifies additional collation rules to customize the behavior of the default collation. This is supported for ICU only.", "/versions/17/tables/0/rows/8/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.", "/versions/17/tables/0/rows/9/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 .", "/versions/17/tables/0/columns/0/label": "Option and arguments", "/versions/17/tables/0/columns/1/label": "Description", "/versions/17/tables/0/rows/10/summary": "Like --locale , but only sets the locale in the specified category.", "/versions/17/tables/0/rows/11/summary": "Equivalent to --locale=C .", "/versions/17/tables/0/rows/12/summary": "Specifies the locale name when the builtin provider is used. Locale support is described in Section 23.1 .", "/versions/17/tables/0/rows/13/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 ).", "/versions/17/tables/0/rows/14/summary": "Makes initdb read the bootstrap superuser's password from a file. The first line of the file is taken as the password.", "/versions/17/tables/0/rows/15/summary": "Sets the default text search configuration. See default_text_search_config for further information.", "/versions/17/tables/0/rows/16/summary": "Sets the user name of the bootstrap superuser . This defaults to the name of the operating-system user running initdb .", "/versions/17/tables/0/rows/17/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.", "/versions/17/tables/0/rows/18/summary": "This option specifies the directory where the write-ahead log should be stored.", "/versions/17/tables/0/rows/19/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.", "/versions/17/tables/0/rows/20/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.", "/versions/17/tables/0/rows/21/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.", "/versions/17/tables/0/rows/22/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.", "/versions/17/tables/0/rows/23/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.", "/versions/17/tables/0/rows/24/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.", "/versions/17/tables/0/rows/25/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.", "/versions/17/tables/0/rows/26/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.", "/versions/17/tables/0/rows/27/summary": "Show internal settings and exit, without doing anything else. This can be used to debug the initdb installation.", "/versions/17/tables/0/rows/28/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.", "/versions/17/tables/0/rows/29/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 .", "/versions/17/tables/0/rows/30/summary": "Print the initdb version and exit.", "/versions/17/tables/0/rows/31/summary": "Show help about initdb command line arguments, and exit.", "/versions/17/tables/1/columns/0/label": "Variable", "/versions/17/tables/1/columns/1/label": "Meaning", "/versions/17/tables/1/rows/0/description": "Specifies the directory where the database cluster is to be stored; can be overridden using the -D option.", "/versions/17/tables/1/rows/1/description": "Specifies whether to use color in diagnostic messages. Possible values are always , auto and never .", "/versions/17/tables/1/rows/2/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 )."}, "fallback_fields": [], "source_language": "en", "original_snapshot_sha256": "926b4a2700cbecca0200875c427ddf0c7473ac271c27522f83596aa0dd8ad426"}, "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", "manual_language": "zh"}, "18": {"facts": [{"label": "\u624b\u518c\u4e2d\u7684\u53ef\u6267\u884c\u7a0b\u5e8f", "value": "initdb"}, {"label": "\u7a0b\u5e8f\u7248\u672c", "value": "18.6"}, {"label": "\u53c2\u8003\u6e05\u5355", "value": "\u670d\u52a1\u7aef\u7a0b\u5e8f"}, {"label": "\u9009\u9879\u5b9a\u4e49\u7ec4", "value": "34"}], "tables": [{"key": "options", "rows": [{"summary": "\u8be5\u9009\u9879\u6307\u5b9a pg_hba.conf \u4e2d\u672c\u5730\u7528\u6237\u9ed8\u8ba4\u4f7f\u7528\u7684\u8ba4\u8bc1\u65b9\u6cd5\uff08 host \u548c local \u884c\uff09\u3002\u6709\u6548\u503c\u6982\u89c8\u89c1 \u7b2c 20.1 \u8282 \u3002", "signature": {"url": "/docs/18/app-initdb.html#APP-INITDB-OPTION-AUTH", "text": "-A authmethod --auth= authmethod"}}, {"summary": "\u8be5\u9009\u9879\u6307\u5b9a pg_hba.conf \u4e2d\u672c\u5730\u7528\u6237\u901a\u8fc7 TCP/IP \u8fde\u63a5\u65f6\uff08 host \u884c\uff09\u4f7f\u7528\u7684\u8ba4\u8bc1\u65b9\u6cd5\u3002", "signature": {"url": "/docs/18/app-initdb.html#APP-INITDB-OPTION-AUTH-HOST", "text": "--auth-host= authmethod"}}, {"summary": "\u8be5\u9009\u9879\u6307\u5b9a pg_hba.conf \u4e2d\u672c\u5730\u7528\u6237\u901a\u8fc7 Unix \u57df\u5957\u63a5\u5b57\u8fde\u63a5\u65f6\uff08 local \u884c\uff09\u4f7f\u7528\u7684\u8ba4\u8bc1\u65b9\u6cd5\u3002", "signature": {"url": "/docs/18/app-initdb.html#APP-INITDB-OPTION-AUTH-LOCAL", "text": "--auth-local= authmethod"}}, {"summary": "\u8be5\u9009\u9879\u6307\u5b9a\u6570\u636e\u5e93\u96c6\u7c07\u5e94\u5b58\u653e\u7684\u76ee\u5f55\u3002\u8fd9\u662f initdb \u6240\u9700\u7684\u552f\u4e00\u4fe1\u606f\uff0c\u4f46\u4e5f\u53ef\u4ee5\u901a\u8fc7\u8bbe\u7f6e PGDATA \u73af\u5883\u53d8\u91cf\u6765\u7701\u53bb\u663e\u5f0f\u5199\u51fa\u5b83\uff1b\u8fd9\u901a\u5e38\u66f4\u65b9\u4fbf\uff0c\u56e0\u4e3a\u6570\u636e\u5e93\u670d\u52a1\u5668\uff08 postgres \uff09\u4e4b\u540e\u4e5f\u53ef\u4ee5\u901a\u8fc7\u540c\u4e00\u53d8\u91cf\u627e\u5230\u6570\u636e\u76ee\u5f55\u3002", "signature": {"url": "/docs/18/app-initdb.html#APP-INITDB-OPTION-PGDATA", "text": "-D directory --pgdata= directory"}}, {"summary": "\u9009\u62e9\u6a21\u677f\u6570\u636e\u5e93\u7684\u7f16\u7801\u3002\u8fd9\u4e5f\u5c06\u6210\u4e3a\u4ee5\u540e\u521b\u5efa\u7684\u4efb\u4f55\u6570\u636e\u5e93\u7684\u9ed8\u8ba4\u7f16\u7801\uff0c\u9664\u975e\u5728\u521b\u5efa\u65f6\u8986\u76d6\u5b83\u3002 PostgreSQL \u670d\u52a1\u5668\u652f\u6301\u7684\u5b57\u7b26\u96c6\u89c1 \u7b2c 23.3.1 \u8282 \u3002", "signature": {"url": "/docs/18/app-initdb.html#APP-INITDB-OPTION-ENCODING", "text": "-E encoding --encoding= encoding"}}, {"summary": "\u5141\u8bb8\u4e0e\u96c6\u7c07\u62e5\u6709\u8005\u540c\u7ec4\u7684\u7528\u6237\u8bfb\u53d6\u7531 initdb \u521b\u5efa\u7684\u6240\u6709\u96c6\u7c07\u6587\u4ef6\u3002\u8be5\u9009\u9879\u5728 Windows \u4e0a\u4f1a\u88ab\u5ffd\u7565\uff0c\u56e0\u4e3a\u5b83\u4e0d\u652f\u6301 POSIX \u98ce\u683c\u7684\u7ec4\u6743\u9650\u3002", "signature": {"url": "/docs/18/app-initdb.html#APP-INITDB-ALLOW-GROUP-ACCESS", "text": "-g --allow-group-access"}}, {"summary": "\u5f53\u4f7f\u7528 ICU \u63d0\u4f9b\u7a0b\u5e8f\u65f6\uff0c\u6307\u5b9a ICU \u533a\u57df\u8bbe\u7f6e\u3002\u533a\u57df\u8bbe\u7f6e\u652f\u6301\u89c1 \u7b2c 23.1 \u8282 \u3002", "signature": {"url": "/docs/18/app-initdb.html#APP-INITDB-ICU-LOCALE", "text": "--icu-locale= locale"}}, {"summary": "\u6307\u5b9a\u9644\u52a0\u7684\u6392\u5e8f\u89c4\u5219\uff0c\u4ee5\u5b9a\u5236\u9ed8\u8ba4\u6392\u5e8f\u89c4\u5219\u7684\u884c\u4e3a\u3002\u8be5\u9009\u9879\u4ec5\u652f\u6301 ICU\u3002", "signature": {"url": "/docs/18/app-initdb.html#APP-INITDB-ICU-RULES", "text": "--icu-rules= rules"}}, {"summary": "\u5bf9\u6570\u636e\u9875\u542f\u7528\u6821\u9a8c\u548c\uff0c\u4ee5\u5e2e\u52a9\u68c0\u6d4b\u539f\u672c\u4f1a\u6084\u65e0\u58f0\u606f\u53d1\u751f\u7684\u3001\u7531 I/O \u7cfb\u7edf\u5bfc\u81f4\u7684\u635f\u574f\u3002\u8be5\u9879\u9ed8\u8ba4\u542f\u7528\uff1b\u4f7f\u7528 --no-data-checksums \u53ef\u7981\u7528\u6821\u9a8c\u548c\u3002", "signature": {"url": "/docs/18/app-initdb.html#APP-INITDB-DATA-CHECKSUMS", "text": "-k --data-checksums"}}, {"summary": "\u8bbe\u7f6e\u6570\u636e\u5e93\u96c6\u7c07\u7684\u9ed8\u8ba4\u533a\u57df\u8bbe\u7f6e\u3002\u5982\u679c\u672a\u6307\u5b9a\u8be5\u9009\u9879\uff0c\u533a\u57df\u8bbe\u7f6e\u5c06\u7ee7\u627f\u81ea initdb \u8fd0\u884c\u65f6\u6240\u5728\u7684\u73af\u5883\u3002\u533a\u57df\u8bbe\u7f6e\u652f\u6301\u89c1 \u7b2c 23.1 \u8282 \u3002", "signature": {"url": "/docs/18/app-initdb.html#APP-INITDB-OPTION-LOCALE", "text": "--locale= locale"}}, {"summary": "\u7c7b\u4f3c\u4e8e --locale \uff0c\u4f46\u53ea\u5728\u6307\u5b9a\u7684\u7c7b\u522b\u4e2d\u8bbe\u7f6e\u533a\u57df\u8bbe\u7f6e\u3002", "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": "\u7b49\u4ef7\u4e8e --locale=C \u3002", "signature": {"url": "/docs/18/app-initdb.html#APP-INITDB-OPTION-NO-LOCALE", "text": "--no-locale"}}, {"summary": "\u5f53\u4f7f\u7528 builtin \u63d0\u4f9b\u7a0b\u5e8f\u65f6\uff0c\u6307\u5b9a\u533a\u57df\u8bbe\u7f6e\u540d\u79f0\u3002\u533a\u57df\u8bbe\u7f6e\u652f\u6301\u89c1 \u7b2c 23.1 \u8282 \u3002", "signature": {"url": "/docs/18/app-initdb.html#APP-INITDB-BUILTIN-LOCALE", "text": "--builtin-locale= locale"}}, {"summary": "\u8be5\u9009\u9879\u8bbe\u7f6e\u65b0\u96c6\u7c07\u4e2d\u521b\u5efa\u7684\u6570\u636e\u5e93\u6240\u4f7f\u7528\u7684\u533a\u57df\u8bbe\u7f6e\u63d0\u4f9b\u7a0b\u5e8f\u3002\u540e\u7eed\u521b\u5efa\u65b0\u6570\u636e\u5e93\u65f6\uff0c\u53ef\u4ee5\u5728 CREATE DATABASE \u547d\u4ee4\u4e2d\u8986\u76d6\u5b83\u3002\u9ed8\u8ba4\u503c\u4e3a libc \uff08\u89c1 \u7b2c 23.1.4 \u8282 \uff09\u3002", "signature": {"url": "/docs/18/app-initdb.html#APP-INITDB-OPTION-LOCALE-PROVIDER", "text": "--locale-provider={ builtin | libc | icu }"}}, {"summary": "\u4e0d\u542f\u7528\u6570\u636e\u6821\u9a8c\u548c\u3002", "signature": {"url": "/docs/18/app-initdb.html#APP-INITDB-NO-DATA-CHECKSUMS", "text": "--no-data-checksums"}}, {"summary": "\u4f7f initdb \u4ece\u6587\u4ef6\u4e2d\u8bfb\u53d6\u5f15\u5bfc\u8d85\u7ea7\u7528\u6237\u7684\u5bc6\u7801\u3002\u6587\u4ef6\u7684\u7b2c\u4e00\u884c\u4f1a\u88ab\u5f53\u4f5c\u5bc6\u7801\u3002", "signature": {"url": "/docs/18/app-initdb.html#APP-INITDB-OPTION-PWFILE", "text": "--pwfile= filename"}}, {"summary": "\u8bbe\u7f6e\u9ed8\u8ba4\u6587\u672c\u68c0\u7d22\u914d\u7f6e\u3002\u66f4\u591a\u4fe1\u606f\u89c1 default_text_search_config \u3002", "signature": {"url": "/docs/18/app-initdb.html#APP-INITDB-OPTION-TEXT-SEARCH-CONFIG", "text": "-T config --text-search-config= config"}}, {"summary": "\u8bbe\u7f6e \u5f15\u5bfc\u8d85\u7ea7\u7528\u6237 \u7684\u7528\u6237\u540d\u3002\u9ed8\u8ba4\u503c\u662f\u8fd0\u884c initdb \u7684\u64cd\u4f5c\u7cfb\u7edf\u7528\u6237\u540d\u3002", "signature": {"url": "/docs/18/app-initdb.html#APP-INITDB-OPTION-USERNAME", "text": "-U username --username= username"}}, {"summary": "\u4f7f initdb \u63d0\u793a\u8f93\u5165\u8981\u8d4b\u7ed9\u5f15\u5bfc\u8d85\u7ea7\u7528\u6237\u7684\u5bc6\u7801\u3002\u5982\u679c\u4e0d\u6253\u7b97\u4f7f\u7528\u5bc6\u7801\u8ba4\u8bc1\uff0c\u8fd9\u4e00\u70b9\u5e76\u4e0d\u91cd\u8981\u3002\u5426\u5219\uff0c\u5728\u8bbe\u7f6e\u5bc6\u7801\u4e4b\u524d\u5c06\u65e0\u6cd5\u4f7f\u7528\u5bc6\u7801\u8ba4\u8bc1\u3002", "signature": {"url": "/docs/18/app-initdb.html#APP-INITDB-OPTION-PWPROMPT", "text": "-W --pwprompt"}}, {"summary": "\u8be5\u9009\u9879\u6307\u5b9a\u9884\u5199\u5f0f\u65e5\u5fd7\uff08WAL\uff09\u5e94\u5b58\u653e\u7684\u76ee\u5f55\u3002", "signature": {"url": "/docs/18/app-initdb.html#APP-INITDB-OPTION-WALDIR", "text": "-X directory --waldir= directory"}}, {"summary": "\u8bbe\u7f6e WAL \u6bb5\u5927\u5c0f\uff0c\u5355\u4f4d\u4e3a\u5146\u5b57\u8282\u3002\u8fd9\u662f WAL \u65e5\u5fd7\u4e2d\u6bcf\u4e2a\u72ec\u7acb\u6587\u4ef6\u7684\u5927\u5c0f\u3002\u9ed8\u8ba4\u5927\u5c0f\u4e3a 16 \u5146\u5b57\u8282\u3002\u53d6\u503c\u5fc5\u987b\u662f 1 \u5230 1024\uff08\u5146\u5b57\u8282\uff09\u4e4b\u95f4\u7684 2 \u7684\u5e42\u3002\u6b64\u9009\u9879\u53ea\u80fd\u5728\u521d\u59cb\u5316\u65f6\u8bbe\u7f6e\uff0c\u4e4b\u540e\u65e0\u6cd5\u66f4\u6539\u3002", "signature": {"url": "/docs/18/app-initdb.html#APP-INITDB-OPTION-WAL-SEGSIZE", "text": "--wal-segsize= size"}}, {"summary": "\u5728 initdb \u671f\u95f4\u5f3a\u5236\u5c06\u670d\u52a1\u5668\u53c2\u6570 name \u8bbe\u4e3a value\uff0c\u5e76\u628a\u8be5\u8bbe\u7f6e\u5199\u5165\u751f\u6210\u7684 postgresql.conf \u6587\u4ef6\uff0c\u4f7f\u5176\u5728\u4e4b\u540e\u7684\u670d\u52a1\u5668\u8fd0\u884c\u4e2d\u4e5f\u751f\u6548\u3002\u6b64\u9009\u9879\u53ef\u591a\u6b21\u4f7f\u7528\uff0c\u4ee5\u8bbe\u7f6e\u591a\u4e2a\u53c2\u6570\u3002\u5b83\u4e3b\u8981\u7528\u4e8e\u73af\u5883\u6761\u4ef6\u5bfc\u81f4\u670d\u52a1\u5668\u5b8c\u5168\u65e0\u6cd5\u4f7f\u7528\u9ed8\u8ba4\u53c2\u6570\u542f\u52a8\u7684\u60c5\u51b5\u3002", "signature": {"url": "/docs/18/app-initdb.html#APP-INITDB-OPTION-SET", "text": "-c name = value --set name = value"}}, {"summary": "\u6253\u5370\u5f15\u5bfc\u540e\u7aef\u7684\u8c03\u8bd5\u8f93\u51fa\uff0c\u4ee5\u53ca\u5c11\u91cf\u666e\u901a\u7528\u6237\u901a\u5e38\u4e0d\u611f\u5174\u8da3\u7684\u5176\u4ed6\u6d88\u606f\u3002\u5f15\u5bfc\u540e\u7aef\u662f initdb \u7528\u6765\u521b\u5efa\u7cfb\u7edf\u76ee\u5f55\u8868\u7684\u7a0b\u5e8f\u3002\u8be5\u9009\u9879\u4f1a\u4ea7\u751f\u5927\u91cf\u6781\u5176\u4e4f\u5473\u7684\u8f93\u51fa\u3002", "signature": {"url": "/docs/18/app-initdb.html#APP-INITDB-OPTION-DEBUG", "text": "-d --debug"}}, {"summary": "\u4f7f\u7528 debug_discard_caches=1 \u9009\u9879\u8fd0\u884c\u5f15\u5bfc\u540e\u7aef\u3002\u8fd9\u4f1a\u82b1\u8d39\u5f88\u957f\u65f6\u95f4\uff0c\u53ea\u5bf9\u6df1\u5ea6\u8c03\u8bd5\u6709\u7528\u3002", "signature": {"url": "/docs/18/app-initdb.html#APP-INITDB-OPTION-DISCARD-CACHES", "text": "--discard-caches"}}, {"summary": "\u6307\u5b9a initdb \u521d\u59cb\u5316\u6570\u636e\u5e93\u96c6\u7c07\u65f6\u5e94\u5230\u54ea\u91cc\u67e5\u627e\u5176\u8f93\u5165\u6587\u4ef6\u3002\u901a\u5e38\u4e0d\u9700\u8981\u8fd9\u6837\u505a\u3002\u82e5\u9700\u8981\u663e\u5f0f\u6307\u5b9a\u5176\u4f4d\u7f6e\uff0c\u7cfb\u7edf\u4f1a\u63d0\u793a\u3002", "signature": {"url": "/docs/18/app-initdb.html#APP-INITDB-OPTION-L", "text": "-L directory"}}, {"summary": "\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c\u5982\u679c initdb \u53d1\u73b0\u67d0\u4e2a\u9519\u8bef\u4f7f\u5176\u65e0\u6cd5\u5b8c\u6574\u521b\u5efa\u6570\u636e\u5e93\u96c6\u7c07\uff0c\u5c31\u4f1a\u5220\u9664\u5b83\u5728\u53d1\u73b0\u65e0\u6cd5\u5b8c\u6210\u4efb\u52a1\u4e4b\u524d\u53ef\u80fd\u5df2\u521b\u5efa\u7684\u6240\u6709\u6587\u4ef6\u3002\u8be5\u9009\u9879\u4f1a\u7981\u6b62\u8fd9\u79cd\u6e05\u7406\uff0c\u56e0\u6b64\u5bf9\u8c03\u8bd5\u6709\u7528\u3002", "signature": {"url": "/docs/18/app-initdb.html#APP-INITDB-OPTION-NO-CLEAN", "text": "-n --no-clean"}}, {"summary": "\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c initdb \u4f1a\u7b49\u5f85\u6240\u6709\u6587\u4ef6\u90fd\u5b89\u5168\u5199\u5165\u78c1\u76d8\u3002\u8be5\u9009\u9879\u4f7f initdb \u5728\u4e0d\u7b49\u5f85\u7684\u60c5\u51b5\u4e0b\u8fd4\u56de\uff0c\u901f\u5ea6\u66f4\u5feb\uff0c\u4f46\u8fd9\u610f\u5473\u7740\u5982\u679c\u540e\u7eed\u64cd\u4f5c\u7cfb\u7edf\u5d29\u6e83\uff0c\u6570\u636e\u76ee\u5f55\u53ef\u80fd\u4f1a\u635f\u574f\u3002\u901a\u5e38\uff0c\u8be5\u9009\u9879\u9002\u7528\u4e8e\u6d4b\u8bd5\uff0c\u4f46\u4e0d\u5e94\u7528\u4e8e\u521b\u5efa\u751f\u4ea7\u73af\u5883\u5b89\u88c5\u3002", "signature": {"url": "/docs/18/app-initdb.html#APP-INITDB-OPTION-NO-SYNC", "text": "-N --no-sync"}}, {"summary": "\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c initdb \u4f1a\u5c06\u6240\u6709\u6570\u636e\u5e93\u6587\u4ef6\u5b89\u5168\u5730\u5199\u5165\u78c1\u76d8\u3002\u8be5\u9009\u9879\u6307\u793a initdb \u8df3\u8fc7\u540c\u6b65\u5404\u4e2a\u6570\u636e\u5e93\u76ee\u5f55\u4e2d\u7684\u6240\u6709\u6587\u4ef6\u3001\u8fd9\u4e9b\u6570\u636e\u5e93\u76ee\u5f55\u672c\u8eab\u4ee5\u53ca\u8868\u7a7a\u95f4\u76ee\u5f55\uff0c\u4e5f\u5c31\u662f base \u5b50\u76ee\u5f55\u4e2d\u7684\u6240\u6709\u5185\u5bb9\u548c\u4efb\u4f55\u5176\u4ed6\u8868\u7a7a\u95f4\u76ee\u5f55\u3002\u5176\u4ed6\u6587\u4ef6\uff0c\u4f8b\u5982 pg_wal \u548c pg_xact \u4e2d\u7684\u6587\u4ef6\uff0c\u4ecd\u4f1a\u88ab\u540c\u6b65\uff0c\u9664\u975e\u4e5f\u6307\u5b9a\u4e86 --no-sync \u3002", "signature": {"url": "/docs/18/app-initdb.html#APP-INITDB-OPTION-NO-SYNC-DATA-FILES", "text": "--no-sync-data-files"}}, {"summary": "\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c initdb \u4f1a\u5728\u5176\u8f93\u51fa\u672b\u5c3e\u5199\u51fa\u5982\u4f55\u542f\u52a8\u96c6\u7c07\u7684\u8bf4\u660e\u3002\u8be5\u9009\u9879\u4f1a\u7701\u7565\u8fd9\u4e9b\u8bf4\u660e\u3002\u5b83\u4e3b\u8981\u4f9b\u90a3\u4e9b\u5bf9 initdb \u8fdb\u884c\u5e73\u53f0\u7279\u5b9a\u5c01\u88c5\u7684\u5de5\u5177\u4f7f\u7528\uff0c\u56e0\u4e3a\u5728\u8fd9\u79cd\u60c5\u51b5\u4e0b\u90a3\u4e9b\u8bf4\u660e\u5f88\u53ef\u80fd\u5e76\u4e0d\u6b63\u786e\u3002", "signature": {"url": "/docs/18/app-initdb.html#APP-INITDB-OPTION-NO-INSTRUCTIONS", "text": "--no-instructions"}}, {"summary": "\u663e\u793a\u5185\u90e8\u8bbe\u7f6e\u5e76\u9000\u51fa\uff0c\u4e0d\u6267\u884c\u5176\u4ed6\u64cd\u4f5c\u3002\u53ef\u7528\u4e8e\u8c03\u8bd5 initdb \u7684\u5b89\u88c5\u3002", "signature": {"url": "/docs/18/app-initdb.html#APP-INITDB-OPTION-SHOW", "text": "-s --show"}}, {"summary": "\u8bbe\u4e3a fsync \uff08\u9ed8\u8ba4\u503c\uff09\u65f6\uff0c initdb \u4f1a\u9012\u5f52\u6253\u5f00\u5e76\u540c\u6b65\u6570\u636e\u76ee\u5f55\u4e2d\u7684\u6240\u6709\u6587\u4ef6\u3002\u67e5\u627e\u6587\u4ef6\u65f6\u4f1a\u8ddf\u968f WAL \u76ee\u5f55\u548c\u6bcf\u4e2a\u5df2\u914d\u7f6e\u8868\u7a7a\u95f4\u7684\u7b26\u53f7\u94fe\u63a5\u3002", "signature": {"url": "/docs/18/app-initdb.html#APP-INITDB-OPTION-SYNC-METHOD", "text": "--sync-method= method"}}, {"summary": "\u5c06\u6240\u6709\u6570\u636e\u5e93\u6587\u4ef6\u5b89\u5168\u5730\u5199\u5165\u78c1\u76d8\u5e76\u9000\u51fa\u3002\u8fd9\u4e0d\u4f1a\u6267\u884c\u4efb\u4f55\u5e38\u89c4\u7684 initdb \u64cd\u4f5c\u3002\u901a\u5e38\uff0c\u8be5\u9009\u9879\u53ef\u7528\u4e8e\u5728\u5c06 fsync \u4ece off \u6539\u4e3a on \u540e\uff0c\u786e\u4fdd\u80fd\u591f\u53ef\u9760\u6062\u590d\u3002", "signature": {"url": "/docs/18/app-initdb.html#APP-INITDB-OPTION-SYNC-ONLY", "text": "-S --sync-only"}}, {"summary": "\u6253\u5370 initdb \u7248\u672c\u5e76\u9000\u51fa\u3002", "signature": {"url": "/docs/18/app-initdb.html#APP-INITDB-OPTION-VERSION", "text": "-V --version"}}, {"summary": "\u663e\u793a\u6709\u5173 initdb \u547d\u4ee4\u884c\u53c2\u6570\u7684\u5e2e\u52a9\u5e76\u9000\u51fa\u3002", "signature": {"url": "/docs/18/app-initdb.html#APP-INITDB-OPTION-HELP", "text": "-? --help"}}], "title": "\u624b\u518c\u4e2d\u7684\u9009\u9879", "columns": [{"key": "signature", "label": "\u9009\u9879\u4e0e\u53c2\u6570"}, {"key": "summary", "label": "\u8bf4\u660e"}]}, {"key": "environment", "rows": [{"name": "PGDATA", "description": "\u6307\u5b9a\u6570\u636e\u5e93\u96c6\u7c07\u5e94\u5b58\u653e\u7684\u76ee\u5f55\uff1b\u53ef\u4f7f\u7528 -D \u9009\u9879\u8986\u76d6\u3002"}, {"name": "PG_COLOR", "description": "\u6307\u5b9a\u8bca\u65ad\u6d88\u606f\u662f\u5426\u4f7f\u7528\u989c\u8272\u3002\u53ef\u9009\u503c\u4e3a always \u3001 auto \u548c never \u3002"}, {"name": "TZ", "description": "\u6307\u5b9a\u6240\u521b\u5efa\u6570\u636e\u5e93\u96c6\u7c07\u7684\u9ed8\u8ba4\u65f6\u533a\u3002\u8be5\u503c\u5e94\u4e3a\u5b8c\u6574\u7684\u65f6\u533a\u540d\u79f0\uff08\u89c1 \u7b2c 8.5.3 \u8282 \uff09\u3002"}], "title": "\u73af\u5883\u53d8\u91cf", "columns": [{"key": "name", "label": "\u53d8\u91cf"}, {"key": "description", "label": "\u542b\u4e49"}]}], "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": "https://pg.center/docs/18/app-initdb.html", "file": "app-initdb.html", "label": "18.6 English manual \u00b7 app-initdb.html", "anchor": "", "sha256": "ca8245d2c61740de3b11df2b81993b18e311705e2c23bebfa7cafda1bcd15321", "language": "en", "original_url": "/docs/18/app-initdb.html"}, {"url": "https://pg.center/docs/18/reference-server.html", "file": "reference-server.html", "label": "Server applications inventory", "anchor": "", "sha256": "e9f8bbcc8e3641fadd1d20991e8aad6b532155b786ba5a1b7b364ec4f1a5bef3", "language": "en", "original_url": "/docs/18/reference-server.html"}], "sections": [], "synopsis": ["initdb [ option ...] [ --pgdata | -D ] directory"], "signature": "initdb [ option ...] [ --pgdata | -D ] directory", "description": ["initdb \u2014 \u521b\u5efa\u4e00\u4e2a\u65b0\u7684 PostgreSQL \u6570\u636e\u5e93\u96c6\u7c07"], "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 lang=\"zh\">initdb \u2014 \u521b\u5efa\u4e00\u4e2a\u65b0\u7684<span class=\"productname\">PostgreSQL</span>\u6570\u636e\u5e93\u96c6\u7c07</p>\n</div>\n<div class=\"refsynopsisdiv\">\n<h2 lang=\"zh\">\u5927\u7eb2</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 lang=\"zh\">\u8bf4\u660e</h2>\n<p lang=\"zh\"><code class=\"command\">initdb</code>\u521b\u5efa\u4e00\u4e2a\u65b0\u7684<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=\"\u6570\u636e\u5e93\u96c6\u7c07\">\u6570\u636e\u5e93\u96c6\u7c07</a>\u3002</p>\n<p lang=\"zh\">\u521b\u5efa\u6570\u636e\u5e93\u96c6\u7c07\u5305\u62ec\u521b\u5efa\u7528\u4e8e\u5b58\u653e\u96c6\u7c07\u6570\u636e\u7684<a class=\"glossterm\" href=\"/docs/18/glossary.html#GLOSSARY-DATA-DIRECTORY\"></a><a class=\"glossterm\" href=\"/docs/18/glossary.html#GLOSSARY-DATA-DIRECTORY\" title=\"\u6570\u636e\u76ee\u5f55\">\u76ee\u5f55</a>\uff0c\u751f\u6210\u5171\u4eab\u7cfb\u7edf\u76ee\u5f55\u8868\uff08\u5c5e\u4e8e\u6574\u4e2a\u96c6\u7c07\u800c\u4e0d\u662f\u67d0\u4e2a\u7279\u5b9a\u6570\u636e\u5e93\u7684\u8868\uff09\uff0c\u4ee5\u53ca\u521b\u5efa <code class=\"literal\">postgres</code>\u3001<code class=\"literal\">template1</code> \u548c <code class=\"literal\">template0</code> \u6570\u636e\u5e93\u3002<code class=\"literal\">postgres</code> \u6570\u636e\u5e93\u662f\u4e00\u4e2a\u9ed8\u8ba4\u6570\u636e\u5e93\uff0c\u4f9b\u7528\u6237\u3001\u5de5\u5177\u7a0b\u5e8f\u548c\u7b2c\u4e09\u65b9\u5e94\u7528\u7a0b\u5e8f\u4f7f\u7528\u3002<code class=\"literal\">template1</code> \u548c <code class=\"literal\">template0</code> \u7528\u4f5c\u540e\u7eed<code class=\"command\">CREATE DATABASE</code>\u547d\u4ee4\u590d\u5236\u7684\u6e90\u6570\u636e\u5e93\u3002<code class=\"literal\">template0</code> \u4e0d\u5e94\u88ab\u4fee\u6539\uff0c\u4f46\u53ef\u4ee5\u5411 <code class=\"literal\">template1</code> \u4e2d\u6dfb\u52a0\u5bf9\u8c61\uff0c\u8fd9\u4e9b\u5bf9\u8c61\u9ed8\u8ba4\u4f1a\u88ab\u590d\u5236\u5230\u4ee5\u540e\u521b\u5efa\u7684\u6570\u636e\u5e93\u4e2d\u3002\u66f4\u591a\u7ec6\u8282\u89c1<a class=\"xref\" href=\"/docs/18/manage-ag-templatedbs.html\" title=\"22.3.\u00a0\u6a21\u677f\u6570\u636e\u5e93\">\u7b2c\u00a022.3\u00a0\u8282</a>\u3002</p>\n<p lang=\"zh\">\u867d\u7136<code class=\"command\">initdb</code>\u4f1a\u5c1d\u8bd5\u521b\u5efa\u6307\u5b9a\u7684\u6570\u636e\u76ee\u5f55\uff0c\u4f46\u5982\u679c\u6240\u9700\u6570\u636e\u76ee\u5f55\u7684\u7236\u76ee\u5f55\u5f52 root \u6240\u6709\uff0c\u5b83\u53ef\u80fd\u6ca1\u6709\u8db3\u591f\u7684\u6743\u9650\u3002\u8981\u5728\u8fd9\u79cd\u73af\u5883\u4e2d\u521d\u59cb\u5316\uff0c\u53ef\u5148\u7531 root \u521b\u5efa\u4e00\u4e2a\u7a7a\u7684\u6570\u636e\u76ee\u5f55\uff0c\u7136\u540e\u7528<code class=\"command\">chown</code>\u5c06\u8be5\u76ee\u5f55\u7684\u6240\u6709\u6743\u8d4b\u4e88\u6570\u636e\u5e93\u7528\u6237\u8d26\u6237\uff0c\u518d\u7528 <code class=\"command\">su</code>\u5207\u6362\u4e3a\u8be5\u6570\u636e\u5e93\u7528\u6237\u6765\u8fd0\u884c<code class=\"command\">initdb</code>\u3002</p>\n<p lang=\"zh\"><code class=\"command\">initdb</code>\u5fc5\u987b\u4ee5\u5c06\u62e5\u6709\u670d\u52a1\u5668\u8fdb\u7a0b\u7684\u7528\u6237\u8eab\u4efd\u8fd0\u884c\uff0c\u56e0\u4e3a\u670d\u52a1\u5668\u9700\u8981\u8bbf\u95ee <code class=\"command\">initdb</code>\u521b\u5efa\u7684\u6587\u4ef6\u548c\u76ee\u5f55\u3002\u7531\u4e8e\u670d\u52a1\u5668\u4e0d\u80fd\u4ee5 root \u8eab\u4efd\u8fd0\u884c\uff0c\u56e0\u6b64\u4e5f\u7edd\u4e0d\u80fd\u4ee5 root \u8eab\u4efd\u8fd0\u884c<code class=\"command\">initdb</code>\u3002\uff08\u5b9e\u9645\u4e0a\u5b83\u4f1a\u62d2\u7edd\u8fd9\u6837\u505a\u3002\uff09</p>\n<p lang=\"zh\">\u51fa\u4e8e\u5b89\u5168\u539f\u56e0\uff0c<code class=\"command\">initdb</code>\u521b\u5efa\u7684\u65b0\u96c6\u7c07\u9ed8\u8ba4\u53ea\u6709\u96c6\u7c07\u62e5\u6709\u8005\u53ef\u4ee5\u8bbf\u95ee\u3002<code class=\"option\">--allow-group-access</code> \u9009\u9879\u5141\u8bb8\u4e0e\u96c6\u7c07\u62e5\u6709\u8005\u540c\u7ec4\u7684\u4efb\u4f55\u7528\u6237\u8bfb\u53d6\u96c6\u7c07\u4e2d\u7684\u6587\u4ef6\u3002\u8fd9\u5bf9\u7531\u975e\u7279\u6743\u7528\u6237\u6267\u884c\u5907\u4efd\u5f88\u6709\u7528\u3002</p>\n<p lang=\"zh\"><code class=\"command\">initdb</code>\u4f1a\u521d\u59cb\u5316\u6570\u636e\u5e93\u96c6\u7c07\u7684\u9ed8\u8ba4\u533a\u57df\u8bbe\u7f6e\u548c\u5b57\u7b26\u96c6\u7f16\u7801\u3002\u8fd9\u4e9b\u8bbe\u7f6e\u4e5f\u53ef\u4ee5\u5728\u521b\u5efa\u6bcf\u4e2a\u6570\u636e\u5e93\u65f6\u5206\u522b\u8bbe\u7f6e\u3002<code class=\"command\">initdb</code>\u4e3a\u6a21\u677f\u6570\u636e\u5e93\u786e\u5b9a\u8fd9\u4e9b\u8bbe\u7f6e\uff0c\u5b83\u4eec\u5c06\u4f5c\u4e3a\u6240\u6709\u5176\u4ed6\u6570\u636e\u5e93\u7684\u9ed8\u8ba4\u503c\u3002</p>\n<p lang=\"zh\">\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c<code class=\"command\">initdb</code>\u4f7f\u7528<code class=\"literal\">libc</code>\u533a\u57df\u8bbe\u7f6e\u63d0\u4f9b\u7a0b\u5e8f\uff08\u89c1<a class=\"xref\" href=\"/docs/18/locale.html#LOCALE-PROVIDERS\" title=\"23.1.4.\u00a0\u533a\u57df\u8bbe\u7f6e\u63d0\u4f9b\u7a0b\u5e8f\">\u7b2c\u00a023.1.4\u00a0\u8282</a>\uff09\u3002<code class=\"literal\">libc</code>\u533a\u57df\u8bbe\u7f6e\u63d0\u4f9b\u7a0b\u5e8f\u4f1a\u4ece\u73af\u5883\u4e2d\u83b7\u53d6\u533a\u57df\u8bbe\u7f6e\uff0c\u5e76\u6839\u636e\u533a\u57df\u8bbe\u7f6e\u786e\u5b9a\u7f16\u7801\u3002</p>\n<p lang=\"zh\">\u8981\u4e3a\u96c6\u7c07\u9009\u62e9\u4e0d\u540c\u7684\u533a\u57df\u8bbe\u7f6e\uff0c\u8bf7\u4f7f\u7528<code class=\"option\">--locale</code>\u3002\u6b64\u5916\u8fd8\u6709\u5355\u72ec\u7684 <code class=\"option\">--lc-*</code> \u548c <code class=\"option\">--icu-locale</code> \u9009\u9879\uff08\u89c1\u4e0b\u6587\uff09\uff0c\u7528\u4e8e\u4e3a\u5404\u4e2a\u533a\u57df\u8bbe\u7f6e\u7c7b\u522b\u8bbe\u7f6e\u503c\u3002\u8bf7\u6ce8\u610f\uff0c\u4e0d\u540c\u533a\u57df\u8bbe\u7f6e\u7c7b\u522b\u4e4b\u95f4\u82e5\u8bbe\u7f6e\u4e0d\u4e00\u81f4\uff0c\u53ef\u80fd\u4ea7\u751f\u4e0d\u5408\u7406\u7684\u7ed3\u679c\uff0c\u56e0\u6b64\u5e94\u8c28\u614e\u4f7f\u7528\u3002</p>\n<p lang=\"zh\">\u4e5f\u53ef\u4ee5\u6307\u5b9a --locale-provider=icu\uff0c\u8ba9 initdb \u4f7f\u7528 ICU \u5e93\u63d0\u4f9b\u533a\u57df\u8bbe\u7f6e\u670d\u52a1\u3002\u670d\u52a1\u5668\u5fc5\u987b\u5728\u6784\u5efa\u65f6\u542f\u7528 ICU \u652f\u6301\u3002\u4f7f\u7528 --icu-locale \u9009\u9879\u9009\u62e9\u5177\u4f53\u7684 ICU \u533a\u57df ID\u3002\u6ce8\u610f\uff0c\u51fa\u4e8e\u5b9e\u73b0\u65b9\u9762\u7684\u539f\u56e0\u4ee5\u53ca\u5bf9\u65e7\u4ee3\u7801\u7684\u517c\u5bb9\uff0c\u5373\u4f7f\u4f7f\u7528 ICU \u533a\u57df\u8bbe\u7f6e\u63d0\u4f9b\u8005\uff0cinitdb \u4ecd\u4f1a\u9009\u62e9\u5e76\u521d\u59cb\u5316 libc \u533a\u57df\u8bbe\u7f6e\u3002</p>\n<p lang=\"zh\"><code class=\"command\">initdb</code>\u8fd0\u884c\u65f6\u4f1a\u6253\u5370\u51fa\u5b83\u9009\u62e9\u7684\u533a\u57df\u8bbe\u7f6e\u3002\u5982\u679c\u6709\u590d\u6742\u9700\u6c42\u6216\u8005\u6307\u5b9a\u4e86\u591a\u4e2a\u9009\u9879\uff0c\u5efa\u8bae\u68c0\u67e5\u7ed3\u679c\u662f\u5426\u7b26\u5408\u9884\u671f\u3002</p>\n<p lang=\"zh\">\u6709\u5173\u533a\u57df\u8bbe\u7f6e\u7684\u66f4\u591a\u7ec6\u8282\u89c1<a class=\"xref\" href=\"/docs/18/locale.html\" title=\"23.1.\u00a0\u533a\u57df\u8bbe\u7f6e\u652f\u6301\">\u7b2c\u00a023.1\u00a0\u8282</a>\u3002</p>\n<p lang=\"zh\">\u8981\u4fee\u6539\u9ed8\u8ba4\u7f16\u7801\uff0c\u8bf7\u4f7f\u7528<code class=\"option\">--encoding</code>\u3002\u66f4\u591a\u7ec6\u8282\u89c1<a class=\"xref\" href=\"/docs/18/multibyte.html\" title=\"23.3.\u00a0\u5b57\u7b26\u96c6\u652f\u6301\">\u7b2c\u00a023.3\u00a0\u8282</a>\u3002</p>\n</div>\n<div class=\"refsect1\" id=\"id-1.9.5.3.6\">\n<h2 lang=\"zh\">\u9009\u9879</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 lang=\"zh\">\u8be5\u9009\u9879\u6307\u5b9a<code class=\"filename\">pg_hba.conf</code>\u4e2d\u672c\u5730\u7528\u6237\u9ed8\u8ba4\u4f7f\u7528\u7684\u8ba4\u8bc1\u65b9\u6cd5\uff08<code class=\"literal\">host</code> \u548c <code class=\"literal\">local</code> \u884c\uff09\u3002\u6709\u6548\u503c\u6982\u89c8\u89c1<a class=\"xref\" href=\"/docs/18/auth-pg-hba-conf.html\" title=\"20.1.\u00a0pg_hba.conf \u6587\u4ef6\">\u7b2c\u00a020.1\u00a0\u8282</a>\u3002</p>\n<p lang=\"zh\"><code class=\"command\">initdb</code>\u4f1a\u4f7f\u7528\u6307\u5b9a\u7684\u8ba4\u8bc1\u65b9\u6cd5\u9884\u586b\u5145<code class=\"filename\">pg_hba.conf</code> \u6761\u76ee\uff0c\u65e2\u7528\u4e8e\u975e\u590d\u5236\u8fde\u63a5\uff0c\u4e5f\u7528\u4e8e\u590d\u5236\u8fde\u63a5\u3002</p>\n<p lang=\"zh\">\u9664\u975e\u4fe1\u4efb\u7cfb\u7edf\u4e0a\u7684\u6240\u6709\u672c\u5730\u7528\u6237\uff0c\u5426\u5219\u4e0d\u8981\u4f7f\u7528<code class=\"literal\">trust</code>\u3002\u4e3a\u4e86\u4fbf\u4e8e\u5b89\u88c5\uff0c\u9ed8\u8ba4\u4f7f\u7528<code class=\"literal\">trust</code>\u3002</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 lang=\"zh\">\n<p>\u8be5\u9009\u9879\u6307\u5b9a<code class=\"filename\">pg_hba.conf</code>\u4e2d\u672c\u5730\u7528\u6237\u901a\u8fc7 TCP/IP \u8fde\u63a5\u65f6\uff08<code class=\"literal\">host</code> \u884c\uff09\u4f7f\u7528\u7684\u8ba4\u8bc1\u65b9\u6cd5\u3002</p>\n</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 lang=\"zh\">\n<p>\u8be5\u9009\u9879\u6307\u5b9a<code class=\"filename\">pg_hba.conf</code>\u4e2d\u672c\u5730\u7528\u6237\u901a\u8fc7 Unix \u57df\u5957\u63a5\u5b57\u8fde\u63a5\u65f6\uff08<code class=\"literal\">local</code> \u884c\uff09\u4f7f\u7528\u7684\u8ba4\u8bc1\u65b9\u6cd5\u3002</p>\n</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 lang=\"zh\">\n<p>\u8be5\u9009\u9879\u6307\u5b9a\u6570\u636e\u5e93\u96c6\u7c07\u5e94\u5b58\u653e\u7684\u76ee\u5f55\u3002\u8fd9\u662f<code class=\"command\">initdb</code>\u6240\u9700\u7684\u552f\u4e00\u4fe1\u606f\uff0c\u4f46\u4e5f\u53ef\u4ee5\u901a\u8fc7\u8bbe\u7f6e<code class=\"envar\">PGDATA</code>\u73af\u5883\u53d8\u91cf\u6765\u7701\u53bb\u663e\u5f0f\u5199\u51fa\u5b83\uff1b\u8fd9\u901a\u5e38\u66f4\u65b9\u4fbf\uff0c\u56e0\u4e3a\u6570\u636e\u5e93\u670d\u52a1\u5668\uff08<code class=\"command\">postgres</code>\uff09\u4e4b\u540e\u4e5f\u53ef\u4ee5\u901a\u8fc7\u540c\u4e00\u53d8\u91cf\u627e\u5230\u6570\u636e\u76ee\u5f55\u3002</p>\n</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 lang=\"zh\">\u9009\u62e9\u6a21\u677f\u6570\u636e\u5e93\u7684\u7f16\u7801\u3002\u8fd9\u4e5f\u5c06\u6210\u4e3a\u4ee5\u540e\u521b\u5efa\u7684\u4efb\u4f55\u6570\u636e\u5e93\u7684\u9ed8\u8ba4\u7f16\u7801\uff0c\u9664\u975e\u5728\u521b\u5efa\u65f6\u8986\u76d6\u5b83\u3002<span class=\"productname\">PostgreSQL</span>\u670d\u52a1\u5668\u652f\u6301\u7684\u5b57\u7b26\u96c6\u89c1<a class=\"xref\" href=\"/docs/18/multibyte.html#MULTIBYTE-CHARSET-SUPPORTED\" title=\"23.3.1.\u00a0\u652f\u6301\u7684\u5b57\u7b26\u96c6\">\u7b2c\u00a023.3.1\u00a0\u8282</a>\u3002</p>\n<p lang=\"zh\">\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c\u6a21\u677f\u6570\u636e\u5e93\u7684\u7f16\u7801\u7531\u533a\u57df\u8bbe\u7f6e\u51b3\u5b9a\u3002\u5982\u679c\u6307\u5b9a --no-locale\uff08\u6216\u7b49\u4ef7\u5730\u5c06\u533a\u57df\u8bbe\u7f6e\u8bbe\u4e3a C \u6216 POSIX\uff09\uff0c\u5219 ICU \u63d0\u4f9b\u8005\u7684\u9ed8\u8ba4\u7f16\u7801\u4e3a UTF8\uff0clibc \u63d0\u4f9b\u8005\u7684\u9ed8\u8ba4\u7f16\u7801\u4e3a SQL_ASCII\u3002</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 lang=\"zh\">\u5141\u8bb8\u4e0e\u96c6\u7fa4\u6240\u6709\u8005\u540c\u7ec4\u7684\u7528\u6237\u8bfb\u53d6 initdb \u521b\u5efa\u7684\u6240\u6709\u96c6\u7fa4\u6587\u4ef6\u3002Windows \u4e0d\u652f\u6301 POSIX \u98ce\u683c\u7684\u7ec4\u6743\u9650\uff0c\u56e0\u6b64\u4f1a\u5ffd\u7565\u6b64\u9009\u9879\u3002</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 lang=\"zh\">\n<p>\u5f53\u4f7f\u7528 ICU \u63d0\u4f9b\u7a0b\u5e8f\u65f6\uff0c\u6307\u5b9a ICU \u533a\u57df\u8bbe\u7f6e\u3002\u533a\u57df\u8bbe\u7f6e\u652f\u6301\u89c1<a class=\"xref\" href=\"/docs/18/locale.html\" title=\"23.1.\u00a0\u533a\u57df\u8bbe\u7f6e\u652f\u6301\">\u7b2c\u00a023.1\u00a0\u8282</a>\u3002</p>\n</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 lang=\"zh\">\n<p>\u6307\u5b9a\u9644\u52a0\u7684\u6392\u5e8f\u89c4\u5219\uff0c\u4ee5\u5b9a\u5236\u9ed8\u8ba4\u6392\u5e8f\u89c4\u5219\u7684\u884c\u4e3a\u3002\u8be5\u9009\u9879\u4ec5\u652f\u6301 ICU\u3002</p>\n</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 lang=\"zh\">\u5bf9\u6570\u636e\u9875\u542f\u7528\u6821\u9a8c\u548c\uff0c\u4ee5\u5e2e\u52a9\u68c0\u6d4b\u539f\u672c\u4f1a\u6084\u65e0\u58f0\u606f\u53d1\u751f\u7684\u3001\u7531 I/O \u7cfb\u7edf\u5bfc\u81f4\u7684\u635f\u574f\u3002\u8be5\u9879\u9ed8\u8ba4\u542f\u7528\uff1b\u4f7f\u7528<a class=\"xref\" href=\"/docs/18/app-initdb.html#APP-INITDB-NO-DATA-CHECKSUMS\"><code class=\"option\">--no-data-checksums</code></a>\u53ef\u7981\u7528\u6821\u9a8c\u548c\u3002</p>\n<p lang=\"zh\">\u542f\u7528\u6821\u9a8c\u548c\u53ef\u80fd\u4f1a\u5e26\u6765\u5c0f\u5e45\u6027\u80fd\u635f\u5931\u3002\u5982\u679c\u542f\u7528\uff0c\u5c31\u4f1a\u4e3a\u6240\u6709\u6570\u636e\u5e93\u4e2d\u7684\u6240\u6709\u5bf9\u8c61\u8ba1\u7b97\u6821\u9a8c\u548c\u3002\u6240\u6709\u6821\u9a8c\u548c\u5931\u8d25\u90fd\u4f1a\u5728 <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>\u89c6\u56fe\u4e2d\u62a5\u544a\u3002\u8be6\u89c1<a class=\"xref\" href=\"/docs/18/checksums.html\" title=\"28.2.\u00a0\u6570\u636e\u6821\u9a8c\u548c\">\u7b2c\u00a028.2\u00a0\u8282</a>\u3002</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 lang=\"zh\">\u8bbe\u7f6e\u6570\u636e\u5e93\u96c6\u7c07\u7684\u9ed8\u8ba4\u533a\u57df\u8bbe\u7f6e\u3002\u5982\u679c\u672a\u6307\u5b9a\u8be5\u9009\u9879\uff0c\u533a\u57df\u8bbe\u7f6e\u5c06\u7ee7\u627f\u81ea <code class=\"command\">initdb</code>\u8fd0\u884c\u65f6\u6240\u5728\u7684\u73af\u5883\u3002\u533a\u57df\u8bbe\u7f6e\u652f\u6301\u89c1<a class=\"xref\" href=\"/docs/18/locale.html\" title=\"23.1.\u00a0\u533a\u57df\u8bbe\u7f6e\u652f\u6301\">\u7b2c\u00a023.1\u00a0\u8282</a>\u3002</p>\n<p lang=\"zh\">\u5982\u679c<code class=\"option\">--locale-provider</code>\u4e3a<code class=\"literal\">builtin</code>\uff0c\u5219\u5fc5\u987b\u6307\u5b9a<code class=\"option\">--locale</code>\u6216<code class=\"option\">--builtin-locale</code>\uff0c\u5e76\u5c06\u5176\u8bbe\u7f6e\u4e3a<code class=\"literal\">C</code>\u3001<code class=\"literal\">C.UTF-8</code>\u6216 <code class=\"literal\">PG_UNICODE_FAST</code>\u3002</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 lang=\"zh\">\n<p>\u7c7b\u4f3c\u4e8e<code class=\"option\">--locale</code>\uff0c\u4f46\u53ea\u5728\u6307\u5b9a\u7684\u7c7b\u522b\u4e2d\u8bbe\u7f6e\u533a\u57df\u8bbe\u7f6e\u3002</p>\n</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 lang=\"zh\">\n<p>\u7b49\u4ef7\u4e8e<code class=\"option\">--locale=C</code>\u3002</p>\n</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 lang=\"zh\">\n<p>\u5f53\u4f7f\u7528 builtin \u63d0\u4f9b\u7a0b\u5e8f\u65f6\uff0c\u6307\u5b9a\u533a\u57df\u8bbe\u7f6e\u540d\u79f0\u3002\u533a\u57df\u8bbe\u7f6e\u652f\u6301\u89c1<a class=\"xref\" href=\"/docs/18/locale.html\" title=\"23.1.\u00a0\u533a\u57df\u8bbe\u7f6e\u652f\u6301\">\u7b2c\u00a023.1\u00a0\u8282</a>\u3002</p>\n</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 lang=\"zh\">\n<p>\u8be5\u9009\u9879\u8bbe\u7f6e\u65b0\u96c6\u7c07\u4e2d\u521b\u5efa\u7684\u6570\u636e\u5e93\u6240\u4f7f\u7528\u7684\u533a\u57df\u8bbe\u7f6e\u63d0\u4f9b\u7a0b\u5e8f\u3002\u540e\u7eed\u521b\u5efa\u65b0\u6570\u636e\u5e93\u65f6\uff0c\u53ef\u4ee5\u5728<code class=\"command\">CREATE DATABASE</code>\u547d\u4ee4\u4e2d\u8986\u76d6\u5b83\u3002\u9ed8\u8ba4\u503c\u4e3a <code class=\"literal\">libc</code>\uff08\u89c1<a class=\"xref\" href=\"/docs/18/locale.html#LOCALE-PROVIDERS\" title=\"23.1.4.\u00a0\u533a\u57df\u8bbe\u7f6e\u63d0\u4f9b\u7a0b\u5e8f\">\u7b2c\u00a023.1.4\u00a0\u8282</a>\uff09\u3002</p>\n</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 lang=\"zh\">\n<p>\u4e0d\u542f\u7528\u6570\u636e\u6821\u9a8c\u548c\u3002</p>\n</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 lang=\"zh\">\n<p>\u4f7f<code class=\"command\">initdb</code>\u4ece\u6587\u4ef6\u4e2d\u8bfb\u53d6\u5f15\u5bfc\u8d85\u7ea7\u7528\u6237\u7684\u5bc6\u7801\u3002\u6587\u4ef6\u7684\u7b2c\u4e00\u884c\u4f1a\u88ab\u5f53\u4f5c\u5bc6\u7801\u3002</p>\n</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 lang=\"zh\">\n<p>\u8bbe\u7f6e\u9ed8\u8ba4\u6587\u672c\u68c0\u7d22\u914d\u7f6e\u3002\u66f4\u591a\u4fe1\u606f\u89c1<a class=\"xref\" href=\"/docs/18/runtime-config-client.html#GUC-DEFAULT-TEXT-SEARCH-CONFIG\">default_text_search_config</a>\u3002</p>\n</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 lang=\"zh\">\n<p>\u8bbe\u7f6e<a class=\"glossterm\" href=\"/docs/18/glossary.html#GLOSSARY-BOOTSTRAP-SUPERUSER\"></a><a class=\"glossterm\" href=\"/docs/18/glossary.html#GLOSSARY-BOOTSTRAP-SUPERUSER\" title=\"\u5f15\u5bfc\u8d85\u7ea7\u7528\u6237\">\u5f15\u5bfc\u8d85\u7ea7\u7528\u6237</a>\u7684\u7528\u6237\u540d\u3002\u9ed8\u8ba4\u503c\u662f\u8fd0\u884c<code class=\"command\">initdb</code>\u7684\u64cd\u4f5c\u7cfb\u7edf\u7528\u6237\u540d\u3002</p>\n</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 lang=\"zh\">\n<p>\u4f7f<code class=\"command\">initdb</code>\u63d0\u793a\u8f93\u5165\u8981\u8d4b\u7ed9\u5f15\u5bfc\u8d85\u7ea7\u7528\u6237\u7684\u5bc6\u7801\u3002\u5982\u679c\u4e0d\u6253\u7b97\u4f7f\u7528\u5bc6\u7801\u8ba4\u8bc1\uff0c\u8fd9\u4e00\u70b9\u5e76\u4e0d\u91cd\u8981\u3002\u5426\u5219\uff0c\u5728\u8bbe\u7f6e\u5bc6\u7801\u4e4b\u524d\u5c06\u65e0\u6cd5\u4f7f\u7528\u5bc6\u7801\u8ba4\u8bc1\u3002</p>\n</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 lang=\"zh\">\n<p>\u8be5\u9009\u9879\u6307\u5b9a\u9884\u5199\u5f0f\u65e5\u5fd7\uff08WAL\uff09\u5e94\u5b58\u653e\u7684\u76ee\u5f55\u3002</p>\n</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 lang=\"zh\">\u8bbe\u7f6e WAL \u6bb5\u5927\u5c0f\uff0c\u5355\u4f4d\u4e3a\u5146\u5b57\u8282\u3002\u8fd9\u662f WAL \u65e5\u5fd7\u4e2d\u6bcf\u4e2a\u72ec\u7acb\u6587\u4ef6\u7684\u5927\u5c0f\u3002\u9ed8\u8ba4\u5927\u5c0f\u4e3a 16 \u5146\u5b57\u8282\u3002\u53d6\u503c\u5fc5\u987b\u662f 1 \u5230 1024\uff08\u5146\u5b57\u8282\uff09\u4e4b\u95f4\u7684 2 \u7684\u5e42\u3002\u6b64\u9009\u9879\u53ea\u80fd\u5728\u521d\u59cb\u5316\u65f6\u8bbe\u7f6e\uff0c\u4e4b\u540e\u65e0\u6cd5\u66f4\u6539\u3002</p>\n<p lang=\"zh\">\u8c03\u6574\u8be5\u5927\u5c0f\u53ef\u80fd\u6709\u52a9\u4e8e\u63a7\u5236 WAL \u65e5\u5fd7\u4f20\u9001\u6216\u5f52\u6863\u7684\u7c92\u5ea6\u3002\u6b64\u5916\uff0c\u5728 WAL \u91cf\u5f88\u5927\u7684\u6570\u636e\u5e93\u4e2d\uff0c\u6bcf\u4e2a\u76ee\u5f55\u4e2d\u7684 WAL \u6587\u4ef6\u6570\u91cf\u53ef\u80fd\u4f1a\u6210\u4e3a\u6027\u80fd\u548c\u7ba1\u7406\u95ee\u9898\u3002\u589e\u5927 WAL \u6587\u4ef6\u5927\u5c0f\u4f1a\u51cf\u5c11 WAL \u6587\u4ef6\u6570\u91cf\u3002</p>\n</dd>\n</dl>\n</div>\n<p lang=\"zh\">\u8fd8\u63d0\u4f9b\u4e86\u5176\u4ed6\u4e00\u4e9b\u8f83\u5c11\u4f7f\u7528\u7684\u9009\u9879\uff1a</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 lang=\"zh\">\u5728 initdb \u671f\u95f4\u5f3a\u5236\u5c06\u670d\u52a1\u5668\u53c2\u6570 name \u8bbe\u4e3a value\uff0c\u5e76\u628a\u8be5\u8bbe\u7f6e\u5199\u5165\u751f\u6210\u7684 postgresql.conf \u6587\u4ef6\uff0c\u4f7f\u5176\u5728\u4e4b\u540e\u7684\u670d\u52a1\u5668\u8fd0\u884c\u4e2d\u4e5f\u751f\u6548\u3002\u6b64\u9009\u9879\u53ef\u591a\u6b21\u4f7f\u7528\uff0c\u4ee5\u8bbe\u7f6e\u591a\u4e2a\u53c2\u6570\u3002\u5b83\u4e3b\u8981\u7528\u4e8e\u73af\u5883\u6761\u4ef6\u5bfc\u81f4\u670d\u52a1\u5668\u5b8c\u5168\u65e0\u6cd5\u4f7f\u7528\u9ed8\u8ba4\u53c2\u6570\u542f\u52a8\u7684\u60c5\u51b5\u3002</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 lang=\"zh\">\n<p>\u6253\u5370\u5f15\u5bfc\u540e\u7aef\u7684\u8c03\u8bd5\u8f93\u51fa\uff0c\u4ee5\u53ca\u5c11\u91cf\u666e\u901a\u7528\u6237\u901a\u5e38\u4e0d\u611f\u5174\u8da3\u7684\u5176\u4ed6\u6d88\u606f\u3002\u5f15\u5bfc\u540e\u7aef\u662f <code class=\"command\">initdb</code>\u7528\u6765\u521b\u5efa\u7cfb\u7edf\u76ee\u5f55\u8868\u7684\u7a0b\u5e8f\u3002\u8be5\u9009\u9879\u4f1a\u4ea7\u751f\u5927\u91cf\u6781\u5176\u4e4f\u5473\u7684\u8f93\u51fa\u3002</p>\n</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 lang=\"zh\">\n<p>\u4f7f\u7528<code class=\"literal\">debug_discard_caches=1</code>\u9009\u9879\u8fd0\u884c\u5f15\u5bfc\u540e\u7aef\u3002\u8fd9\u4f1a\u82b1\u8d39\u5f88\u957f\u65f6\u95f4\uff0c\u53ea\u5bf9\u6df1\u5ea6\u8c03\u8bd5\u6709\u7528\u3002</p>\n</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 lang=\"zh\">\n<p>\u6307\u5b9a<code class=\"command\">initdb</code>\u521d\u59cb\u5316\u6570\u636e\u5e93\u96c6\u7c07\u65f6\u5e94\u5230\u54ea\u91cc\u67e5\u627e\u5176\u8f93\u5165\u6587\u4ef6\u3002\u901a\u5e38\u4e0d\u9700\u8981\u8fd9\u6837\u505a\u3002\u82e5\u9700\u8981\u663e\u5f0f\u6307\u5b9a\u5176\u4f4d\u7f6e\uff0c\u7cfb\u7edf\u4f1a\u63d0\u793a\u3002</p>\n</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 lang=\"zh\">\n<p>\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c\u5982\u679c<code class=\"command\">initdb</code>\u53d1\u73b0\u67d0\u4e2a\u9519\u8bef\u4f7f\u5176\u65e0\u6cd5\u5b8c\u6574\u521b\u5efa\u6570\u636e\u5e93\u96c6\u7c07\uff0c\u5c31\u4f1a\u5220\u9664\u5b83\u5728\u53d1\u73b0\u65e0\u6cd5\u5b8c\u6210\u4efb\u52a1\u4e4b\u524d\u53ef\u80fd\u5df2\u521b\u5efa\u7684\u6240\u6709\u6587\u4ef6\u3002\u8be5\u9009\u9879\u4f1a\u7981\u6b62\u8fd9\u79cd\u6e05\u7406\uff0c\u56e0\u6b64\u5bf9\u8c03\u8bd5\u6709\u7528\u3002</p>\n</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 lang=\"zh\">\n<p>\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c<code class=\"command\">initdb</code>\u4f1a\u7b49\u5f85\u6240\u6709\u6587\u4ef6\u90fd\u5b89\u5168\u5199\u5165\u78c1\u76d8\u3002\u8be5\u9009\u9879\u4f7f <code class=\"command\">initdb</code>\u5728\u4e0d\u7b49\u5f85\u7684\u60c5\u51b5\u4e0b\u8fd4\u56de\uff0c\u901f\u5ea6\u66f4\u5feb\uff0c\u4f46\u8fd9\u610f\u5473\u7740\u5982\u679c\u540e\u7eed\u64cd\u4f5c\u7cfb\u7edf\u5d29\u6e83\uff0c\u6570\u636e\u76ee\u5f55\u53ef\u80fd\u4f1a\u635f\u574f\u3002\u901a\u5e38\uff0c\u8be5\u9009\u9879\u9002\u7528\u4e8e\u6d4b\u8bd5\uff0c\u4f46\u4e0d\u5e94\u7528\u4e8e\u521b\u5efa\u751f\u4ea7\u73af\u5883\u5b89\u88c5\u3002</p>\n</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 lang=\"zh\">\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c<code class=\"command\">initdb</code>\u4f1a\u5c06\u6240\u6709\u6570\u636e\u5e93\u6587\u4ef6\u5b89\u5168\u5730\u5199\u5165\u78c1\u76d8\u3002\u8be5\u9009\u9879\u6307\u793a<code class=\"command\">initdb</code>\u8df3\u8fc7\u540c\u6b65\u5404\u4e2a\u6570\u636e\u5e93\u76ee\u5f55\u4e2d\u7684\u6240\u6709\u6587\u4ef6\u3001\u8fd9\u4e9b\u6570\u636e\u5e93\u76ee\u5f55\u672c\u8eab\u4ee5\u53ca\u8868\u7a7a\u95f4\u76ee\u5f55\uff0c\u4e5f\u5c31\u662f<code class=\"filename\">base</code>\u5b50\u76ee\u5f55\u4e2d\u7684\u6240\u6709\u5185\u5bb9\u548c\u4efb\u4f55\u5176\u4ed6\u8868\u7a7a\u95f4\u76ee\u5f55\u3002\u5176\u4ed6\u6587\u4ef6\uff0c\u4f8b\u5982<code class=\"literal\">pg_wal</code>\u548c<code class=\"literal\">pg_xact</code>\u4e2d\u7684\u6587\u4ef6\uff0c\u4ecd\u4f1a\u88ab\u540c\u6b65\uff0c\u9664\u975e\u4e5f\u6307\u5b9a\u4e86<code class=\"option\">--no-sync</code>\u3002</p>\n<p lang=\"zh\">\u8bf7\u6ce8\u610f\uff0c\u5982\u679c<code class=\"option\">--no-sync-data-files</code>\u4e0e <code class=\"option\">--sync-method=syncfs</code>\u4e00\u8d77\u4f7f\u7528\uff0c\u4e0a\u8ff0\u90e8\u5206\u6216\u5168\u90e8\u6587\u4ef6\u4e0e\u76ee\u5f55\u4ecd\u4f1a\u88ab\u540c\u6b65\uff0c\u56e0\u4e3a<code class=\"literal\">syncfs</code>\u5904\u7406\u7684\u662f\u6574\u4e2a\u6587\u4ef6\u7cfb\u7edf\u3002</p>\n<p lang=\"zh\">\u8be5\u9009\u9879\u4e3b\u8981\u4f9b\u90a3\u4e9b\u4f1a\u53e6\u884c\u786e\u4fdd\u8fd9\u4e9b\u88ab\u8df3\u8fc7\u6587\u4ef6\u5df2\u540c\u6b65\u5230\u78c1\u76d8\u7684\u5de5\u5177\u5728\u5185\u90e8\u4f7f\u7528\u3002</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 lang=\"zh\">\n<p>\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c<code class=\"command\">initdb</code>\u4f1a\u5728\u5176\u8f93\u51fa\u672b\u5c3e\u5199\u51fa\u5982\u4f55\u542f\u52a8\u96c6\u7c07\u7684\u8bf4\u660e\u3002\u8be5\u9009\u9879\u4f1a\u7701\u7565\u8fd9\u4e9b\u8bf4\u660e\u3002\u5b83\u4e3b\u8981\u4f9b\u90a3\u4e9b\u5bf9<code class=\"command\">initdb</code>\u8fdb\u884c\u5e73\u53f0\u7279\u5b9a\u5c01\u88c5\u7684\u5de5\u5177\u4f7f\u7528\uff0c\u56e0\u4e3a\u5728\u8fd9\u79cd\u60c5\u51b5\u4e0b\u90a3\u4e9b\u8bf4\u660e\u5f88\u53ef\u80fd\u5e76\u4e0d\u6b63\u786e\u3002</p>\n</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 lang=\"zh\">\n<p>\u663e\u793a\u5185\u90e8\u8bbe\u7f6e\u5e76\u9000\u51fa\uff0c\u4e0d\u6267\u884c\u5176\u4ed6\u64cd\u4f5c\u3002\u53ef\u7528\u4e8e\u8c03\u8bd5<span class=\"application\">initdb</span>\u7684\u5b89\u88c5\u3002</p>\n</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 lang=\"zh\">\u8bbe\u4e3a<code class=\"literal\">fsync</code>\uff08\u9ed8\u8ba4\u503c\uff09\u65f6\uff0c<code class=\"command\">initdb</code>\u4f1a\u9012\u5f52\u6253\u5f00\u5e76\u540c\u6b65\u6570\u636e\u76ee\u5f55\u4e2d\u7684\u6240\u6709\u6587\u4ef6\u3002\u67e5\u627e\u6587\u4ef6\u65f6\u4f1a\u8ddf\u968f WAL \u76ee\u5f55\u548c\u6bcf\u4e2a\u5df2\u914d\u7f6e\u8868\u7a7a\u95f4\u7684\u7b26\u53f7\u94fe\u63a5\u3002</p>\n<p lang=\"zh\">\u5728 Linux \u4e0a\uff0c\u4e5f\u53ef\u4ee5\u6539\u7528<code class=\"literal\">syncfs</code>\uff0c\u8bf7\u6c42\u64cd\u4f5c\u7cfb\u7edf\u540c\u6b65\u5305\u542b\u6570\u636e\u76ee\u5f55\u3001WAL \u6587\u4ef6\u4ee5\u53ca\u6bcf\u4e2a\u8868\u7a7a\u95f4\u7684\u6574\u4e2a\u6587\u4ef6\u7cfb\u7edf\u3002\u4f7f\u7528<code class=\"literal\">syncfs</code>\u65f6\u9700\u6ce8\u610f\u7684\u4e8b\u9879\u89c1<a class=\"xref\" href=\"/docs/18/runtime-config-error-handling.html#GUC-RECOVERY-INIT-SYNC-METHOD\">recovery_init_sync_method</a>\u3002</p>\n<p lang=\"zh\">\u4f7f\u7528<code class=\"option\">--no-sync</code>\u65f6\uff0c\u8be5\u9009\u9879\u4e0d\u8d77\u4f5c\u7528\u3002</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 lang=\"zh\">\n<p>\u5c06\u6240\u6709\u6570\u636e\u5e93\u6587\u4ef6\u5b89\u5168\u5730\u5199\u5165\u78c1\u76d8\u5e76\u9000\u51fa\u3002\u8fd9\u4e0d\u4f1a\u6267\u884c\u4efb\u4f55\u5e38\u89c4\u7684 <span class=\"application\">initdb</span>\u64cd\u4f5c\u3002\u901a\u5e38\uff0c\u8be5\u9009\u9879\u53ef\u7528\u4e8e\u5728\u5c06<a class=\"xref\" href=\"/docs/18/runtime-config-wal.html#GUC-FSYNC\">fsync</a>\u4ece<code class=\"literal\">off</code>\u6539\u4e3a<code class=\"literal\">on</code>\u540e\uff0c\u786e\u4fdd\u80fd\u591f\u53ef\u9760\u6062\u590d\u3002</p>\n</p>\n</dd>\n</dl>\n</div>\n<p lang=\"zh\">\u5176\u4ed6\u9009\u9879\uff1a</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 lang=\"zh\">\n<p>\u6253\u5370<span class=\"application\">initdb</span>\u7248\u672c\u5e76\u9000\u51fa\u3002</p>\n</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 lang=\"zh\">\n<p>\u663e\u793a\u6709\u5173<span class=\"application\">initdb</span>\u547d\u4ee4\u884c\u53c2\u6570\u7684\u5e2e\u52a9\u5e76\u9000\u51fa\u3002</p>\n</p>\n</dd>\n</dl>\n</div>\n</div>\n<div class=\"refsect1\" id=\"id-1.9.5.3.7\">\n<h2 lang=\"zh\">\u73af\u5883</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 lang=\"zh\">\n<p>\u6307\u5b9a\u6570\u636e\u5e93\u96c6\u7c07\u5e94\u5b58\u653e\u7684\u76ee\u5f55\uff1b\u53ef\u4f7f\u7528<code class=\"option\">-D</code>\u9009\u9879\u8986\u76d6\u3002</p>\n</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 lang=\"zh\">\n<p>\u6307\u5b9a\u8bca\u65ad\u6d88\u606f\u662f\u5426\u4f7f\u7528\u989c\u8272\u3002\u53ef\u9009\u503c\u4e3a <code class=\"literal\">always</code>\u3001<code class=\"literal\">auto</code>\u548c <code class=\"literal\">never</code>\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-INITDB-ENVIRONMENT-TZ\"><span class=\"term\"><code class=\"envar\">TZ</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6307\u5b9a\u6240\u521b\u5efa\u6570\u636e\u5e93\u96c6\u7c07\u7684\u9ed8\u8ba4\u65f6\u533a\u3002\u8be5\u503c\u5e94\u4e3a\u5b8c\u6574\u7684\u65f6\u533a\u540d\u79f0\uff08\u89c1<a class=\"xref\" href=\"/docs/18/datatype-datetime.html#DATATYPE-TIMEZONES\" title=\"8.5.3.\u00a0\u65f6\u533a\">\u7b2c\u00a08.5.3\u00a0\u8282</a>\uff09\u3002</p>\n</p>\n</dd>\n</dl>\n</div>\n</div>\n<div class=\"refsect1\" id=\"id-1.9.5.3.8\">\n<h2 lang=\"zh\">\u6ce8\u89e3</h2>\n<p lang=\"zh\">\u4e5f\u53ef\u4ee5\u901a\u8fc7 pg_ctl initdb \u8c03\u7528 initdb\u3002</p>\n</div>\n<div class=\"refsect1\" id=\"id-1.9.5.3.9\">\n<h2 lang=\"zh\">\u53e6\u89c1</h2><span class=\"simplelist\"><a class=\"xref\" href=\"https://pg.center/docs/18/app-pg-ctl.html\" title=\"pg_ctl\"><span class=\"refentrytitle\"><span class=\"application\">pg_ctl</span></span></a>, <a class=\"xref\" href=\"https://pg.center/docs/18/app-postgres.html\" title=\"postgres\"><span class=\"refentrytitle\"><span class=\"application\">postgres</span></span></a>, <a class=\"xref\" href=\"https://pg.center/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", "localization": {"status": "complete", "sources": [{"url": "/docs/18/app-initdb.html", "method": "same-major semantic node", "sha256": "e3f685108b64d57c6304e908cf93735cce0f65259bff183081ecb5edb31db8be", "language": "zh", "matched_nodes": ["#APP-INITDB/div[2]/p[1]", "#APP-INITDB/div[3]/h2[0]", "#APP-INITDB/div[4]/p[10]", "#APP-INITDB/div[4]/p[11]", "#APP-INITDB/div[4]/p[12]", "#APP-INITDB/div[4]/p[1]", "#APP-INITDB/div[4]/p[2]", "#APP-INITDB/div[4]/p[3]", "#APP-INITDB/div[4]/p[4]", "#APP-INITDB/div[4]/p[5]", "#APP-INITDB/div[4]/p[6]", "#APP-INITDB/div[4]/p[7]", "#APP-INITDB/div[4]/p[8]", "#APP-INITDB/div[5]/div[1]/dl[0]/dd[11]", "#APP-INITDB/div[5]/div[1]/dl[0]/dd[13]", "#APP-INITDB/div[5]/div[1]/dl[0]/dd[15]", "#APP-INITDB/div[5]/div[1]/dl[0]/dd[17]/p[0]", "#APP-INITDB/div[5]/div[1]/dl[0]/dd[17]/p[1]", "#APP-INITDB/div[5]/div[1]/dl[0]/dd[19]/p[0]", "#APP-INITDB/div[5]/div[1]/dl[0]/dd[19]/p[1]", "#APP-INITDB/div[5]/div[1]/dl[0]/dd[1]/p[0]", "#APP-INITDB/div[5]/div[1]/dl[0]/dd[1]/p[1]", "#APP-INITDB/div[5]/div[1]/dl[0]/dd[1]/p[2]", "#APP-INITDB/div[5]/div[1]/dl[0]/dd[21]", "#APP-INITDB/div[5]/div[1]/dl[0]/dd[23]", "#APP-INITDB/div[5]/div[1]/dl[0]/dd[25]", "#APP-INITDB/div[5]/div[1]/dl[0]/dd[27]", "#APP-INITDB/div[5]/div[1]/dl[0]/dd[29]", "#APP-INITDB/div[5]/div[1]/dl[0]/dd[31]", "#APP-INITDB/div[5]/div[1]/dl[0]/dd[33]", "#APP-INITDB/div[5]/div[1]/dl[0]/dd[35]", "#APP-INITDB/div[5]/div[1]/dl[0]/dd[37]", "#APP-INITDB/div[5]/div[1]/dl[0]/dd[39]", "#APP-INITDB/div[5]/div[1]/dl[0]/dd[3]", "#APP-INITDB/div[5]/div[1]/dl[0]/dd[41]/p[1]", "#APP-INITDB/div[5]/div[1]/dl[0]/dd[5]", "#APP-INITDB/div[5]/div[1]/dl[0]/dd[7]", "#APP-INITDB/div[5]/div[1]/dl[0]/dd[9]/p[0]", "#APP-INITDB/div[5]/div[3]/dl[0]/dd[11]", "#APP-INITDB/div[5]/div[3]/dl[0]/dd[13]/p[0]", "#APP-INITDB/div[5]/div[3]/dl[0]/dd[13]/p[1]", "#APP-INITDB/div[5]/div[3]/dl[0]/dd[13]/p[2]", "#APP-INITDB/div[5]/div[3]/dl[0]/dd[15]", "#APP-INITDB/div[5]/div[3]/dl[0]/dd[17]", "#APP-INITDB/div[5]/div[3]/dl[0]/dd[19]/p[0]", "#APP-INITDB/div[5]/div[3]/dl[0]/dd[19]/p[1]", "#APP-INITDB/div[5]/div[3]/dl[0]/dd[19]/p[2]", "#APP-INITDB/div[5]/div[3]/dl[0]/dd[21]", "#APP-INITDB/div[5]/div[3]/dl[0]/dd[3]", "#APP-INITDB/div[5]/div[3]/dl[0]/dd[5]", "#APP-INITDB/div[5]/div[3]/dl[0]/dd[7]", "#APP-INITDB/div[5]/div[3]/dl[0]/dd[9]", "#APP-INITDB/div[5]/div[5]/dl[0]/dd[1]", "#APP-INITDB/div[5]/div[5]/dl[0]/dd[3]", "#APP-INITDB/div[5]/p[2]", "#APP-INITDB/div[5]/p[4]", "#APP-INITDB/div[6]/div[1]/dl[0]/dd[1]", "#APP-INITDB/div[6]/div[1]/dl[0]/dd[3]", "#APP-INITDB/div[6]/div[1]/dl[0]/dd[5]", "#APP-INITDB/div[6]/h2[0]", "#APP-INITDB/div[7]/h2[0]", "#APP-INITDB/div[8]/h2[0]"]}], "language": "zh", "original_text": {"/versions/18/description/0": "initdb \u2014 create a new PostgreSQL database cluster", "/versions/18/facts/0/label": "Documented executable", "/versions/18/facts/1/label": "Executable version", "/versions/18/facts/2/label": "Reference inventory", "/versions/18/facts/2/value": "Server applications", "/versions/18/facts/3/label": "Option definition groups", "/versions/18/tables/0/title": "Documented options", "/versions/18/tables/1/title": "Environment variables", "/versions/18/tables/0/rows/0/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.", "/versions/18/tables/0/rows/1/summary": "This option specifies the authentication method for local users via TCP/IP connections used in pg_hba.conf ( host lines).", "/versions/18/tables/0/rows/2/summary": "This option specifies the authentication method for local users via Unix-domain socket connections used in pg_hba.conf ( local lines).", "/versions/18/tables/0/rows/3/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.", "/versions/18/tables/0/rows/4/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 .", "/versions/18/tables/0/rows/5/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.", "/versions/18/tables/0/rows/6/summary": "Specifies the ICU locale when the ICU provider is used. Locale support is described in Section 23.1 .", "/versions/18/tables/0/rows/7/summary": "Specifies additional collation rules to customize the behavior of the default collation. This is supported for ICU only.", "/versions/18/tables/0/rows/8/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.", "/versions/18/tables/0/rows/9/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 .", "/versions/18/tables/0/columns/0/label": "Option and arguments", "/versions/18/tables/0/columns/1/label": "Description", "/versions/18/tables/0/rows/10/summary": "Like --locale , but only sets the locale in the specified category.", "/versions/18/tables/0/rows/11/summary": "Equivalent to --locale=C .", "/versions/18/tables/0/rows/12/summary": "Specifies the locale name when the builtin provider is used. Locale support is described in Section 23.1 .", "/versions/18/tables/0/rows/13/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 ).", "/versions/18/tables/0/rows/14/summary": "Do not enable data checksums.", "/versions/18/tables/0/rows/15/summary": "Makes initdb read the bootstrap superuser's password from a file. The first line of the file is taken as the password.", "/versions/18/tables/0/rows/16/summary": "Sets the default text search configuration. See default_text_search_config for further information.", "/versions/18/tables/0/rows/17/summary": "Sets the user name of the bootstrap superuser . This defaults to the name of the operating-system user running initdb .", "/versions/18/tables/0/rows/18/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.", "/versions/18/tables/0/rows/19/summary": "This option specifies the directory where the write-ahead log should be stored.", "/versions/18/tables/0/rows/20/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.", "/versions/18/tables/0/rows/21/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.", "/versions/18/tables/0/rows/22/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.", "/versions/18/tables/0/rows/23/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.", "/versions/18/tables/0/rows/24/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.", "/versions/18/tables/0/rows/25/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.", "/versions/18/tables/0/rows/26/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.", "/versions/18/tables/0/rows/27/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.", "/versions/18/tables/0/rows/28/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.", "/versions/18/tables/0/rows/29/summary": "Show internal settings and exit, without doing anything else. This can be used to debug the initdb installation.", "/versions/18/tables/0/rows/30/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.", "/versions/18/tables/0/rows/31/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 .", "/versions/18/tables/0/rows/32/summary": "Print the initdb version and exit.", "/versions/18/tables/0/rows/33/summary": "Show help about initdb command line arguments, and exit.", "/versions/18/tables/1/columns/0/label": "Variable", "/versions/18/tables/1/columns/1/label": "Meaning", "/versions/18/tables/1/rows/0/description": "Specifies the directory where the database cluster is to be stored; can be overridden using the -D option.", "/versions/18/tables/1/rows/1/description": "Specifies whether to use color in diagnostic messages. Possible values are always , auto and never .", "/versions/18/tables/1/rows/2/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 )."}, "fallback_fields": [], "source_language": "en", "original_snapshot_sha256": "37cd7f4e3209fafd295990dfc70e740646e1fdda165a02d17b328ba73f395fb5"}, "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", "manual_language": "zh"}, "19": {"facts": [{"label": "\u624b\u518c\u4e2d\u7684\u53ef\u6267\u884c\u7a0b\u5e8f", "value": "initdb"}, {"label": "\u7a0b\u5e8f\u7248\u672c", "value": "19beta4"}, {"label": "\u53c2\u8003\u6e05\u5355", "value": "\u670d\u52a1\u7aef\u7a0b\u5e8f"}, {"label": "\u9009\u9879\u5b9a\u4e49\u7ec4", "value": "34"}], "tables": [{"key": "options", "rows": [{"summary": "\u8be5\u9009\u9879\u6307\u5b9a pg_hba.conf \u4e2d\u672c\u5730\u7528\u6237\u9ed8\u8ba4\u4f7f\u7528\u7684\u8ba4\u8bc1\u65b9\u6cd5\uff08 host \u548c local \u884c\uff09\u3002\u6709\u6548\u503c\u6982\u89c8\u89c1 \u7b2c 20.1 \u8282 \u3002", "signature": {"url": "/docs/19/app-initdb.html#APP-INITDB-OPTION-AUTH", "text": "-A authmethod --auth= authmethod"}}, {"summary": "\u8be5\u9009\u9879\u6307\u5b9a pg_hba.conf \u4e2d\u672c\u5730\u7528\u6237\u901a\u8fc7 TCP/IP \u8fde\u63a5\u65f6\uff08 host \u884c\uff09\u4f7f\u7528\u7684\u8ba4\u8bc1\u65b9\u6cd5\u3002", "signature": {"url": "/docs/19/app-initdb.html#APP-INITDB-OPTION-AUTH-HOST", "text": "--auth-host= authmethod"}}, {"summary": "\u8be5\u9009\u9879\u6307\u5b9a pg_hba.conf \u4e2d\u672c\u5730\u7528\u6237\u901a\u8fc7 Unix \u57df\u5957\u63a5\u5b57\u8fde\u63a5\u65f6\uff08 local \u884c\uff09\u4f7f\u7528\u7684\u8ba4\u8bc1\u65b9\u6cd5\u3002", "signature": {"url": "/docs/19/app-initdb.html#APP-INITDB-OPTION-AUTH-LOCAL", "text": "--auth-local= authmethod"}}, {"summary": "\u8be5\u9009\u9879\u6307\u5b9a\u6570\u636e\u5e93\u96c6\u7c07\u5e94\u5b58\u653e\u7684\u76ee\u5f55\u3002\u8fd9\u662f initdb \u6240\u9700\u7684\u552f\u4e00\u4fe1\u606f\uff0c\u4f46\u4e5f\u53ef\u4ee5\u901a\u8fc7\u8bbe\u7f6e PGDATA \u73af\u5883\u53d8\u91cf\u6765\u7701\u53bb\u663e\u5f0f\u5199\u51fa\u5b83\uff1b\u8fd9\u901a\u5e38\u66f4\u65b9\u4fbf\uff0c\u56e0\u4e3a\u6570\u636e\u5e93\u670d\u52a1\u5668\uff08 postgres \uff09\u4e4b\u540e\u4e5f\u53ef\u4ee5\u901a\u8fc7\u540c\u4e00\u53d8\u91cf\u627e\u5230\u6570\u636e\u76ee\u5f55\u3002", "signature": {"url": "/docs/19/app-initdb.html#APP-INITDB-OPTION-PGDATA", "text": "-D datadir --pgdata= datadir"}}, {"summary": "\u9009\u62e9\u6a21\u677f\u6570\u636e\u5e93\u7684\u7f16\u7801\u3002\u8fd9\u4e5f\u5c06\u6210\u4e3a\u4ee5\u540e\u521b\u5efa\u7684\u4efb\u4f55\u6570\u636e\u5e93\u7684\u9ed8\u8ba4\u7f16\u7801\uff0c\u9664\u975e\u5728\u521b\u5efa\u65f6\u8986\u76d6\u5b83\u3002 PostgreSQL \u670d\u52a1\u5668\u652f\u6301\u7684\u5b57\u7b26\u96c6\u89c1 \u7b2c 23.3.1 \u8282 \u3002", "signature": {"url": "/docs/19/app-initdb.html#APP-INITDB-OPTION-ENCODING", "text": "-E encoding --encoding= encoding"}}, {"summary": "\u5141\u8bb8\u4e0e\u96c6\u7c07\u62e5\u6709\u8005\u540c\u7ec4\u7684\u7528\u6237\u8bfb\u53d6\u7531 initdb \u521b\u5efa\u7684\u6240\u6709\u96c6\u7c07\u6587\u4ef6\u3002\u8be5\u9009\u9879\u5728 Windows \u4e0a\u4f1a\u88ab\u5ffd\u7565\uff0c\u56e0\u4e3a\u5b83\u4e0d\u652f\u6301 POSIX \u98ce\u683c\u7684\u7ec4\u6743\u9650\u3002", "signature": {"url": "/docs/19/app-initdb.html#APP-INITDB-ALLOW-GROUP-ACCESS", "text": "-g --allow-group-access"}}, {"summary": "\u5f53\u4f7f\u7528 ICU \u63d0\u4f9b\u7a0b\u5e8f\u65f6\uff0c\u6307\u5b9a ICU \u533a\u57df\u8bbe\u7f6e\u3002\u533a\u57df\u8bbe\u7f6e\u652f\u6301\u89c1 \u7b2c 23.1 \u8282 \u3002", "signature": {"url": "/docs/19/app-initdb.html#APP-INITDB-ICU-LOCALE", "text": "--icu-locale= locale"}}, {"summary": "\u6307\u5b9a\u9644\u52a0\u7684\u6392\u5e8f\u89c4\u5219\uff0c\u4ee5\u5b9a\u5236\u9ed8\u8ba4\u6392\u5e8f\u89c4\u5219\u7684\u884c\u4e3a\u3002\u8be5\u9009\u9879\u4ec5\u652f\u6301 ICU\u3002", "signature": {"url": "/docs/19/app-initdb.html#APP-INITDB-ICU-RULES", "text": "--icu-rules= rules"}}, {"summary": "\u5bf9\u6570\u636e\u9875\u542f\u7528\u6821\u9a8c\u548c\uff0c\u4ee5\u5e2e\u52a9\u68c0\u6d4b\u539f\u672c\u4f1a\u6084\u65e0\u58f0\u606f\u53d1\u751f\u7684\u3001\u7531 I/O \u7cfb\u7edf\u5bfc\u81f4\u7684\u635f\u574f\u3002\u8be5\u9879\u9ed8\u8ba4\u542f\u7528\uff1b\u4f7f\u7528 --no-data-checksums \u53ef\u7981\u7528\u6821\u9a8c\u548c\u3002", "signature": {"url": "/docs/19/app-initdb.html#APP-INITDB-DATA-CHECKSUMS", "text": "-k --data-checksums"}}, {"summary": "\u8bbe\u7f6e\u6570\u636e\u5e93\u96c6\u7c07\u7684\u9ed8\u8ba4\u533a\u57df\u8bbe\u7f6e\u3002\u5982\u679c\u672a\u6307\u5b9a\u8be5\u9009\u9879\uff0c\u533a\u57df\u8bbe\u7f6e\u5c06\u7ee7\u627f\u81ea initdb \u8fd0\u884c\u65f6\u6240\u5728\u7684\u73af\u5883\u3002\u533a\u57df\u8bbe\u7f6e\u652f\u6301\u89c1 \u7b2c 23.1 \u8282 \u3002", "signature": {"url": "/docs/19/app-initdb.html#APP-INITDB-OPTION-LOCALE", "text": "--locale= locale"}}, {"summary": "\u7c7b\u4f3c\u4e8e --locale \uff0c\u4f46\u53ea\u5728\u6307\u5b9a\u7684\u7c7b\u522b\u4e2d\u8bbe\u7f6e\u533a\u57df\u8bbe\u7f6e\u3002", "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": "\u7b49\u4ef7\u4e8e --locale=C \u3002", "signature": {"url": "/docs/19/app-initdb.html#APP-INITDB-OPTION-NO-LOCALE", "text": "--no-locale"}}, {"summary": "\u5f53\u4f7f\u7528 builtin \u63d0\u4f9b\u7a0b\u5e8f\u65f6\uff0c\u6307\u5b9a\u533a\u57df\u8bbe\u7f6e\u540d\u79f0\u3002\u533a\u57df\u8bbe\u7f6e\u652f\u6301\u89c1 \u7b2c 23.1 \u8282 \u3002", "signature": {"url": "/docs/19/app-initdb.html#APP-INITDB-BUILTIN-LOCALE", "text": "--builtin-locale= locale"}}, {"summary": "\u8be5\u9009\u9879\u8bbe\u7f6e\u65b0\u96c6\u7c07\u4e2d\u521b\u5efa\u7684\u6570\u636e\u5e93\u6240\u4f7f\u7528\u7684\u533a\u57df\u8bbe\u7f6e\u63d0\u4f9b\u7a0b\u5e8f\u3002\u540e\u7eed\u521b\u5efa\u65b0\u6570\u636e\u5e93\u65f6\uff0c\u53ef\u4ee5\u5728 CREATE DATABASE \u547d\u4ee4\u4e2d\u8986\u76d6\u5b83\u3002\u9ed8\u8ba4\u503c\u4e3a libc \uff08\u89c1 \u7b2c 23.1.4 \u8282 \uff09\u3002", "signature": {"url": "/docs/19/app-initdb.html#APP-INITDB-OPTION-LOCALE-PROVIDER", "text": "--locale-provider={ builtin | libc | icu }"}}, {"summary": "\u4e0d\u542f\u7528\u6570\u636e\u6821\u9a8c\u548c\u3002", "signature": {"url": "/docs/19/app-initdb.html#APP-INITDB-NO-DATA-CHECKSUMS", "text": "--no-data-checksums"}}, {"summary": "\u4f7f initdb \u4ece\u6587\u4ef6\u4e2d\u8bfb\u53d6\u5f15\u5bfc\u8d85\u7ea7\u7528\u6237\u7684\u5bc6\u7801\u3002\u6587\u4ef6\u7684\u7b2c\u4e00\u884c\u4f1a\u88ab\u5f53\u4f5c\u5bc6\u7801\u3002", "signature": {"url": "/docs/19/app-initdb.html#APP-INITDB-OPTION-PWFILE", "text": "--pwfile= filename"}}, {"summary": "\u8bbe\u7f6e\u9ed8\u8ba4\u6587\u672c\u68c0\u7d22\u914d\u7f6e\u3002\u66f4\u591a\u4fe1\u606f\u89c1 default_text_search_config \u3002", "signature": {"url": "/docs/19/app-initdb.html#APP-INITDB-OPTION-TEXT-SEARCH-CONFIG", "text": "-T config --text-search-config= config"}}, {"summary": "\u8bbe\u7f6e \u5f15\u5bfc\u8d85\u7ea7\u7528\u6237 \u7684\u7528\u6237\u540d\u3002\u9ed8\u8ba4\u503c\u662f\u8fd0\u884c initdb \u7684\u64cd\u4f5c\u7cfb\u7edf\u7528\u6237\u540d\u3002", "signature": {"url": "/docs/19/app-initdb.html#APP-INITDB-OPTION-USERNAME", "text": "-U username --username= username"}}, {"summary": "\u4f7f initdb \u63d0\u793a\u8f93\u5165\u8981\u8d4b\u7ed9\u5f15\u5bfc\u8d85\u7ea7\u7528\u6237\u7684\u5bc6\u7801\u3002\u5982\u679c\u4e0d\u6253\u7b97\u4f7f\u7528\u5bc6\u7801\u8ba4\u8bc1\uff0c\u8fd9\u4e00\u70b9\u5e76\u4e0d\u91cd\u8981\u3002\u5426\u5219\uff0c\u5728\u8bbe\u7f6e\u5bc6\u7801\u4e4b\u524d\u5c06\u65e0\u6cd5\u4f7f\u7528\u5bc6\u7801\u8ba4\u8bc1\u3002", "signature": {"url": "/docs/19/app-initdb.html#APP-INITDB-OPTION-PWPROMPT", "text": "-W --pwprompt"}}, {"summary": "\u8be5\u9009\u9879\u6307\u5b9a\u9884\u5199\u5f0f\u65e5\u5fd7\uff08WAL\uff09\u5e94\u5b58\u653e\u7684\u76ee\u5f55\u3002", "signature": {"url": "/docs/19/app-initdb.html#APP-INITDB-OPTION-WALDIR", "text": "-X directory --waldir= directory"}}, {"summary": "\u8bbe\u7f6e WAL \u6bb5\u5927\u5c0f\uff0c\u5355\u4f4d\u4e3a\u5146\u5b57\u8282\u3002\u8fd9\u662f WAL \u65e5\u5fd7\u4e2d\u6bcf\u4e2a\u72ec\u7acb\u6587\u4ef6\u7684\u5927\u5c0f\u3002\u9ed8\u8ba4\u5927\u5c0f\u4e3a 16 \u5146\u5b57\u8282\u3002\u53d6\u503c\u5fc5\u987b\u662f 1 \u5230 1024\uff08\u5146\u5b57\u8282\uff09\u4e4b\u95f4\u7684 2 \u7684\u5e42\u3002\u6b64\u9009\u9879\u53ea\u80fd\u5728\u521d\u59cb\u5316\u65f6\u8bbe\u7f6e\uff0c\u4e4b\u540e\u65e0\u6cd5\u66f4\u6539\u3002", "signature": {"url": "/docs/19/app-initdb.html#APP-INITDB-OPTION-WAL-SEGSIZE", "text": "--wal-segsize= size"}}, {"summary": "\u5728 initdb \u671f\u95f4\u5f3a\u5236\u5c06\u670d\u52a1\u5668\u53c2\u6570 name \u8bbe\u4e3a value\uff0c\u5e76\u628a\u8be5\u8bbe\u7f6e\u5199\u5165\u751f\u6210\u7684 postgresql.conf \u6587\u4ef6\uff0c\u4f7f\u5176\u5728\u4e4b\u540e\u7684\u670d\u52a1\u5668\u8fd0\u884c\u4e2d\u4e5f\u751f\u6548\u3002\u6b64\u9009\u9879\u53ef\u591a\u6b21\u4f7f\u7528\uff0c\u4ee5\u8bbe\u7f6e\u591a\u4e2a\u53c2\u6570\u3002\u5b83\u4e3b\u8981\u7528\u4e8e\u73af\u5883\u6761\u4ef6\u5bfc\u81f4\u670d\u52a1\u5668\u5b8c\u5168\u65e0\u6cd5\u4f7f\u7528\u9ed8\u8ba4\u53c2\u6570\u542f\u52a8\u7684\u60c5\u51b5\u3002", "signature": {"url": "/docs/19/app-initdb.html#APP-INITDB-OPTION-SET", "text": "-c name = value --set name = value"}}, {"summary": "\u6253\u5370\u5f15\u5bfc\u540e\u7aef\u7684\u8c03\u8bd5\u8f93\u51fa\uff0c\u4ee5\u53ca\u5c11\u91cf\u666e\u901a\u7528\u6237\u901a\u5e38\u4e0d\u611f\u5174\u8da3\u7684\u5176\u4ed6\u6d88\u606f\u3002\u5f15\u5bfc\u540e\u7aef\u662f initdb \u7528\u6765\u521b\u5efa\u7cfb\u7edf\u76ee\u5f55\u8868\u7684\u7a0b\u5e8f\u3002\u8be5\u9009\u9879\u4f1a\u4ea7\u751f\u5927\u91cf\u6781\u5176\u4e4f\u5473\u7684\u8f93\u51fa\u3002", "signature": {"url": "/docs/19/app-initdb.html#APP-INITDB-OPTION-DEBUG", "text": "-d --debug"}}, {"summary": "\u4f7f\u7528 debug_discard_caches=1 \u9009\u9879\u8fd0\u884c\u5f15\u5bfc\u540e\u7aef\u3002\u8fd9\u4f1a\u82b1\u8d39\u5f88\u957f\u65f6\u95f4\uff0c\u53ea\u5bf9\u6df1\u5ea6\u8c03\u8bd5\u6709\u7528\u3002", "signature": {"url": "/docs/19/app-initdb.html#APP-INITDB-OPTION-DISCARD-CACHES", "text": "--discard-caches"}}, {"summary": "\u6307\u5b9a initdb \u521d\u59cb\u5316\u6570\u636e\u5e93\u96c6\u7c07\u65f6\u5e94\u5230\u54ea\u91cc\u67e5\u627e\u5176\u8f93\u5165\u6587\u4ef6\u3002\u901a\u5e38\u4e0d\u9700\u8981\u8fd9\u6837\u505a\u3002\u82e5\u9700\u8981\u663e\u5f0f\u6307\u5b9a\u5176\u4f4d\u7f6e\uff0c\u7cfb\u7edf\u4f1a\u63d0\u793a\u3002", "signature": {"url": "/docs/19/app-initdb.html#APP-INITDB-OPTION-L", "text": "-L directory"}}, {"summary": "\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c\u5982\u679c initdb \u53d1\u73b0\u67d0\u4e2a\u9519\u8bef\u4f7f\u5176\u65e0\u6cd5\u5b8c\u6574\u521b\u5efa\u6570\u636e\u5e93\u96c6\u7c07\uff0c\u5c31\u4f1a\u5220\u9664\u5b83\u5728\u53d1\u73b0\u65e0\u6cd5\u5b8c\u6210\u4efb\u52a1\u4e4b\u524d\u53ef\u80fd\u5df2\u521b\u5efa\u7684\u6240\u6709\u6587\u4ef6\u3002\u8be5\u9009\u9879\u4f1a\u7981\u6b62\u8fd9\u79cd\u6e05\u7406\uff0c\u56e0\u6b64\u5bf9\u8c03\u8bd5\u6709\u7528\u3002", "signature": {"url": "/docs/19/app-initdb.html#APP-INITDB-OPTION-NO-CLEAN", "text": "-n --no-clean"}}, {"summary": "\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c initdb \u4f1a\u7b49\u5f85\u6240\u6709\u6587\u4ef6\u90fd\u5b89\u5168\u5199\u5165\u78c1\u76d8\u3002\u8be5\u9009\u9879\u4f7f initdb \u5728\u4e0d\u7b49\u5f85\u7684\u60c5\u51b5\u4e0b\u8fd4\u56de\uff0c\u901f\u5ea6\u66f4\u5feb\uff0c\u4f46\u8fd9\u610f\u5473\u7740\u5982\u679c\u540e\u7eed\u64cd\u4f5c\u7cfb\u7edf\u5d29\u6e83\uff0c\u6570\u636e\u76ee\u5f55\u53ef\u80fd\u4f1a\u635f\u574f\u3002\u901a\u5e38\uff0c\u8be5\u9009\u9879\u9002\u7528\u4e8e\u6d4b\u8bd5\uff0c\u4f46\u4e0d\u5e94\u7528\u4e8e\u521b\u5efa\u751f\u4ea7\u73af\u5883\u5b89\u88c5\u3002", "signature": {"url": "/docs/19/app-initdb.html#APP-INITDB-OPTION-NO-SYNC", "text": "-N --no-sync"}}, {"summary": "\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c initdb \u4f1a\u5c06\u6240\u6709\u6570\u636e\u5e93\u6587\u4ef6\u5b89\u5168\u5730\u5199\u5165\u78c1\u76d8\u3002\u8be5\u9009\u9879\u6307\u793a initdb \u8df3\u8fc7\u540c\u6b65\u5404\u4e2a\u6570\u636e\u5e93\u76ee\u5f55\u4e2d\u7684\u6240\u6709\u6587\u4ef6\u3001\u8fd9\u4e9b\u6570\u636e\u5e93\u76ee\u5f55\u672c\u8eab\u4ee5\u53ca\u8868\u7a7a\u95f4\u76ee\u5f55\uff0c\u4e5f\u5c31\u662f base \u5b50\u76ee\u5f55\u4e2d\u7684\u6240\u6709\u5185\u5bb9\u548c\u4efb\u4f55\u5176\u4ed6\u8868\u7a7a\u95f4\u76ee\u5f55\u3002\u5176\u4ed6\u6587\u4ef6\uff0c\u4f8b\u5982 pg_wal \u548c pg_xact \u4e2d\u7684\u6587\u4ef6\uff0c\u4ecd\u4f1a\u88ab\u540c\u6b65\uff0c\u9664\u975e\u4e5f\u6307\u5b9a\u4e86 --no-sync \u3002", "signature": {"url": "/docs/19/app-initdb.html#APP-INITDB-OPTION-NO-SYNC-DATA-FILES", "text": "--no-sync-data-files"}}, {"summary": "\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c initdb \u4f1a\u5728\u5176\u8f93\u51fa\u672b\u5c3e\u5199\u51fa\u5982\u4f55\u542f\u52a8\u96c6\u7c07\u7684\u8bf4\u660e\u3002\u8be5\u9009\u9879\u4f1a\u7701\u7565\u8fd9\u4e9b\u8bf4\u660e\u3002\u5b83\u4e3b\u8981\u4f9b\u90a3\u4e9b\u5bf9 initdb \u8fdb\u884c\u5e73\u53f0\u7279\u5b9a\u5c01\u88c5\u7684\u5de5\u5177\u4f7f\u7528\uff0c\u56e0\u4e3a\u5728\u8fd9\u79cd\u60c5\u51b5\u4e0b\u90a3\u4e9b\u8bf4\u660e\u5f88\u53ef\u80fd\u5e76\u4e0d\u6b63\u786e\u3002", "signature": {"url": "/docs/19/app-initdb.html#APP-INITDB-OPTION-NO-INSTRUCTIONS", "text": "--no-instructions"}}, {"summary": "\u663e\u793a\u5185\u90e8\u8bbe\u7f6e\u5e76\u9000\u51fa\uff0c\u4e0d\u6267\u884c\u5176\u4ed6\u64cd\u4f5c\u3002\u53ef\u7528\u4e8e\u8c03\u8bd5 initdb \u7684\u5b89\u88c5\u3002", "signature": {"url": "/docs/19/app-initdb.html#APP-INITDB-OPTION-SHOW", "text": "-s --show"}}, {"summary": "\u8bbe\u4e3a fsync \uff08\u9ed8\u8ba4\u503c\uff09\u65f6\uff0c initdb \u4f1a\u9012\u5f52\u6253\u5f00\u5e76\u540c\u6b65\u6570\u636e\u76ee\u5f55\u4e2d\u7684\u6240\u6709\u6587\u4ef6\u3002\u67e5\u627e\u6587\u4ef6\u65f6\u4f1a\u8ddf\u968f WAL \u76ee\u5f55\u548c\u6bcf\u4e2a\u5df2\u914d\u7f6e\u8868\u7a7a\u95f4\u7684\u7b26\u53f7\u94fe\u63a5\u3002", "signature": {"url": "/docs/19/app-initdb.html#APP-INITDB-OPTION-SYNC-METHOD", "text": "--sync-method= method"}}, {"summary": "\u5c06\u6240\u6709\u6570\u636e\u5e93\u6587\u4ef6\u5b89\u5168\u5730\u5199\u5165\u78c1\u76d8\u5e76\u9000\u51fa\u3002\u8fd9\u4e0d\u4f1a\u6267\u884c\u4efb\u4f55\u5e38\u89c4\u7684 initdb \u64cd\u4f5c\u3002\u901a\u5e38\uff0c\u8be5\u9009\u9879\u53ef\u7528\u4e8e\u5728\u5c06 fsync \u4ece off \u6539\u4e3a on \u540e\uff0c\u786e\u4fdd\u80fd\u591f\u53ef\u9760\u6062\u590d\u3002", "signature": {"url": "/docs/19/app-initdb.html#APP-INITDB-OPTION-SYNC-ONLY", "text": "-S --sync-only"}}, {"summary": "\u6253\u5370 initdb \u7248\u672c\u5e76\u9000\u51fa\u3002", "signature": {"url": "/docs/19/app-initdb.html#APP-INITDB-OPTION-VERSION", "text": "-V --version"}}, {"summary": "\u663e\u793a\u6709\u5173 initdb \u547d\u4ee4\u884c\u53c2\u6570\u7684\u5e2e\u52a9\u5e76\u9000\u51fa\u3002", "signature": {"url": "/docs/19/app-initdb.html#APP-INITDB-OPTION-HELP", "text": "-? --help"}}], "title": "\u624b\u518c\u4e2d\u7684\u9009\u9879", "columns": [{"key": "signature", "label": "\u9009\u9879\u4e0e\u53c2\u6570"}, {"key": "summary", "label": "\u8bf4\u660e"}]}, {"key": "environment", "rows": [{"name": "PGDATA", "description": "\u6307\u5b9a\u6570\u636e\u5e93\u96c6\u7c07\u5e94\u5b58\u653e\u7684\u76ee\u5f55\uff1b\u53ef\u4f7f\u7528 -D \u9009\u9879\u8986\u76d6\u3002"}, {"name": "PG_COLOR", "description": "\u6307\u5b9a\u8bca\u65ad\u6d88\u606f\u662f\u5426\u4f7f\u7528\u989c\u8272\u3002\u53ef\u9009\u503c\u4e3a always \u3001 auto \u548c never \u3002"}, {"name": "TZ", "description": "\u6307\u5b9a\u6240\u521b\u5efa\u6570\u636e\u5e93\u96c6\u7c07\u7684\u9ed8\u8ba4\u65f6\u533a\u3002\u8be5\u503c\u5e94\u4e3a\u5b8c\u6574\u7684\u65f6\u533a\u540d\u79f0\uff08\u89c1 \u7b2c 8.5.3 \u8282 \uff09\u3002"}], "title": "\u73af\u5883\u53d8\u91cf", "columns": [{"key": "name", "label": "\u53d8\u91cf"}, {"key": "description", "label": "\u542b\u4e49"}]}], "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": "https://pg.center/docs/19/app-initdb.html", "file": "app-initdb.html", "label": "19beta4 English manual \u00b7 app-initdb.html", "anchor": "", "sha256": "652f26f048f167b477dd6b166872da548b8a95cec68490ef940d9bb7a95e1b46", "language": "en", "original_url": "/docs/19/app-initdb.html"}, {"url": "https://pg.center/docs/19/reference-server.html", "file": "reference-server.html", "label": "Server applications inventory", "anchor": "", "sha256": "425b070323b448b5516d2cb4e9e4ac77efb5d19dd4e8005d0ae1c61db9ec78e6", "language": "en", "original_url": "/docs/19/reference-server.html"}], "sections": [], "synopsis": ["initdb [ option ...] [ --pgdata | -D ] datadir"], "signature": "initdb [ option ...] [ --pgdata | -D ] datadir", "description": ["initdb \u2014 \u521b\u5efa\u4e00\u4e2a\u65b0\u7684 PostgreSQL \u6570\u636e\u5e93\u96c6\u7c07"], "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 lang=\"zh\">initdb \u2014 \u521b\u5efa\u4e00\u4e2a\u65b0\u7684<span class=\"productname\">PostgreSQL</span>\u6570\u636e\u5e93\u96c6\u7c07</p>\n</div>\n<div class=\"refsynopsisdiv\">\n<h2 lang=\"zh\">\u5927\u7eb2</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 lang=\"zh\">\u8bf4\u660e</h2>\n<p lang=\"zh\"><code class=\"command\">initdb</code>\u521b\u5efa\u4e00\u4e2a\u65b0\u7684<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=\"\u6570\u636e\u5e93\u96c6\u7c07\">\u6570\u636e\u5e93\u96c6\u7c07</a>\u3002</p>\n<p lang=\"zh\">\u521b\u5efa\u6570\u636e\u5e93\u96c6\u7c07\u5305\u62ec\u521b\u5efa\u7528\u4e8e\u5b58\u653e\u96c6\u7c07\u6570\u636e\u7684<a class=\"glossterm\" href=\"/docs/19/glossary.html#GLOSSARY-DATA-DIRECTORY\"></a><a class=\"glossterm\" href=\"/docs/19/glossary.html#GLOSSARY-DATA-DIRECTORY\" title=\"\u6570\u636e\u76ee\u5f55\">\u76ee\u5f55</a>\uff0c\u751f\u6210\u5171\u4eab\u7cfb\u7edf\u76ee\u5f55\u8868\uff08\u5c5e\u4e8e\u6574\u4e2a\u96c6\u7c07\u800c\u4e0d\u662f\u67d0\u4e2a\u7279\u5b9a\u6570\u636e\u5e93\u7684\u8868\uff09\uff0c\u4ee5\u53ca\u521b\u5efa <code class=\"literal\">postgres</code>\u3001<code class=\"literal\">template1</code> \u548c <code class=\"literal\">template0</code> \u6570\u636e\u5e93\u3002<code class=\"literal\">postgres</code> \u6570\u636e\u5e93\u662f\u4e00\u4e2a\u9ed8\u8ba4\u6570\u636e\u5e93\uff0c\u4f9b\u7528\u6237\u3001\u5de5\u5177\u7a0b\u5e8f\u548c\u7b2c\u4e09\u65b9\u5e94\u7528\u7a0b\u5e8f\u4f7f\u7528\u3002<code class=\"literal\">template1</code> \u548c <code class=\"literal\">template0</code> \u7528\u4f5c\u540e\u7eed<code class=\"command\">CREATE DATABASE</code>\u547d\u4ee4\u590d\u5236\u7684\u6e90\u6570\u636e\u5e93\u3002<code class=\"literal\">template0</code> \u4e0d\u5e94\u88ab\u4fee\u6539\uff0c\u4f46\u53ef\u4ee5\u5411 <code class=\"literal\">template1</code> \u4e2d\u6dfb\u52a0\u5bf9\u8c61\uff0c\u8fd9\u4e9b\u5bf9\u8c61\u9ed8\u8ba4\u4f1a\u88ab\u590d\u5236\u5230\u4ee5\u540e\u521b\u5efa\u7684\u6570\u636e\u5e93\u4e2d\u3002\u66f4\u591a\u7ec6\u8282\u89c1<a class=\"xref\" href=\"/docs/19/manage-ag-templatedbs.html\" title=\"22.3.\u00a0\u6a21\u677f\u6570\u636e\u5e93\">\u7b2c\u00a022.3\u00a0\u8282</a>\u3002</p>\n<p lang=\"zh\">\u867d\u7136<code class=\"command\">initdb</code>\u4f1a\u5c1d\u8bd5\u521b\u5efa\u6307\u5b9a\u7684\u6570\u636e\u76ee\u5f55\uff0c\u4f46\u5982\u679c\u6240\u9700\u6570\u636e\u76ee\u5f55\u7684\u7236\u76ee\u5f55\u5f52 root \u6240\u6709\uff0c\u5b83\u53ef\u80fd\u6ca1\u6709\u8db3\u591f\u7684\u6743\u9650\u3002\u8981\u5728\u8fd9\u79cd\u73af\u5883\u4e2d\u521d\u59cb\u5316\uff0c\u53ef\u5148\u7531 root \u521b\u5efa\u4e00\u4e2a\u7a7a\u7684\u6570\u636e\u76ee\u5f55\uff0c\u7136\u540e\u7528<code class=\"command\">chown</code>\u5c06\u8be5\u76ee\u5f55\u7684\u6240\u6709\u6743\u8d4b\u4e88\u6570\u636e\u5e93\u7528\u6237\u8d26\u6237\uff0c\u518d\u7528 <code class=\"command\">su</code>\u5207\u6362\u4e3a\u8be5\u6570\u636e\u5e93\u7528\u6237\u6765\u8fd0\u884c<code class=\"command\">initdb</code>\u3002</p>\n<p lang=\"zh\"><code class=\"command\">initdb</code>\u5fc5\u987b\u4ee5\u5c06\u62e5\u6709\u670d\u52a1\u5668\u8fdb\u7a0b\u7684\u7528\u6237\u8eab\u4efd\u8fd0\u884c\uff0c\u56e0\u4e3a\u670d\u52a1\u5668\u9700\u8981\u8bbf\u95ee <code class=\"command\">initdb</code>\u521b\u5efa\u7684\u6587\u4ef6\u548c\u76ee\u5f55\u3002\u7531\u4e8e\u670d\u52a1\u5668\u4e0d\u80fd\u4ee5 root \u8eab\u4efd\u8fd0\u884c\uff0c\u56e0\u6b64\u4e5f\u7edd\u4e0d\u80fd\u4ee5 root \u8eab\u4efd\u8fd0\u884c<code class=\"command\">initdb</code>\u3002\uff08\u5b9e\u9645\u4e0a\u5b83\u4f1a\u62d2\u7edd\u8fd9\u6837\u505a\u3002\uff09</p>\n<p lang=\"zh\">\u51fa\u4e8e\u5b89\u5168\u539f\u56e0\uff0c<code class=\"command\">initdb</code>\u521b\u5efa\u7684\u65b0\u96c6\u7c07\u9ed8\u8ba4\u53ea\u6709\u96c6\u7c07\u62e5\u6709\u8005\u53ef\u4ee5\u8bbf\u95ee\u3002<code class=\"option\">--allow-group-access</code> \u9009\u9879\u5141\u8bb8\u4e0e\u96c6\u7c07\u62e5\u6709\u8005\u540c\u7ec4\u7684\u4efb\u4f55\u7528\u6237\u8bfb\u53d6\u96c6\u7c07\u4e2d\u7684\u6587\u4ef6\u3002\u8fd9\u5bf9\u7531\u975e\u7279\u6743\u7528\u6237\u6267\u884c\u5907\u4efd\u5f88\u6709\u7528\u3002</p>\n<p lang=\"zh\"><code class=\"command\">initdb</code>\u4f1a\u521d\u59cb\u5316\u6570\u636e\u5e93\u96c6\u7c07\u7684\u9ed8\u8ba4\u533a\u57df\u8bbe\u7f6e\u548c\u5b57\u7b26\u96c6\u7f16\u7801\u3002\u8fd9\u4e9b\u8bbe\u7f6e\u4e5f\u53ef\u4ee5\u5728\u521b\u5efa\u6bcf\u4e2a\u6570\u636e\u5e93\u65f6\u5206\u522b\u8bbe\u7f6e\u3002<code class=\"command\">initdb</code>\u4e3a\u6a21\u677f\u6570\u636e\u5e93\u786e\u5b9a\u8fd9\u4e9b\u8bbe\u7f6e\uff0c\u5b83\u4eec\u5c06\u4f5c\u4e3a\u6240\u6709\u5176\u4ed6\u6570\u636e\u5e93\u7684\u9ed8\u8ba4\u503c\u3002</p>\n<p lang=\"zh\">\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c<code class=\"command\">initdb</code>\u4f7f\u7528<code class=\"literal\">libc</code>\u533a\u57df\u8bbe\u7f6e\u63d0\u4f9b\u7a0b\u5e8f\uff08\u89c1<a class=\"xref\" href=\"/docs/19/locale.html#LOCALE-PROVIDERS\" title=\"23.1.4.\u00a0\u533a\u57df\u8bbe\u7f6e\u63d0\u4f9b\u7a0b\u5e8f\">\u7b2c\u00a023.1.4\u00a0\u8282</a>\uff09\u3002<code class=\"literal\">libc</code>\u533a\u57df\u8bbe\u7f6e\u63d0\u4f9b\u7a0b\u5e8f\u4f1a\u4ece\u73af\u5883\u4e2d\u83b7\u53d6\u533a\u57df\u8bbe\u7f6e\uff0c\u5e76\u6839\u636e\u533a\u57df\u8bbe\u7f6e\u786e\u5b9a\u7f16\u7801\u3002</p>\n<p lang=\"zh\">\u8981\u4e3a\u96c6\u7c07\u9009\u62e9\u4e0d\u540c\u7684\u533a\u57df\u8bbe\u7f6e\uff0c\u8bf7\u4f7f\u7528<code class=\"option\">--locale</code>\u3002\u6b64\u5916\u8fd8\u6709\u5355\u72ec\u7684 <code class=\"option\">--lc-*</code> \u548c <code class=\"option\">--icu-locale</code> \u9009\u9879\uff08\u89c1\u4e0b\u6587\uff09\uff0c\u7528\u4e8e\u4e3a\u5404\u4e2a\u533a\u57df\u8bbe\u7f6e\u7c7b\u522b\u8bbe\u7f6e\u503c\u3002\u8bf7\u6ce8\u610f\uff0c\u4e0d\u540c\u533a\u57df\u8bbe\u7f6e\u7c7b\u522b\u4e4b\u95f4\u82e5\u8bbe\u7f6e\u4e0d\u4e00\u81f4\uff0c\u53ef\u80fd\u4ea7\u751f\u4e0d\u5408\u7406\u7684\u7ed3\u679c\uff0c\u56e0\u6b64\u5e94\u8c28\u614e\u4f7f\u7528\u3002</p>\n<p lang=\"zh\">\u4e5f\u53ef\u4ee5\u6307\u5b9a --locale-provider=icu\uff0c\u8ba9 initdb \u4f7f\u7528 ICU \u5e93\u63d0\u4f9b\u533a\u57df\u8bbe\u7f6e\u670d\u52a1\u3002\u670d\u52a1\u5668\u5fc5\u987b\u5728\u6784\u5efa\u65f6\u542f\u7528 ICU \u652f\u6301\u3002\u4f7f\u7528 --icu-locale \u9009\u9879\u9009\u62e9\u5177\u4f53\u7684 ICU \u533a\u57df ID\u3002\u6ce8\u610f\uff0c\u51fa\u4e8e\u5b9e\u73b0\u65b9\u9762\u7684\u539f\u56e0\u4ee5\u53ca\u5bf9\u65e7\u4ee3\u7801\u7684\u517c\u5bb9\uff0c\u5373\u4f7f\u4f7f\u7528 ICU \u533a\u57df\u8bbe\u7f6e\u63d0\u4f9b\u8005\uff0cinitdb \u4ecd\u4f1a\u9009\u62e9\u5e76\u521d\u59cb\u5316 libc \u533a\u57df\u8bbe\u7f6e\u3002</p>\n<p lang=\"zh\"><code class=\"command\">initdb</code>\u8fd0\u884c\u65f6\u4f1a\u6253\u5370\u51fa\u5b83\u9009\u62e9\u7684\u533a\u57df\u8bbe\u7f6e\u3002\u5982\u679c\u6709\u590d\u6742\u9700\u6c42\u6216\u8005\u6307\u5b9a\u4e86\u591a\u4e2a\u9009\u9879\uff0c\u5efa\u8bae\u68c0\u67e5\u7ed3\u679c\u662f\u5426\u7b26\u5408\u9884\u671f\u3002</p>\n<p lang=\"zh\">\u6709\u5173\u533a\u57df\u8bbe\u7f6e\u7684\u66f4\u591a\u7ec6\u8282\u89c1<a class=\"xref\" href=\"/docs/19/locale.html\" title=\"23.1.\u00a0\u533a\u57df\u8bbe\u7f6e\u652f\u6301\">\u7b2c\u00a023.1\u00a0\u8282</a>\u3002</p>\n<p lang=\"zh\">\u8981\u4fee\u6539\u9ed8\u8ba4\u7f16\u7801\uff0c\u8bf7\u4f7f\u7528<code class=\"option\">--encoding</code>\u3002\u66f4\u591a\u7ec6\u8282\u89c1<a class=\"xref\" href=\"/docs/19/multibyte.html\" title=\"23.3.\u00a0\u5b57\u7b26\u96c6\u652f\u6301\">\u7b2c\u00a023.3\u00a0\u8282</a>\u3002</p>\n</div>\n<div class=\"refsect1\" id=\"id-1.9.5.3.6\">\n<h2 lang=\"zh\">\u9009\u9879</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 lang=\"zh\">\u8be5\u9009\u9879\u6307\u5b9a<code class=\"filename\">pg_hba.conf</code>\u4e2d\u672c\u5730\u7528\u6237\u9ed8\u8ba4\u4f7f\u7528\u7684\u8ba4\u8bc1\u65b9\u6cd5\uff08<code class=\"literal\">host</code> \u548c <code class=\"literal\">local</code> \u884c\uff09\u3002\u6709\u6548\u503c\u6982\u89c8\u89c1<a class=\"xref\" href=\"/docs/19/auth-pg-hba-conf.html\" title=\"20.1.\u00a0pg_hba.conf \u6587\u4ef6\">\u7b2c\u00a020.1\u00a0\u8282</a>\u3002</p>\n<p lang=\"zh\"><code class=\"command\">initdb</code>\u4f1a\u4f7f\u7528\u6307\u5b9a\u7684\u8ba4\u8bc1\u65b9\u6cd5\u9884\u586b\u5145<code class=\"filename\">pg_hba.conf</code> \u6761\u76ee\uff0c\u65e2\u7528\u4e8e\u975e\u590d\u5236\u8fde\u63a5\uff0c\u4e5f\u7528\u4e8e\u590d\u5236\u8fde\u63a5\u3002</p>\n<p lang=\"zh\">\u9664\u975e\u4fe1\u4efb\u7cfb\u7edf\u4e0a\u7684\u6240\u6709\u672c\u5730\u7528\u6237\uff0c\u5426\u5219\u4e0d\u8981\u4f7f\u7528<code class=\"literal\">trust</code>\u3002\u4e3a\u4e86\u4fbf\u4e8e\u5b89\u88c5\uff0c\u9ed8\u8ba4\u4f7f\u7528<code class=\"literal\">trust</code>\u3002</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 lang=\"zh\">\n<p>\u8be5\u9009\u9879\u6307\u5b9a<code class=\"filename\">pg_hba.conf</code>\u4e2d\u672c\u5730\u7528\u6237\u901a\u8fc7 TCP/IP \u8fde\u63a5\u65f6\uff08<code class=\"literal\">host</code> \u884c\uff09\u4f7f\u7528\u7684\u8ba4\u8bc1\u65b9\u6cd5\u3002</p>\n</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 lang=\"zh\">\n<p>\u8be5\u9009\u9879\u6307\u5b9a<code class=\"filename\">pg_hba.conf</code>\u4e2d\u672c\u5730\u7528\u6237\u901a\u8fc7 Unix \u57df\u5957\u63a5\u5b57\u8fde\u63a5\u65f6\uff08<code class=\"literal\">local</code> \u884c\uff09\u4f7f\u7528\u7684\u8ba4\u8bc1\u65b9\u6cd5\u3002</p>\n</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 lang=\"zh\">\n<p>\u8be5\u9009\u9879\u6307\u5b9a\u6570\u636e\u5e93\u96c6\u7c07\u5e94\u5b58\u653e\u7684\u76ee\u5f55\u3002\u8fd9\u662f<code class=\"command\">initdb</code>\u6240\u9700\u7684\u552f\u4e00\u4fe1\u606f\uff0c\u4f46\u4e5f\u53ef\u4ee5\u901a\u8fc7\u8bbe\u7f6e<code class=\"envar\">PGDATA</code>\u73af\u5883\u53d8\u91cf\u6765\u7701\u53bb\u663e\u5f0f\u5199\u51fa\u5b83\uff1b\u8fd9\u901a\u5e38\u66f4\u65b9\u4fbf\uff0c\u56e0\u4e3a\u6570\u636e\u5e93\u670d\u52a1\u5668\uff08<code class=\"command\">postgres</code>\uff09\u4e4b\u540e\u4e5f\u53ef\u4ee5\u901a\u8fc7\u540c\u4e00\u53d8\u91cf\u627e\u5230\u6570\u636e\u76ee\u5f55\u3002</p>\n</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 lang=\"zh\">\u9009\u62e9\u6a21\u677f\u6570\u636e\u5e93\u7684\u7f16\u7801\u3002\u8fd9\u4e5f\u5c06\u6210\u4e3a\u4ee5\u540e\u521b\u5efa\u7684\u4efb\u4f55\u6570\u636e\u5e93\u7684\u9ed8\u8ba4\u7f16\u7801\uff0c\u9664\u975e\u5728\u521b\u5efa\u65f6\u8986\u76d6\u5b83\u3002<span class=\"productname\">PostgreSQL</span>\u670d\u52a1\u5668\u652f\u6301\u7684\u5b57\u7b26\u96c6\u89c1<a class=\"xref\" href=\"/docs/19/multibyte.html#MULTIBYTE-CHARSET-SUPPORTED\" title=\"23.3.1.\u00a0\u652f\u6301\u7684\u5b57\u7b26\u96c6\">\u7b2c\u00a023.3.1\u00a0\u8282</a>\u3002</p>\n<p lang=\"zh\">\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c\u6a21\u677f\u6570\u636e\u5e93\u7684\u7f16\u7801\u7531\u533a\u57df\u8bbe\u7f6e\u51b3\u5b9a\u3002\u5982\u679c\u6307\u5b9a --no-locale\uff08\u6216\u7b49\u4ef7\u5730\u5c06\u533a\u57df\u8bbe\u7f6e\u8bbe\u4e3a C \u6216 POSIX\uff09\uff0c\u5219 ICU \u63d0\u4f9b\u8005\u7684\u9ed8\u8ba4\u7f16\u7801\u4e3a UTF8\uff0clibc \u63d0\u4f9b\u8005\u7684\u9ed8\u8ba4\u7f16\u7801\u4e3a SQL_ASCII\u3002</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 lang=\"zh\">\u5141\u8bb8\u4e0e\u96c6\u7fa4\u6240\u6709\u8005\u540c\u7ec4\u7684\u7528\u6237\u8bfb\u53d6 initdb \u521b\u5efa\u7684\u6240\u6709\u96c6\u7fa4\u6587\u4ef6\u3002Windows \u4e0d\u652f\u6301 POSIX \u98ce\u683c\u7684\u7ec4\u6743\u9650\uff0c\u56e0\u6b64\u4f1a\u5ffd\u7565\u6b64\u9009\u9879\u3002</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 lang=\"zh\">\n<p>\u5f53\u4f7f\u7528 ICU \u63d0\u4f9b\u7a0b\u5e8f\u65f6\uff0c\u6307\u5b9a ICU \u533a\u57df\u8bbe\u7f6e\u3002\u533a\u57df\u8bbe\u7f6e\u652f\u6301\u89c1<a class=\"xref\" href=\"/docs/19/locale.html\" title=\"23.1.\u00a0\u533a\u57df\u8bbe\u7f6e\u652f\u6301\">\u7b2c\u00a023.1\u00a0\u8282</a>\u3002</p>\n</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 lang=\"zh\">\n<p>\u6307\u5b9a\u9644\u52a0\u7684\u6392\u5e8f\u89c4\u5219\uff0c\u4ee5\u5b9a\u5236\u9ed8\u8ba4\u6392\u5e8f\u89c4\u5219\u7684\u884c\u4e3a\u3002\u8be5\u9009\u9879\u4ec5\u652f\u6301 ICU\u3002</p>\n</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 lang=\"zh\">\u5bf9\u6570\u636e\u9875\u542f\u7528\u6821\u9a8c\u548c\uff0c\u4ee5\u5e2e\u52a9\u68c0\u6d4b\u539f\u672c\u4f1a\u6084\u65e0\u58f0\u606f\u53d1\u751f\u7684\u3001\u7531 I/O \u7cfb\u7edf\u5bfc\u81f4\u7684\u635f\u574f\u3002\u8be5\u9879\u9ed8\u8ba4\u542f\u7528\uff1b\u4f7f\u7528<a class=\"xref\" href=\"/docs/19/app-initdb.html#APP-INITDB-NO-DATA-CHECKSUMS\"><code class=\"option\">--no-data-checksums</code></a>\u53ef\u7981\u7528\u6821\u9a8c\u548c\u3002</p>\n<p lang=\"zh\">\u542f\u7528\u6821\u9a8c\u548c\u53ef\u80fd\u4f1a\u5e26\u6765\u5c0f\u5e45\u6027\u80fd\u635f\u5931\u3002\u5982\u679c\u542f\u7528\uff0c\u5c31\u4f1a\u4e3a\u6240\u6709\u6570\u636e\u5e93\u4e2d\u7684\u6240\u6709\u5bf9\u8c61\u8ba1\u7b97\u6821\u9a8c\u548c\u3002\u6240\u6709\u6821\u9a8c\u548c\u5931\u8d25\u90fd\u4f1a\u5728 <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>\u89c6\u56fe\u4e2d\u62a5\u544a\u3002\u8be6\u89c1<a class=\"xref\" href=\"/docs/19/checksums.html\" title=\"28.2.\u00a0\u6570\u636e\u6821\u9a8c\u548c\">\u7b2c\u00a028.2\u00a0\u8282</a>\u3002</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 lang=\"zh\">\u8bbe\u7f6e\u6570\u636e\u5e93\u96c6\u7c07\u7684\u9ed8\u8ba4\u533a\u57df\u8bbe\u7f6e\u3002\u5982\u679c\u672a\u6307\u5b9a\u8be5\u9009\u9879\uff0c\u533a\u57df\u8bbe\u7f6e\u5c06\u7ee7\u627f\u81ea <code class=\"command\">initdb</code>\u8fd0\u884c\u65f6\u6240\u5728\u7684\u73af\u5883\u3002\u533a\u57df\u8bbe\u7f6e\u652f\u6301\u89c1<a class=\"xref\" href=\"/docs/19/locale.html\" title=\"23.1.\u00a0\u533a\u57df\u8bbe\u7f6e\u652f\u6301\">\u7b2c\u00a023.1\u00a0\u8282</a>\u3002</p>\n<p lang=\"zh\">\u5982\u679c<code class=\"option\">--locale-provider</code>\u4e3a<code class=\"literal\">builtin</code>\uff0c\u5219\u5fc5\u987b\u6307\u5b9a<code class=\"option\">--locale</code>\u6216<code class=\"option\">--builtin-locale</code>\uff0c\u5e76\u5c06\u5176\u8bbe\u7f6e\u4e3a<code class=\"literal\">C</code>\u3001<code class=\"literal\">C.UTF-8</code>\u6216 <code class=\"literal\">PG_UNICODE_FAST</code>\u3002</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 lang=\"zh\">\n<p>\u7c7b\u4f3c\u4e8e<code class=\"option\">--locale</code>\uff0c\u4f46\u53ea\u5728\u6307\u5b9a\u7684\u7c7b\u522b\u4e2d\u8bbe\u7f6e\u533a\u57df\u8bbe\u7f6e\u3002</p>\n</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 lang=\"zh\">\n<p>\u7b49\u4ef7\u4e8e<code class=\"option\">--locale=C</code>\u3002</p>\n</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 lang=\"zh\">\n<p>\u5f53\u4f7f\u7528 builtin \u63d0\u4f9b\u7a0b\u5e8f\u65f6\uff0c\u6307\u5b9a\u533a\u57df\u8bbe\u7f6e\u540d\u79f0\u3002\u533a\u57df\u8bbe\u7f6e\u652f\u6301\u89c1<a class=\"xref\" href=\"/docs/19/locale.html\" title=\"23.1.\u00a0\u533a\u57df\u8bbe\u7f6e\u652f\u6301\">\u7b2c\u00a023.1\u00a0\u8282</a>\u3002</p>\n</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 lang=\"zh\">\n<p>\u8be5\u9009\u9879\u8bbe\u7f6e\u65b0\u96c6\u7c07\u4e2d\u521b\u5efa\u7684\u6570\u636e\u5e93\u6240\u4f7f\u7528\u7684\u533a\u57df\u8bbe\u7f6e\u63d0\u4f9b\u7a0b\u5e8f\u3002\u540e\u7eed\u521b\u5efa\u65b0\u6570\u636e\u5e93\u65f6\uff0c\u53ef\u4ee5\u5728<code class=\"command\">CREATE DATABASE</code>\u547d\u4ee4\u4e2d\u8986\u76d6\u5b83\u3002\u9ed8\u8ba4\u503c\u4e3a <code class=\"literal\">libc</code>\uff08\u89c1<a class=\"xref\" href=\"/docs/19/locale.html#LOCALE-PROVIDERS\" title=\"23.1.4.\u00a0\u533a\u57df\u8bbe\u7f6e\u63d0\u4f9b\u7a0b\u5e8f\">\u7b2c\u00a023.1.4\u00a0\u8282</a>\uff09\u3002</p>\n</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 lang=\"zh\">\n<p>\u4e0d\u542f\u7528\u6570\u636e\u6821\u9a8c\u548c\u3002</p>\n</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 lang=\"zh\">\n<p>\u4f7f<code class=\"command\">initdb</code>\u4ece\u6587\u4ef6\u4e2d\u8bfb\u53d6\u5f15\u5bfc\u8d85\u7ea7\u7528\u6237\u7684\u5bc6\u7801\u3002\u6587\u4ef6\u7684\u7b2c\u4e00\u884c\u4f1a\u88ab\u5f53\u4f5c\u5bc6\u7801\u3002</p>\n</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 lang=\"zh\">\n<p>\u8bbe\u7f6e\u9ed8\u8ba4\u6587\u672c\u68c0\u7d22\u914d\u7f6e\u3002\u66f4\u591a\u4fe1\u606f\u89c1<a class=\"xref\" href=\"/docs/19/runtime-config-client.html#GUC-DEFAULT-TEXT-SEARCH-CONFIG\">default_text_search_config</a>\u3002</p>\n</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 lang=\"zh\">\n<p>\u8bbe\u7f6e<a class=\"glossterm\" href=\"/docs/19/glossary.html#GLOSSARY-BOOTSTRAP-SUPERUSER\"></a><a class=\"glossterm\" href=\"/docs/19/glossary.html#GLOSSARY-BOOTSTRAP-SUPERUSER\" title=\"\u5f15\u5bfc\u8d85\u7ea7\u7528\u6237\">\u5f15\u5bfc\u8d85\u7ea7\u7528\u6237</a>\u7684\u7528\u6237\u540d\u3002\u9ed8\u8ba4\u503c\u662f\u8fd0\u884c<code class=\"command\">initdb</code>\u7684\u64cd\u4f5c\u7cfb\u7edf\u7528\u6237\u540d\u3002</p>\n</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 lang=\"zh\">\n<p>\u4f7f<code class=\"command\">initdb</code>\u63d0\u793a\u8f93\u5165\u8981\u8d4b\u7ed9\u5f15\u5bfc\u8d85\u7ea7\u7528\u6237\u7684\u5bc6\u7801\u3002\u5982\u679c\u4e0d\u6253\u7b97\u4f7f\u7528\u5bc6\u7801\u8ba4\u8bc1\uff0c\u8fd9\u4e00\u70b9\u5e76\u4e0d\u91cd\u8981\u3002\u5426\u5219\uff0c\u5728\u8bbe\u7f6e\u5bc6\u7801\u4e4b\u524d\u5c06\u65e0\u6cd5\u4f7f\u7528\u5bc6\u7801\u8ba4\u8bc1\u3002</p>\n</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 lang=\"zh\">\n<p>\u8be5\u9009\u9879\u6307\u5b9a\u9884\u5199\u5f0f\u65e5\u5fd7\uff08WAL\uff09\u5e94\u5b58\u653e\u7684\u76ee\u5f55\u3002</p>\n</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 lang=\"zh\">\u8bbe\u7f6e WAL \u6bb5\u5927\u5c0f\uff0c\u5355\u4f4d\u4e3a\u5146\u5b57\u8282\u3002\u8fd9\u662f WAL \u65e5\u5fd7\u4e2d\u6bcf\u4e2a\u72ec\u7acb\u6587\u4ef6\u7684\u5927\u5c0f\u3002\u9ed8\u8ba4\u5927\u5c0f\u4e3a 16 \u5146\u5b57\u8282\u3002\u53d6\u503c\u5fc5\u987b\u662f 1 \u5230 1024\uff08\u5146\u5b57\u8282\uff09\u4e4b\u95f4\u7684 2 \u7684\u5e42\u3002\u6b64\u9009\u9879\u53ea\u80fd\u5728\u521d\u59cb\u5316\u65f6\u8bbe\u7f6e\uff0c\u4e4b\u540e\u65e0\u6cd5\u66f4\u6539\u3002</p>\n<p lang=\"zh\">\u8c03\u6574\u8be5\u5927\u5c0f\u53ef\u80fd\u6709\u52a9\u4e8e\u63a7\u5236 WAL \u65e5\u5fd7\u4f20\u9001\u6216\u5f52\u6863\u7684\u7c92\u5ea6\u3002\u6b64\u5916\uff0c\u5728 WAL \u91cf\u5f88\u5927\u7684\u6570\u636e\u5e93\u4e2d\uff0c\u6bcf\u4e2a\u76ee\u5f55\u4e2d\u7684 WAL \u6587\u4ef6\u6570\u91cf\u53ef\u80fd\u4f1a\u6210\u4e3a\u6027\u80fd\u548c\u7ba1\u7406\u95ee\u9898\u3002\u589e\u5927 WAL \u6587\u4ef6\u5927\u5c0f\u4f1a\u51cf\u5c11 WAL \u6587\u4ef6\u6570\u91cf\u3002</p>\n</dd>\n</dl>\n</div>\n<p lang=\"zh\">\u8fd8\u63d0\u4f9b\u4e86\u5176\u4ed6\u4e00\u4e9b\u8f83\u5c11\u4f7f\u7528\u7684\u9009\u9879\uff1a</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 lang=\"zh\">\u5728 initdb \u671f\u95f4\u5f3a\u5236\u5c06\u670d\u52a1\u5668\u53c2\u6570 name \u8bbe\u4e3a value\uff0c\u5e76\u628a\u8be5\u8bbe\u7f6e\u5199\u5165\u751f\u6210\u7684 postgresql.conf \u6587\u4ef6\uff0c\u4f7f\u5176\u5728\u4e4b\u540e\u7684\u670d\u52a1\u5668\u8fd0\u884c\u4e2d\u4e5f\u751f\u6548\u3002\u6b64\u9009\u9879\u53ef\u591a\u6b21\u4f7f\u7528\uff0c\u4ee5\u8bbe\u7f6e\u591a\u4e2a\u53c2\u6570\u3002\u5b83\u4e3b\u8981\u7528\u4e8e\u73af\u5883\u6761\u4ef6\u5bfc\u81f4\u670d\u52a1\u5668\u5b8c\u5168\u65e0\u6cd5\u4f7f\u7528\u9ed8\u8ba4\u53c2\u6570\u542f\u52a8\u7684\u60c5\u51b5\u3002</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 lang=\"zh\">\n<p>\u6253\u5370\u5f15\u5bfc\u540e\u7aef\u7684\u8c03\u8bd5\u8f93\u51fa\uff0c\u4ee5\u53ca\u5c11\u91cf\u666e\u901a\u7528\u6237\u901a\u5e38\u4e0d\u611f\u5174\u8da3\u7684\u5176\u4ed6\u6d88\u606f\u3002\u5f15\u5bfc\u540e\u7aef\u662f <code class=\"command\">initdb</code>\u7528\u6765\u521b\u5efa\u7cfb\u7edf\u76ee\u5f55\u8868\u7684\u7a0b\u5e8f\u3002\u8be5\u9009\u9879\u4f1a\u4ea7\u751f\u5927\u91cf\u6781\u5176\u4e4f\u5473\u7684\u8f93\u51fa\u3002</p>\n</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 lang=\"zh\">\n<p>\u4f7f\u7528<code class=\"literal\">debug_discard_caches=1</code>\u9009\u9879\u8fd0\u884c\u5f15\u5bfc\u540e\u7aef\u3002\u8fd9\u4f1a\u82b1\u8d39\u5f88\u957f\u65f6\u95f4\uff0c\u53ea\u5bf9\u6df1\u5ea6\u8c03\u8bd5\u6709\u7528\u3002</p>\n</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 lang=\"zh\">\n<p>\u6307\u5b9a<code class=\"command\">initdb</code>\u521d\u59cb\u5316\u6570\u636e\u5e93\u96c6\u7c07\u65f6\u5e94\u5230\u54ea\u91cc\u67e5\u627e\u5176\u8f93\u5165\u6587\u4ef6\u3002\u901a\u5e38\u4e0d\u9700\u8981\u8fd9\u6837\u505a\u3002\u82e5\u9700\u8981\u663e\u5f0f\u6307\u5b9a\u5176\u4f4d\u7f6e\uff0c\u7cfb\u7edf\u4f1a\u63d0\u793a\u3002</p>\n</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 lang=\"zh\">\n<p>\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c\u5982\u679c<code class=\"command\">initdb</code>\u53d1\u73b0\u67d0\u4e2a\u9519\u8bef\u4f7f\u5176\u65e0\u6cd5\u5b8c\u6574\u521b\u5efa\u6570\u636e\u5e93\u96c6\u7c07\uff0c\u5c31\u4f1a\u5220\u9664\u5b83\u5728\u53d1\u73b0\u65e0\u6cd5\u5b8c\u6210\u4efb\u52a1\u4e4b\u524d\u53ef\u80fd\u5df2\u521b\u5efa\u7684\u6240\u6709\u6587\u4ef6\u3002\u8be5\u9009\u9879\u4f1a\u7981\u6b62\u8fd9\u79cd\u6e05\u7406\uff0c\u56e0\u6b64\u5bf9\u8c03\u8bd5\u6709\u7528\u3002</p>\n</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 lang=\"zh\">\n<p>\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c<code class=\"command\">initdb</code>\u4f1a\u7b49\u5f85\u6240\u6709\u6587\u4ef6\u90fd\u5b89\u5168\u5199\u5165\u78c1\u76d8\u3002\u8be5\u9009\u9879\u4f7f <code class=\"command\">initdb</code>\u5728\u4e0d\u7b49\u5f85\u7684\u60c5\u51b5\u4e0b\u8fd4\u56de\uff0c\u901f\u5ea6\u66f4\u5feb\uff0c\u4f46\u8fd9\u610f\u5473\u7740\u5982\u679c\u540e\u7eed\u64cd\u4f5c\u7cfb\u7edf\u5d29\u6e83\uff0c\u6570\u636e\u76ee\u5f55\u53ef\u80fd\u4f1a\u635f\u574f\u3002\u901a\u5e38\uff0c\u8be5\u9009\u9879\u9002\u7528\u4e8e\u6d4b\u8bd5\uff0c\u4f46\u4e0d\u5e94\u7528\u4e8e\u521b\u5efa\u751f\u4ea7\u73af\u5883\u5b89\u88c5\u3002</p>\n</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 lang=\"zh\">\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c<code class=\"command\">initdb</code>\u4f1a\u5c06\u6240\u6709\u6570\u636e\u5e93\u6587\u4ef6\u5b89\u5168\u5730\u5199\u5165\u78c1\u76d8\u3002\u8be5\u9009\u9879\u6307\u793a<code class=\"command\">initdb</code>\u8df3\u8fc7\u540c\u6b65\u5404\u4e2a\u6570\u636e\u5e93\u76ee\u5f55\u4e2d\u7684\u6240\u6709\u6587\u4ef6\u3001\u8fd9\u4e9b\u6570\u636e\u5e93\u76ee\u5f55\u672c\u8eab\u4ee5\u53ca\u8868\u7a7a\u95f4\u76ee\u5f55\uff0c\u4e5f\u5c31\u662f<code class=\"filename\">base</code>\u5b50\u76ee\u5f55\u4e2d\u7684\u6240\u6709\u5185\u5bb9\u548c\u4efb\u4f55\u5176\u4ed6\u8868\u7a7a\u95f4\u76ee\u5f55\u3002\u5176\u4ed6\u6587\u4ef6\uff0c\u4f8b\u5982<code class=\"literal\">pg_wal</code>\u548c<code class=\"literal\">pg_xact</code>\u4e2d\u7684\u6587\u4ef6\uff0c\u4ecd\u4f1a\u88ab\u540c\u6b65\uff0c\u9664\u975e\u4e5f\u6307\u5b9a\u4e86<code class=\"option\">--no-sync</code>\u3002</p>\n<p lang=\"zh\">\u8bf7\u6ce8\u610f\uff0c\u5982\u679c<code class=\"option\">--no-sync-data-files</code>\u4e0e <code class=\"option\">--sync-method=syncfs</code>\u4e00\u8d77\u4f7f\u7528\uff0c\u4e0a\u8ff0\u90e8\u5206\u6216\u5168\u90e8\u6587\u4ef6\u4e0e\u76ee\u5f55\u4ecd\u4f1a\u88ab\u540c\u6b65\uff0c\u56e0\u4e3a<code class=\"literal\">syncfs</code>\u5904\u7406\u7684\u662f\u6574\u4e2a\u6587\u4ef6\u7cfb\u7edf\u3002</p>\n<p lang=\"zh\">\u8be5\u9009\u9879\u4e3b\u8981\u4f9b\u90a3\u4e9b\u4f1a\u53e6\u884c\u786e\u4fdd\u8fd9\u4e9b\u88ab\u8df3\u8fc7\u6587\u4ef6\u5df2\u540c\u6b65\u5230\u78c1\u76d8\u7684\u5de5\u5177\u5728\u5185\u90e8\u4f7f\u7528\u3002</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 lang=\"zh\">\n<p>\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c<code class=\"command\">initdb</code>\u4f1a\u5728\u5176\u8f93\u51fa\u672b\u5c3e\u5199\u51fa\u5982\u4f55\u542f\u52a8\u96c6\u7c07\u7684\u8bf4\u660e\u3002\u8be5\u9009\u9879\u4f1a\u7701\u7565\u8fd9\u4e9b\u8bf4\u660e\u3002\u5b83\u4e3b\u8981\u4f9b\u90a3\u4e9b\u5bf9<code class=\"command\">initdb</code>\u8fdb\u884c\u5e73\u53f0\u7279\u5b9a\u5c01\u88c5\u7684\u5de5\u5177\u4f7f\u7528\uff0c\u56e0\u4e3a\u5728\u8fd9\u79cd\u60c5\u51b5\u4e0b\u90a3\u4e9b\u8bf4\u660e\u5f88\u53ef\u80fd\u5e76\u4e0d\u6b63\u786e\u3002</p>\n</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 lang=\"zh\">\n<p>\u663e\u793a\u5185\u90e8\u8bbe\u7f6e\u5e76\u9000\u51fa\uff0c\u4e0d\u6267\u884c\u5176\u4ed6\u64cd\u4f5c\u3002\u53ef\u7528\u4e8e\u8c03\u8bd5<span class=\"application\">initdb</span>\u7684\u5b89\u88c5\u3002</p>\n</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 lang=\"zh\">\u8bbe\u4e3a<code class=\"literal\">fsync</code>\uff08\u9ed8\u8ba4\u503c\uff09\u65f6\uff0c<code class=\"command\">initdb</code>\u4f1a\u9012\u5f52\u6253\u5f00\u5e76\u540c\u6b65\u6570\u636e\u76ee\u5f55\u4e2d\u7684\u6240\u6709\u6587\u4ef6\u3002\u67e5\u627e\u6587\u4ef6\u65f6\u4f1a\u8ddf\u968f WAL \u76ee\u5f55\u548c\u6bcf\u4e2a\u5df2\u914d\u7f6e\u8868\u7a7a\u95f4\u7684\u7b26\u53f7\u94fe\u63a5\u3002</p>\n<p lang=\"zh\">\u5728 Linux \u4e0a\uff0c\u4e5f\u53ef\u4ee5\u6539\u7528<code class=\"literal\">syncfs</code>\uff0c\u8bf7\u6c42\u64cd\u4f5c\u7cfb\u7edf\u540c\u6b65\u5305\u542b\u6570\u636e\u76ee\u5f55\u3001WAL \u6587\u4ef6\u4ee5\u53ca\u6bcf\u4e2a\u8868\u7a7a\u95f4\u7684\u6574\u4e2a\u6587\u4ef6\u7cfb\u7edf\u3002\u4f7f\u7528<code class=\"literal\">syncfs</code>\u65f6\u9700\u6ce8\u610f\u7684\u4e8b\u9879\u89c1<a class=\"xref\" href=\"/docs/19/runtime-config-error-handling.html#GUC-RECOVERY-INIT-SYNC-METHOD\">recovery_init_sync_method</a>\u3002</p>\n<p lang=\"zh\">\u4f7f\u7528<code class=\"option\">--no-sync</code>\u65f6\uff0c\u8be5\u9009\u9879\u4e0d\u8d77\u4f5c\u7528\u3002</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 lang=\"zh\">\n<p>\u5c06\u6240\u6709\u6570\u636e\u5e93\u6587\u4ef6\u5b89\u5168\u5730\u5199\u5165\u78c1\u76d8\u5e76\u9000\u51fa\u3002\u8fd9\u4e0d\u4f1a\u6267\u884c\u4efb\u4f55\u5e38\u89c4\u7684 <span class=\"application\">initdb</span>\u64cd\u4f5c\u3002\u901a\u5e38\uff0c\u8be5\u9009\u9879\u53ef\u7528\u4e8e\u5728\u5c06<a class=\"xref\" href=\"/docs/19/runtime-config-wal.html#GUC-FSYNC\">fsync</a>\u4ece<code class=\"literal\">off</code>\u6539\u4e3a<code class=\"literal\">on</code>\u540e\uff0c\u786e\u4fdd\u80fd\u591f\u53ef\u9760\u6062\u590d\u3002</p>\n</p>\n</dd>\n</dl>\n</div>\n<p lang=\"zh\">\u5176\u4ed6\u9009\u9879\uff1a</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 lang=\"zh\">\n<p>\u6253\u5370<span class=\"application\">initdb</span>\u7248\u672c\u5e76\u9000\u51fa\u3002</p>\n</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 lang=\"zh\">\n<p>\u663e\u793a\u6709\u5173<span class=\"application\">initdb</span>\u547d\u4ee4\u884c\u53c2\u6570\u7684\u5e2e\u52a9\u5e76\u9000\u51fa\u3002</p>\n</p>\n</dd>\n</dl>\n</div>\n</div>\n<div class=\"refsect1\" id=\"id-1.9.5.3.7\">\n<h2 lang=\"zh\">\u73af\u5883</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 lang=\"zh\">\n<p>\u6307\u5b9a\u6570\u636e\u5e93\u96c6\u7c07\u5e94\u5b58\u653e\u7684\u76ee\u5f55\uff1b\u53ef\u4f7f\u7528<code class=\"option\">-D</code>\u9009\u9879\u8986\u76d6\u3002</p>\n</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 lang=\"zh\">\n<p>\u6307\u5b9a\u8bca\u65ad\u6d88\u606f\u662f\u5426\u4f7f\u7528\u989c\u8272\u3002\u53ef\u9009\u503c\u4e3a <code class=\"literal\">always</code>\u3001<code class=\"literal\">auto</code>\u548c <code class=\"literal\">never</code>\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-INITDB-ENVIRONMENT-TZ\"><span class=\"term\"><code class=\"envar\">TZ</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6307\u5b9a\u6240\u521b\u5efa\u6570\u636e\u5e93\u96c6\u7c07\u7684\u9ed8\u8ba4\u65f6\u533a\u3002\u8be5\u503c\u5e94\u4e3a\u5b8c\u6574\u7684\u65f6\u533a\u540d\u79f0\uff08\u89c1<a class=\"xref\" href=\"/docs/19/datatype-datetime.html#DATATYPE-TIMEZONES\" title=\"8.5.3.\u00a0\u65f6\u533a\">\u7b2c\u00a08.5.3\u00a0\u8282</a>\uff09\u3002</p>\n</p>\n</dd>\n</dl>\n</div>\n</div>\n<div class=\"refsect1\" id=\"id-1.9.5.3.8\">\n<h2 lang=\"zh\">\u6ce8\u89e3</h2>\n<p lang=\"zh\">\u4e5f\u53ef\u4ee5\u901a\u8fc7 pg_ctl initdb \u8c03\u7528 initdb\u3002</p>\n</div>\n<div class=\"refsect1\" id=\"id-1.9.5.3.9\">\n<h2 lang=\"zh\">\u53e6\u89c1</h2><span class=\"simplelist\"><a class=\"xref\" href=\"https://pg.center/docs/19/app-pg-ctl.html\" title=\"pg_ctl\"><span class=\"refentrytitle\"><span class=\"application\">pg_ctl</span></span></a>, <a class=\"xref\" href=\"https://pg.center/docs/19/app-postgres.html\" title=\"postgres\"><span class=\"refentrytitle\"><span class=\"application\">postgres</span></span></a>, <a class=\"xref\" href=\"https://pg.center/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", "localization": {"status": "complete", "sources": [{"url": "/docs/19/app-initdb.html", "method": "same-major semantic node", "sha256": "deac5ad125a704cc427a21c43c512c1e80faa214910dd0aea7525265a4c51247", "language": "zh", "matched_nodes": ["#APP-INITDB/div[2]/p[1]", "#APP-INITDB/div[3]/h2[0]", "#APP-INITDB/div[4]/p[10]", "#APP-INITDB/div[4]/p[11]", "#APP-INITDB/div[4]/p[12]", "#APP-INITDB/div[4]/p[1]", "#APP-INITDB/div[4]/p[2]", "#APP-INITDB/div[4]/p[3]", "#APP-INITDB/div[4]/p[4]", "#APP-INITDB/div[4]/p[5]", "#APP-INITDB/div[4]/p[6]", "#APP-INITDB/div[4]/p[7]", "#APP-INITDB/div[4]/p[8]", "#APP-INITDB/div[5]/div[1]/dl[0]/dd[11]", "#APP-INITDB/div[5]/div[1]/dl[0]/dd[13]", "#APP-INITDB/div[5]/div[1]/dl[0]/dd[15]", "#APP-INITDB/div[5]/div[1]/dl[0]/dd[17]/p[0]", "#APP-INITDB/div[5]/div[1]/dl[0]/dd[17]/p[1]", "#APP-INITDB/div[5]/div[1]/dl[0]/dd[19]/p[0]", "#APP-INITDB/div[5]/div[1]/dl[0]/dd[19]/p[1]", "#APP-INITDB/div[5]/div[1]/dl[0]/dd[1]/p[0]", "#APP-INITDB/div[5]/div[1]/dl[0]/dd[1]/p[1]", "#APP-INITDB/div[5]/div[1]/dl[0]/dd[1]/p[2]", "#APP-INITDB/div[5]/div[1]/dl[0]/dd[21]", "#APP-INITDB/div[5]/div[1]/dl[0]/dd[23]", "#APP-INITDB/div[5]/div[1]/dl[0]/dd[25]", "#APP-INITDB/div[5]/div[1]/dl[0]/dd[27]", "#APP-INITDB/div[5]/div[1]/dl[0]/dd[29]", "#APP-INITDB/div[5]/div[1]/dl[0]/dd[31]", "#APP-INITDB/div[5]/div[1]/dl[0]/dd[33]", "#APP-INITDB/div[5]/div[1]/dl[0]/dd[35]", "#APP-INITDB/div[5]/div[1]/dl[0]/dd[37]", "#APP-INITDB/div[5]/div[1]/dl[0]/dd[39]", "#APP-INITDB/div[5]/div[1]/dl[0]/dd[3]", "#APP-INITDB/div[5]/div[1]/dl[0]/dd[41]/p[1]", "#APP-INITDB/div[5]/div[1]/dl[0]/dd[5]", "#APP-INITDB/div[5]/div[1]/dl[0]/dd[7]", "#APP-INITDB/div[5]/div[1]/dl[0]/dd[9]/p[0]", "#APP-INITDB/div[5]/div[3]/dl[0]/dd[11]", "#APP-INITDB/div[5]/div[3]/dl[0]/dd[13]/p[0]", "#APP-INITDB/div[5]/div[3]/dl[0]/dd[13]/p[1]", "#APP-INITDB/div[5]/div[3]/dl[0]/dd[13]/p[2]", "#APP-INITDB/div[5]/div[3]/dl[0]/dd[15]", "#APP-INITDB/div[5]/div[3]/dl[0]/dd[17]", "#APP-INITDB/div[5]/div[3]/dl[0]/dd[19]/p[0]", "#APP-INITDB/div[5]/div[3]/dl[0]/dd[19]/p[1]", "#APP-INITDB/div[5]/div[3]/dl[0]/dd[19]/p[2]", "#APP-INITDB/div[5]/div[3]/dl[0]/dd[21]", "#APP-INITDB/div[5]/div[3]/dl[0]/dd[3]", "#APP-INITDB/div[5]/div[3]/dl[0]/dd[5]", "#APP-INITDB/div[5]/div[3]/dl[0]/dd[7]", "#APP-INITDB/div[5]/div[3]/dl[0]/dd[9]", "#APP-INITDB/div[5]/div[5]/dl[0]/dd[1]", "#APP-INITDB/div[5]/div[5]/dl[0]/dd[3]", "#APP-INITDB/div[5]/p[2]", "#APP-INITDB/div[5]/p[4]", "#APP-INITDB/div[6]/div[1]/dl[0]/dd[1]", "#APP-INITDB/div[6]/div[1]/dl[0]/dd[3]", "#APP-INITDB/div[6]/div[1]/dl[0]/dd[5]", "#APP-INITDB/div[6]/h2[0]", "#APP-INITDB/div[7]/h2[0]", "#APP-INITDB/div[8]/h2[0]"]}], "language": "zh", "original_text": {"/versions/19/description/0": "initdb \u2014 create a new PostgreSQL database cluster", "/versions/19/facts/0/label": "Documented executable", "/versions/19/facts/1/label": "Executable version", "/versions/19/facts/2/label": "Reference inventory", "/versions/19/facts/2/value": "Server applications", "/versions/19/facts/3/label": "Option definition groups", "/versions/19/tables/0/title": "Documented options", "/versions/19/tables/1/title": "Environment variables", "/versions/19/tables/0/rows/0/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.", "/versions/19/tables/0/rows/1/summary": "This option specifies the authentication method for local users via TCP/IP connections used in pg_hba.conf ( host lines).", "/versions/19/tables/0/rows/2/summary": "This option specifies the authentication method for local users via Unix-domain socket connections used in pg_hba.conf ( local lines).", "/versions/19/tables/0/rows/3/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.", "/versions/19/tables/0/rows/4/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 .", "/versions/19/tables/0/rows/5/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.", "/versions/19/tables/0/rows/6/summary": "Specifies the ICU locale when the ICU provider is used. Locale support is described in Section 23.1 .", "/versions/19/tables/0/rows/7/summary": "Specifies additional collation rules to customize the behavior of the default collation. This is supported for ICU only.", "/versions/19/tables/0/rows/8/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.", "/versions/19/tables/0/rows/9/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 .", "/versions/19/tables/0/columns/0/label": "Option and arguments", "/versions/19/tables/0/columns/1/label": "Description", "/versions/19/tables/0/rows/10/summary": "Like --locale , but only sets the locale in the specified category.", "/versions/19/tables/0/rows/11/summary": "Equivalent to --locale=C .", "/versions/19/tables/0/rows/12/summary": "Specifies the locale name when the builtin provider is used. Locale support is described in Section 23.1 .", "/versions/19/tables/0/rows/13/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 ).", "/versions/19/tables/0/rows/14/summary": "Do not enable data checksums.", "/versions/19/tables/0/rows/15/summary": "Makes initdb read the bootstrap superuser's password from a file. The first line of the file is taken as the password.", "/versions/19/tables/0/rows/16/summary": "Sets the default text search configuration. See default_text_search_config for further information.", "/versions/19/tables/0/rows/17/summary": "Sets the user name of the bootstrap superuser . This defaults to the name of the operating-system user running initdb .", "/versions/19/tables/0/rows/18/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.", "/versions/19/tables/0/rows/19/summary": "This option specifies the directory where the write-ahead log should be stored.", "/versions/19/tables/0/rows/20/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.", "/versions/19/tables/0/rows/21/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.", "/versions/19/tables/0/rows/22/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.", "/versions/19/tables/0/rows/23/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.", "/versions/19/tables/0/rows/24/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.", "/versions/19/tables/0/rows/25/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.", "/versions/19/tables/0/rows/26/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.", "/versions/19/tables/0/rows/27/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.", "/versions/19/tables/0/rows/28/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.", "/versions/19/tables/0/rows/29/summary": "Show internal settings and exit, without doing anything else. This can be used to debug the initdb installation.", "/versions/19/tables/0/rows/30/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.", "/versions/19/tables/0/rows/31/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 .", "/versions/19/tables/0/rows/32/summary": "Print the initdb version and exit.", "/versions/19/tables/0/rows/33/summary": "Show help about initdb command line arguments, and exit.", "/versions/19/tables/1/columns/0/label": "Variable", "/versions/19/tables/1/columns/1/label": "Meaning", "/versions/19/tables/1/rows/0/description": "Specifies the directory where the database cluster is to be stored; can be overridden using the -D option.", "/versions/19/tables/1/rows/1/description": "Specifies whether to use color in diagnostic messages. Possible values are always , auto and never .", "/versions/19/tables/1/rows/2/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 )."}, "fallback_fields": [], "source_language": "en", "original_snapshot_sha256": "8ee2009d07db6a308ff664043f6c634dac3ed464cd988ccacce722fd8099f0a2"}, "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", "manual_language": "zh"}, "20": {"facts": [{"label": "\u624b\u518c\u4e2d\u7684\u53ef\u6267\u884c\u7a0b\u5e8f", "value": "initdb"}, {"label": "\u7a0b\u5e8f\u7248\u672c", "value": "20devel"}, {"label": "\u53c2\u8003\u6e05\u5355", "value": "\u670d\u52a1\u7aef\u7a0b\u5e8f"}, {"label": "\u9009\u9879\u5b9a\u4e49\u7ec4", "value": "34"}], "tables": [{"key": "options", "rows": [{"summary": "\u8be5\u9009\u9879\u6307\u5b9a pg_hba.conf \u4e2d\u672c\u5730\u7528\u6237\u9ed8\u8ba4\u4f7f\u7528\u7684\u8ba4\u8bc1\u65b9\u6cd5\uff08 host \u548c local \u884c\uff09\u3002\u6709\u6548\u503c\u6982\u89c8\u89c1 \u7b2c 20.1 \u8282 \u3002", "signature": {"url": "/docs/devel/app-initdb.html#APP-INITDB-OPTION-AUTH", "text": "-A authmethod --auth= authmethod"}}, {"summary": "\u8be5\u9009\u9879\u6307\u5b9a pg_hba.conf \u4e2d\u672c\u5730\u7528\u6237\u901a\u8fc7 TCP/IP \u8fde\u63a5\u65f6\uff08 host \u884c\uff09\u4f7f\u7528\u7684\u8ba4\u8bc1\u65b9\u6cd5\u3002", "signature": {"url": "/docs/devel/app-initdb.html#APP-INITDB-OPTION-AUTH-HOST", "text": "--auth-host= authmethod"}}, {"summary": "\u8be5\u9009\u9879\u6307\u5b9a pg_hba.conf \u4e2d\u672c\u5730\u7528\u6237\u901a\u8fc7 Unix \u57df\u5957\u63a5\u5b57\u8fde\u63a5\u65f6\uff08 local \u884c\uff09\u4f7f\u7528\u7684\u8ba4\u8bc1\u65b9\u6cd5\u3002", "signature": {"url": "/docs/devel/app-initdb.html#APP-INITDB-OPTION-AUTH-LOCAL", "text": "--auth-local= authmethod"}}, {"summary": "\u8be5\u9009\u9879\u6307\u5b9a\u6570\u636e\u5e93\u96c6\u7c07\u5e94\u5b58\u653e\u7684\u76ee\u5f55\u3002\u8fd9\u662f initdb \u6240\u9700\u7684\u552f\u4e00\u4fe1\u606f\uff0c\u4f46\u4e5f\u53ef\u4ee5\u901a\u8fc7\u8bbe\u7f6e PGDATA \u73af\u5883\u53d8\u91cf\u6765\u7701\u53bb\u663e\u5f0f\u5199\u51fa\u5b83\uff1b\u8fd9\u901a\u5e38\u66f4\u65b9\u4fbf\uff0c\u56e0\u4e3a\u6570\u636e\u5e93\u670d\u52a1\u5668\uff08 postgres \uff09\u4e4b\u540e\u4e5f\u53ef\u4ee5\u901a\u8fc7\u540c\u4e00\u53d8\u91cf\u627e\u5230\u6570\u636e\u76ee\u5f55\u3002", "signature": {"url": "/docs/devel/app-initdb.html#APP-INITDB-OPTION-PGDATA", "text": "-D datadir --pgdata= datadir"}}, {"summary": "\u9009\u62e9\u6a21\u677f\u6570\u636e\u5e93\u7684\u7f16\u7801\u3002\u8fd9\u4e5f\u5c06\u6210\u4e3a\u4ee5\u540e\u521b\u5efa\u7684\u4efb\u4f55\u6570\u636e\u5e93\u7684\u9ed8\u8ba4\u7f16\u7801\uff0c\u9664\u975e\u5728\u521b\u5efa\u65f6\u8986\u76d6\u5b83\u3002 PostgreSQL \u670d\u52a1\u5668\u652f\u6301\u7684\u5b57\u7b26\u96c6\u89c1 \u7b2c 23.3.1 \u8282 \u3002", "signature": {"url": "/docs/devel/app-initdb.html#APP-INITDB-OPTION-ENCODING", "text": "-E encoding --encoding= encoding"}}, {"summary": "\u5141\u8bb8\u4e0e\u96c6\u7c07\u62e5\u6709\u8005\u540c\u7ec4\u7684\u7528\u6237\u8bfb\u53d6\u7531 initdb \u521b\u5efa\u7684\u6240\u6709\u96c6\u7c07\u6587\u4ef6\u3002\u8be5\u9009\u9879\u5728 Windows \u4e0a\u4f1a\u88ab\u5ffd\u7565\uff0c\u56e0\u4e3a\u5b83\u4e0d\u652f\u6301 POSIX \u98ce\u683c\u7684\u7ec4\u6743\u9650\u3002", "signature": {"url": "/docs/devel/app-initdb.html#APP-INITDB-ALLOW-GROUP-ACCESS", "text": "-g --allow-group-access"}}, {"summary": "\u5f53\u4f7f\u7528 ICU \u63d0\u4f9b\u7a0b\u5e8f\u65f6\uff0c\u6307\u5b9a ICU \u533a\u57df\u8bbe\u7f6e\u3002\u533a\u57df\u8bbe\u7f6e\u652f\u6301\u89c1 \u7b2c 23.1 \u8282 \u3002", "signature": {"url": "/docs/devel/app-initdb.html#APP-INITDB-ICU-LOCALE", "text": "--icu-locale= locale"}}, {"summary": "\u6307\u5b9a\u9644\u52a0\u7684\u6392\u5e8f\u89c4\u5219\uff0c\u4ee5\u5b9a\u5236\u9ed8\u8ba4\u6392\u5e8f\u89c4\u5219\u7684\u884c\u4e3a\u3002\u8be5\u9009\u9879\u4ec5\u652f\u6301 ICU\u3002", "signature": {"url": "/docs/devel/app-initdb.html#APP-INITDB-ICU-RULES", "text": "--icu-rules= rules"}}, {"summary": "\u5bf9\u6570\u636e\u9875\u542f\u7528\u6821\u9a8c\u548c\uff0c\u4ee5\u5e2e\u52a9\u68c0\u6d4b\u539f\u672c\u4f1a\u6084\u65e0\u58f0\u606f\u53d1\u751f\u7684\u3001\u7531 I/O \u7cfb\u7edf\u5bfc\u81f4\u7684\u635f\u574f\u3002\u8be5\u9879\u9ed8\u8ba4\u542f\u7528\uff1b\u4f7f\u7528 --no-data-checksums \u53ef\u7981\u7528\u6821\u9a8c\u548c\u3002", "signature": {"url": "/docs/devel/app-initdb.html#APP-INITDB-DATA-CHECKSUMS", "text": "-k --data-checksums"}}, {"summary": "\u8bbe\u7f6e\u6570\u636e\u5e93\u96c6\u7c07\u7684\u9ed8\u8ba4\u533a\u57df\u8bbe\u7f6e\u3002\u5982\u679c\u672a\u6307\u5b9a\u8be5\u9009\u9879\uff0c\u533a\u57df\u8bbe\u7f6e\u5c06\u7ee7\u627f\u81ea initdb \u8fd0\u884c\u65f6\u6240\u5728\u7684\u73af\u5883\u3002\u533a\u57df\u8bbe\u7f6e\u652f\u6301\u89c1 \u7b2c 23.1 \u8282 \u3002", "signature": {"url": "/docs/devel/app-initdb.html#APP-INITDB-OPTION-LOCALE", "text": "--locale= locale"}}, {"summary": "\u7c7b\u4f3c\u4e8e --locale \uff0c\u4f46\u53ea\u5728\u6307\u5b9a\u7684\u7c7b\u522b\u4e2d\u8bbe\u7f6e\u533a\u57df\u8bbe\u7f6e\u3002", "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": "\u7b49\u4ef7\u4e8e --locale=C \u3002", "signature": {"url": "/docs/devel/app-initdb.html#APP-INITDB-OPTION-NO-LOCALE", "text": "--no-locale"}}, {"summary": "\u5f53\u4f7f\u7528 builtin \u63d0\u4f9b\u7a0b\u5e8f\u65f6\uff0c\u6307\u5b9a\u533a\u57df\u8bbe\u7f6e\u540d\u79f0\u3002\u533a\u57df\u8bbe\u7f6e\u652f\u6301\u89c1 \u7b2c 23.1 \u8282 \u3002", "signature": {"url": "/docs/devel/app-initdb.html#APP-INITDB-BUILTIN-LOCALE", "text": "--builtin-locale= locale"}}, {"summary": "\u8be5\u9009\u9879\u8bbe\u7f6e\u65b0\u96c6\u7c07\u4e2d\u521b\u5efa\u7684\u6570\u636e\u5e93\u6240\u4f7f\u7528\u7684\u533a\u57df\u8bbe\u7f6e\u63d0\u4f9b\u7a0b\u5e8f\u3002\u540e\u7eed\u521b\u5efa\u65b0\u6570\u636e\u5e93\u65f6\uff0c\u53ef\u4ee5\u5728 CREATE DATABASE \u547d\u4ee4\u4e2d\u8986\u76d6\u5b83\u3002\u9ed8\u8ba4\u503c\u4e3a libc \uff08\u89c1 \u7b2c 23.1.4 \u8282 \uff09\u3002", "signature": {"url": "/docs/devel/app-initdb.html#APP-INITDB-OPTION-LOCALE-PROVIDER", "text": "--locale-provider={ builtin | libc | icu }"}}, {"summary": "\u4e0d\u542f\u7528\u6570\u636e\u6821\u9a8c\u548c\u3002", "signature": {"url": "/docs/devel/app-initdb.html#APP-INITDB-NO-DATA-CHECKSUMS", "text": "--no-data-checksums"}}, {"summary": "\u4f7f initdb \u4ece\u6587\u4ef6\u4e2d\u8bfb\u53d6\u5f15\u5bfc\u8d85\u7ea7\u7528\u6237\u7684\u5bc6\u7801\u3002\u6587\u4ef6\u7684\u7b2c\u4e00\u884c\u4f1a\u88ab\u5f53\u4f5c\u5bc6\u7801\u3002", "signature": {"url": "/docs/devel/app-initdb.html#APP-INITDB-OPTION-PWFILE", "text": "--pwfile= filename"}}, {"summary": "\u8bbe\u7f6e\u9ed8\u8ba4\u6587\u672c\u68c0\u7d22\u914d\u7f6e\u3002\u66f4\u591a\u4fe1\u606f\u89c1 default_text_search_config \u3002", "signature": {"url": "/docs/devel/app-initdb.html#APP-INITDB-OPTION-TEXT-SEARCH-CONFIG", "text": "-T config --text-search-config= config"}}, {"summary": "\u8bbe\u7f6e \u5f15\u5bfc\u8d85\u7ea7\u7528\u6237 \u7684\u7528\u6237\u540d\u3002\u9ed8\u8ba4\u503c\u662f\u8fd0\u884c initdb \u7684\u64cd\u4f5c\u7cfb\u7edf\u7528\u6237\u540d\u3002", "signature": {"url": "/docs/devel/app-initdb.html#APP-INITDB-OPTION-USERNAME", "text": "-U username --username= username"}}, {"summary": "\u4f7f initdb \u63d0\u793a\u8f93\u5165\u8981\u8d4b\u7ed9\u5f15\u5bfc\u8d85\u7ea7\u7528\u6237\u7684\u5bc6\u7801\u3002\u5982\u679c\u4e0d\u6253\u7b97\u4f7f\u7528\u5bc6\u7801\u8ba4\u8bc1\uff0c\u8fd9\u4e00\u70b9\u5e76\u4e0d\u91cd\u8981\u3002\u5426\u5219\uff0c\u5728\u8bbe\u7f6e\u5bc6\u7801\u4e4b\u524d\u5c06\u65e0\u6cd5\u4f7f\u7528\u5bc6\u7801\u8ba4\u8bc1\u3002", "signature": {"url": "/docs/devel/app-initdb.html#APP-INITDB-OPTION-PWPROMPT", "text": "-W --pwprompt"}}, {"summary": "\u8be5\u9009\u9879\u6307\u5b9a\u9884\u5199\u5f0f\u65e5\u5fd7\uff08WAL\uff09\u5e94\u5b58\u653e\u7684\u76ee\u5f55\u3002", "signature": {"url": "/docs/devel/app-initdb.html#APP-INITDB-OPTION-WALDIR", "text": "-X directory --waldir= directory"}}, {"summary": "\u8bbe\u7f6e WAL \u6bb5\u5927\u5c0f\uff0c\u5355\u4f4d\u4e3a\u5146\u5b57\u8282\u3002\u8fd9\u662f WAL \u65e5\u5fd7\u4e2d\u6bcf\u4e2a\u72ec\u7acb\u6587\u4ef6\u7684\u5927\u5c0f\u3002\u9ed8\u8ba4\u5927\u5c0f\u4e3a 16 \u5146\u5b57\u8282\u3002\u53d6\u503c\u5fc5\u987b\u662f 1 \u5230 1024\uff08\u5146\u5b57\u8282\uff09\u4e4b\u95f4\u7684 2 \u7684\u5e42\u3002\u6b64\u9009\u9879\u53ea\u80fd\u5728\u521d\u59cb\u5316\u65f6\u8bbe\u7f6e\uff0c\u4e4b\u540e\u65e0\u6cd5\u66f4\u6539\u3002", "signature": {"url": "/docs/devel/app-initdb.html#APP-INITDB-OPTION-WAL-SEGSIZE", "text": "--wal-segsize= size"}}, {"summary": "\u5728 initdb \u671f\u95f4\u5f3a\u5236\u5c06\u670d\u52a1\u5668\u53c2\u6570 name \u8bbe\u4e3a value\uff0c\u5e76\u628a\u8be5\u8bbe\u7f6e\u5199\u5165\u751f\u6210\u7684 postgresql.conf \u6587\u4ef6\uff0c\u4f7f\u5176\u5728\u4e4b\u540e\u7684\u670d\u52a1\u5668\u8fd0\u884c\u4e2d\u4e5f\u751f\u6548\u3002\u6b64\u9009\u9879\u53ef\u591a\u6b21\u4f7f\u7528\uff0c\u4ee5\u8bbe\u7f6e\u591a\u4e2a\u53c2\u6570\u3002\u5b83\u4e3b\u8981\u7528\u4e8e\u73af\u5883\u6761\u4ef6\u5bfc\u81f4\u670d\u52a1\u5668\u5b8c\u5168\u65e0\u6cd5\u4f7f\u7528\u9ed8\u8ba4\u53c2\u6570\u542f\u52a8\u7684\u60c5\u51b5\u3002", "signature": {"url": "/docs/devel/app-initdb.html#APP-INITDB-OPTION-SET", "text": "-c name = value --set name = value"}}, {"summary": "\u6253\u5370\u5f15\u5bfc\u540e\u7aef\u7684\u8c03\u8bd5\u8f93\u51fa\uff0c\u4ee5\u53ca\u5c11\u91cf\u666e\u901a\u7528\u6237\u901a\u5e38\u4e0d\u611f\u5174\u8da3\u7684\u5176\u4ed6\u6d88\u606f\u3002\u5f15\u5bfc\u540e\u7aef\u662f initdb \u7528\u6765\u521b\u5efa\u7cfb\u7edf\u76ee\u5f55\u8868\u7684\u7a0b\u5e8f\u3002\u8be5\u9009\u9879\u4f1a\u4ea7\u751f\u5927\u91cf\u6781\u5176\u4e4f\u5473\u7684\u8f93\u51fa\u3002", "signature": {"url": "/docs/devel/app-initdb.html#APP-INITDB-OPTION-DEBUG", "text": "-d --debug"}}, {"summary": "\u4f7f\u7528 debug_discard_caches=1 \u9009\u9879\u8fd0\u884c\u5f15\u5bfc\u540e\u7aef\u3002\u8fd9\u4f1a\u82b1\u8d39\u5f88\u957f\u65f6\u95f4\uff0c\u53ea\u5bf9\u6df1\u5ea6\u8c03\u8bd5\u6709\u7528\u3002", "signature": {"url": "/docs/devel/app-initdb.html#APP-INITDB-OPTION-DISCARD-CACHES", "text": "--discard-caches"}}, {"summary": "\u6307\u5b9a initdb \u521d\u59cb\u5316\u6570\u636e\u5e93\u96c6\u7c07\u65f6\u5e94\u5230\u54ea\u91cc\u67e5\u627e\u5176\u8f93\u5165\u6587\u4ef6\u3002\u901a\u5e38\u4e0d\u9700\u8981\u8fd9\u6837\u505a\u3002\u82e5\u9700\u8981\u663e\u5f0f\u6307\u5b9a\u5176\u4f4d\u7f6e\uff0c\u7cfb\u7edf\u4f1a\u63d0\u793a\u3002", "signature": {"url": "/docs/devel/app-initdb.html#APP-INITDB-OPTION-L", "text": "-L directory"}}, {"summary": "\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c\u5982\u679c initdb \u53d1\u73b0\u67d0\u4e2a\u9519\u8bef\u4f7f\u5176\u65e0\u6cd5\u5b8c\u6574\u521b\u5efa\u6570\u636e\u5e93\u96c6\u7c07\uff0c\u5c31\u4f1a\u5220\u9664\u5b83\u5728\u53d1\u73b0\u65e0\u6cd5\u5b8c\u6210\u4efb\u52a1\u4e4b\u524d\u53ef\u80fd\u5df2\u521b\u5efa\u7684\u6240\u6709\u6587\u4ef6\u3002\u8be5\u9009\u9879\u4f1a\u7981\u6b62\u8fd9\u79cd\u6e05\u7406\uff0c\u56e0\u6b64\u5bf9\u8c03\u8bd5\u6709\u7528\u3002", "signature": {"url": "/docs/devel/app-initdb.html#APP-INITDB-OPTION-NO-CLEAN", "text": "-n --no-clean"}}, {"summary": "\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c initdb \u4f1a\u7b49\u5f85\u6240\u6709\u6587\u4ef6\u90fd\u5b89\u5168\u5199\u5165\u78c1\u76d8\u3002\u8be5\u9009\u9879\u4f7f initdb \u5728\u4e0d\u7b49\u5f85\u7684\u60c5\u51b5\u4e0b\u8fd4\u56de\uff0c\u901f\u5ea6\u66f4\u5feb\uff0c\u4f46\u8fd9\u610f\u5473\u7740\u5982\u679c\u540e\u7eed\u64cd\u4f5c\u7cfb\u7edf\u5d29\u6e83\uff0c\u6570\u636e\u76ee\u5f55\u53ef\u80fd\u4f1a\u635f\u574f\u3002\u901a\u5e38\uff0c\u8be5\u9009\u9879\u9002\u7528\u4e8e\u6d4b\u8bd5\uff0c\u4f46\u4e0d\u5e94\u7528\u4e8e\u521b\u5efa\u751f\u4ea7\u73af\u5883\u5b89\u88c5\u3002", "signature": {"url": "/docs/devel/app-initdb.html#APP-INITDB-OPTION-NO-SYNC", "text": "-N --no-sync"}}, {"summary": "\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c initdb \u4f1a\u5c06\u6240\u6709\u6570\u636e\u5e93\u6587\u4ef6\u5b89\u5168\u5730\u5199\u5165\u78c1\u76d8\u3002\u8be5\u9009\u9879\u6307\u793a initdb \u8df3\u8fc7\u540c\u6b65\u5404\u4e2a\u6570\u636e\u5e93\u76ee\u5f55\u4e2d\u7684\u6240\u6709\u6587\u4ef6\u3001\u8fd9\u4e9b\u6570\u636e\u5e93\u76ee\u5f55\u672c\u8eab\u4ee5\u53ca\u8868\u7a7a\u95f4\u76ee\u5f55\uff0c\u4e5f\u5c31\u662f base \u5b50\u76ee\u5f55\u4e2d\u7684\u6240\u6709\u5185\u5bb9\u548c\u4efb\u4f55\u5176\u4ed6\u8868\u7a7a\u95f4\u76ee\u5f55\u3002\u5176\u4ed6\u6587\u4ef6\uff0c\u4f8b\u5982 pg_wal \u548c pg_xact \u4e2d\u7684\u6587\u4ef6\uff0c\u4ecd\u4f1a\u88ab\u540c\u6b65\uff0c\u9664\u975e\u4e5f\u6307\u5b9a\u4e86 --no-sync \u3002", "signature": {"url": "/docs/devel/app-initdb.html#APP-INITDB-OPTION-NO-SYNC-DATA-FILES", "text": "--no-sync-data-files"}}, {"summary": "\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c initdb \u4f1a\u5728\u5176\u8f93\u51fa\u672b\u5c3e\u5199\u51fa\u5982\u4f55\u542f\u52a8\u96c6\u7c07\u7684\u8bf4\u660e\u3002\u8be5\u9009\u9879\u4f1a\u7701\u7565\u8fd9\u4e9b\u8bf4\u660e\u3002\u5b83\u4e3b\u8981\u4f9b\u90a3\u4e9b\u5bf9 initdb \u8fdb\u884c\u5e73\u53f0\u7279\u5b9a\u5c01\u88c5\u7684\u5de5\u5177\u4f7f\u7528\uff0c\u56e0\u4e3a\u5728\u8fd9\u79cd\u60c5\u51b5\u4e0b\u90a3\u4e9b\u8bf4\u660e\u5f88\u53ef\u80fd\u5e76\u4e0d\u6b63\u786e\u3002", "signature": {"url": "/docs/devel/app-initdb.html#APP-INITDB-OPTION-NO-INSTRUCTIONS", "text": "--no-instructions"}}, {"summary": "\u663e\u793a\u5185\u90e8\u8bbe\u7f6e\u5e76\u9000\u51fa\uff0c\u4e0d\u6267\u884c\u5176\u4ed6\u64cd\u4f5c\u3002\u53ef\u7528\u4e8e\u8c03\u8bd5 initdb \u7684\u5b89\u88c5\u3002", "signature": {"url": "/docs/devel/app-initdb.html#APP-INITDB-OPTION-SHOW", "text": "-s --show"}}, {"summary": "\u8bbe\u4e3a fsync \uff08\u9ed8\u8ba4\u503c\uff09\u65f6\uff0c initdb \u4f1a\u9012\u5f52\u6253\u5f00\u5e76\u540c\u6b65\u6570\u636e\u76ee\u5f55\u4e2d\u7684\u6240\u6709\u6587\u4ef6\u3002\u67e5\u627e\u6587\u4ef6\u65f6\u4f1a\u8ddf\u968f WAL \u76ee\u5f55\u548c\u6bcf\u4e2a\u5df2\u914d\u7f6e\u8868\u7a7a\u95f4\u7684\u7b26\u53f7\u94fe\u63a5\u3002", "signature": {"url": "/docs/devel/app-initdb.html#APP-INITDB-OPTION-SYNC-METHOD", "text": "--sync-method= method"}}, {"summary": "\u5c06\u6240\u6709\u6570\u636e\u5e93\u6587\u4ef6\u5b89\u5168\u5730\u5199\u5165\u78c1\u76d8\u5e76\u9000\u51fa\u3002\u8fd9\u4e0d\u4f1a\u6267\u884c\u4efb\u4f55\u5e38\u89c4\u7684 initdb \u64cd\u4f5c\u3002\u901a\u5e38\uff0c\u8be5\u9009\u9879\u53ef\u7528\u4e8e\u5728\u5c06 fsync \u4ece off \u6539\u4e3a on \u540e\uff0c\u786e\u4fdd\u80fd\u591f\u53ef\u9760\u6062\u590d\u3002", "signature": {"url": "/docs/devel/app-initdb.html#APP-INITDB-OPTION-SYNC-ONLY", "text": "-S --sync-only"}}, {"summary": "\u6253\u5370 initdb \u7248\u672c\u5e76\u9000\u51fa\u3002", "signature": {"url": "/docs/devel/app-initdb.html#APP-INITDB-OPTION-VERSION", "text": "-V --version"}}, {"summary": "\u663e\u793a\u6709\u5173 initdb \u547d\u4ee4\u884c\u53c2\u6570\u7684\u5e2e\u52a9\u5e76\u9000\u51fa\u3002", "signature": {"url": "/docs/devel/app-initdb.html#APP-INITDB-OPTION-HELP", "text": "-? --help"}}], "title": "\u624b\u518c\u4e2d\u7684\u9009\u9879", "columns": [{"key": "signature", "label": "\u9009\u9879\u4e0e\u53c2\u6570"}, {"key": "summary", "label": "\u8bf4\u660e"}]}, {"key": "environment", "rows": [{"name": "PGDATA", "description": "\u6307\u5b9a\u6570\u636e\u5e93\u96c6\u7c07\u5e94\u5b58\u653e\u7684\u76ee\u5f55\uff1b\u53ef\u4f7f\u7528 -D \u9009\u9879\u8986\u76d6\u3002"}, {"name": "PG_COLOR", "description": "\u6307\u5b9a\u8bca\u65ad\u6d88\u606f\u662f\u5426\u4f7f\u7528\u989c\u8272\u3002\u53ef\u9009\u503c\u4e3a always \u3001 auto \u548c never \u3002"}, {"name": "TZ", "description": "\u6307\u5b9a\u6240\u521b\u5efa\u6570\u636e\u5e93\u96c6\u7c07\u7684\u9ed8\u8ba4\u65f6\u533a\u3002\u8be5\u503c\u5e94\u4e3a\u5b8c\u6574\u7684\u65f6\u533a\u540d\u79f0\uff08\u89c1 \u7b2c 8.5.3 \u8282 \uff09\u3002"}], "title": "\u73af\u5883\u53d8\u91cf", "columns": [{"key": "name", "label": "\u53d8\u91cf"}, {"key": "description", "label": "\u542b\u4e49"}]}], "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": "https://pg.center/docs/devel/app-initdb.html", "file": "app-initdb.html", "label": "20devel English manual \u00b7 app-initdb.html", "anchor": "", "sha256": "e39625982073c131744b648fc6ef08403a5996296ef4fdb87b091676f4a8a5b6", "language": "en", "original_url": "/docs/devel/app-initdb.html"}, {"url": "https://pg.center/docs/devel/reference-server.html", "file": "reference-server.html", "label": "Server applications inventory", "anchor": "", "sha256": "5532c1ebfb8c6f310301be63a28daf0ae212e2a78025bea61a1bdca99e02c43d", "language": "en", "original_url": "/docs/devel/reference-server.html"}], "sections": [], "synopsis": ["initdb [ option ...] [ --pgdata | -D ] datadir"], "signature": "initdb [ option ...] [ --pgdata | -D ] datadir", "description": ["initdb \u2014 \u521b\u5efa\u4e00\u4e2a\u65b0\u7684 PostgreSQL \u6570\u636e\u5e93\u96c6\u7c07"], "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 lang=\"zh\">initdb \u2014 \u521b\u5efa\u4e00\u4e2a\u65b0\u7684<span class=\"productname\">PostgreSQL</span>\u6570\u636e\u5e93\u96c6\u7c07</p>\n</div>\n<div class=\"refsynopsisdiv\">\n<h2 lang=\"zh\">\u5927\u7eb2</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 lang=\"zh\">\u8bf4\u660e</h2>\n<p lang=\"zh\"><code class=\"command\">initdb</code>\u521b\u5efa\u4e00\u4e2a\u65b0\u7684<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=\"\u6570\u636e\u5e93\u96c6\u7c07\">\u6570\u636e\u5e93\u96c6\u7c07</a>\u3002</p>\n<p lang=\"zh\">\u521b\u5efa\u6570\u636e\u5e93\u96c6\u7c07\u5305\u62ec\u521b\u5efa\u7528\u4e8e\u5b58\u653e\u96c6\u7c07\u6570\u636e\u7684<a class=\"glossterm\" href=\"/docs/devel/glossary.html#GLOSSARY-DATA-DIRECTORY\"></a><a class=\"glossterm\" href=\"/docs/devel/glossary.html#GLOSSARY-DATA-DIRECTORY\" title=\"\u6570\u636e\u76ee\u5f55\">\u76ee\u5f55</a>\uff0c\u751f\u6210\u5171\u4eab\u7cfb\u7edf\u76ee\u5f55\u8868\uff08\u5c5e\u4e8e\u6574\u4e2a\u96c6\u7c07\u800c\u4e0d\u662f\u67d0\u4e2a\u7279\u5b9a\u6570\u636e\u5e93\u7684\u8868\uff09\uff0c\u4ee5\u53ca\u521b\u5efa <code class=\"literal\">postgres</code>\u3001<code class=\"literal\">template1</code> \u548c <code class=\"literal\">template0</code> \u6570\u636e\u5e93\u3002<code class=\"literal\">postgres</code> \u6570\u636e\u5e93\u662f\u4e00\u4e2a\u9ed8\u8ba4\u6570\u636e\u5e93\uff0c\u4f9b\u7528\u6237\u3001\u5de5\u5177\u7a0b\u5e8f\u548c\u7b2c\u4e09\u65b9\u5e94\u7528\u7a0b\u5e8f\u4f7f\u7528\u3002<code class=\"literal\">template1</code> \u548c <code class=\"literal\">template0</code> \u7528\u4f5c\u540e\u7eed<code class=\"command\">CREATE DATABASE</code>\u547d\u4ee4\u590d\u5236\u7684\u6e90\u6570\u636e\u5e93\u3002<code class=\"literal\">template0</code> \u4e0d\u5e94\u88ab\u4fee\u6539\uff0c\u4f46\u53ef\u4ee5\u5411 <code class=\"literal\">template1</code> \u4e2d\u6dfb\u52a0\u5bf9\u8c61\uff0c\u8fd9\u4e9b\u5bf9\u8c61\u9ed8\u8ba4\u4f1a\u88ab\u590d\u5236\u5230\u4ee5\u540e\u521b\u5efa\u7684\u6570\u636e\u5e93\u4e2d\u3002\u66f4\u591a\u7ec6\u8282\u89c1<a class=\"xref\" href=\"/docs/devel/manage-ag-templatedbs.html\" title=\"22.3.\u00a0\u6a21\u677f\u6570\u636e\u5e93\">\u7b2c\u00a022.3\u00a0\u8282</a>\u3002</p>\n<p lang=\"zh\">\u867d\u7136<code class=\"command\">initdb</code>\u4f1a\u5c1d\u8bd5\u521b\u5efa\u6307\u5b9a\u7684\u6570\u636e\u76ee\u5f55\uff0c\u4f46\u5982\u679c\u6240\u9700\u6570\u636e\u76ee\u5f55\u7684\u7236\u76ee\u5f55\u5f52 root \u6240\u6709\uff0c\u5b83\u53ef\u80fd\u6ca1\u6709\u8db3\u591f\u7684\u6743\u9650\u3002\u8981\u5728\u8fd9\u79cd\u73af\u5883\u4e2d\u521d\u59cb\u5316\uff0c\u53ef\u5148\u7531 root \u521b\u5efa\u4e00\u4e2a\u7a7a\u7684\u6570\u636e\u76ee\u5f55\uff0c\u7136\u540e\u7528<code class=\"command\">chown</code>\u5c06\u8be5\u76ee\u5f55\u7684\u6240\u6709\u6743\u8d4b\u4e88\u6570\u636e\u5e93\u7528\u6237\u8d26\u6237\uff0c\u518d\u7528 <code class=\"command\">su</code>\u5207\u6362\u4e3a\u8be5\u6570\u636e\u5e93\u7528\u6237\u6765\u8fd0\u884c<code class=\"command\">initdb</code>\u3002</p>\n<p lang=\"zh\"><code class=\"command\">initdb</code>\u5fc5\u987b\u4ee5\u5c06\u62e5\u6709\u670d\u52a1\u5668\u8fdb\u7a0b\u7684\u7528\u6237\u8eab\u4efd\u8fd0\u884c\uff0c\u56e0\u4e3a\u670d\u52a1\u5668\u9700\u8981\u8bbf\u95ee <code class=\"command\">initdb</code>\u521b\u5efa\u7684\u6587\u4ef6\u548c\u76ee\u5f55\u3002\u7531\u4e8e\u670d\u52a1\u5668\u4e0d\u80fd\u4ee5 root \u8eab\u4efd\u8fd0\u884c\uff0c\u56e0\u6b64\u4e5f\u7edd\u4e0d\u80fd\u4ee5 root \u8eab\u4efd\u8fd0\u884c<code class=\"command\">initdb</code>\u3002\uff08\u5b9e\u9645\u4e0a\u5b83\u4f1a\u62d2\u7edd\u8fd9\u6837\u505a\u3002\uff09</p>\n<p lang=\"zh\">\u51fa\u4e8e\u5b89\u5168\u539f\u56e0\uff0c<code class=\"command\">initdb</code>\u521b\u5efa\u7684\u65b0\u96c6\u7c07\u9ed8\u8ba4\u53ea\u6709\u96c6\u7c07\u62e5\u6709\u8005\u53ef\u4ee5\u8bbf\u95ee\u3002<code class=\"option\">--allow-group-access</code> \u9009\u9879\u5141\u8bb8\u4e0e\u96c6\u7c07\u62e5\u6709\u8005\u540c\u7ec4\u7684\u4efb\u4f55\u7528\u6237\u8bfb\u53d6\u96c6\u7c07\u4e2d\u7684\u6587\u4ef6\u3002\u8fd9\u5bf9\u7531\u975e\u7279\u6743\u7528\u6237\u6267\u884c\u5907\u4efd\u5f88\u6709\u7528\u3002</p>\n<p lang=\"zh\"><code class=\"command\">initdb</code>\u4f1a\u521d\u59cb\u5316\u6570\u636e\u5e93\u96c6\u7c07\u7684\u9ed8\u8ba4\u533a\u57df\u8bbe\u7f6e\u548c\u5b57\u7b26\u96c6\u7f16\u7801\u3002\u8fd9\u4e9b\u8bbe\u7f6e\u4e5f\u53ef\u4ee5\u5728\u521b\u5efa\u6bcf\u4e2a\u6570\u636e\u5e93\u65f6\u5206\u522b\u8bbe\u7f6e\u3002<code class=\"command\">initdb</code>\u4e3a\u6a21\u677f\u6570\u636e\u5e93\u786e\u5b9a\u8fd9\u4e9b\u8bbe\u7f6e\uff0c\u5b83\u4eec\u5c06\u4f5c\u4e3a\u6240\u6709\u5176\u4ed6\u6570\u636e\u5e93\u7684\u9ed8\u8ba4\u503c\u3002</p>\n<p lang=\"zh\">\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c<code class=\"command\">initdb</code>\u4f7f\u7528<code class=\"literal\">libc</code>\u533a\u57df\u8bbe\u7f6e\u63d0\u4f9b\u7a0b\u5e8f\uff08\u89c1<a class=\"xref\" href=\"/docs/devel/locale.html#LOCALE-PROVIDERS\" title=\"23.1.4.\u00a0\u533a\u57df\u8bbe\u7f6e\u63d0\u4f9b\u7a0b\u5e8f\">\u7b2c\u00a023.1.4\u00a0\u8282</a>\uff09\u3002<code class=\"literal\">libc</code>\u533a\u57df\u8bbe\u7f6e\u63d0\u4f9b\u7a0b\u5e8f\u4f1a\u4ece\u73af\u5883\u4e2d\u83b7\u53d6\u533a\u57df\u8bbe\u7f6e\uff0c\u5e76\u6839\u636e\u533a\u57df\u8bbe\u7f6e\u786e\u5b9a\u7f16\u7801\u3002</p>\n<p lang=\"zh\">\u8981\u4e3a\u96c6\u7c07\u9009\u62e9\u4e0d\u540c\u7684\u533a\u57df\u8bbe\u7f6e\uff0c\u8bf7\u4f7f\u7528<code class=\"option\">--locale</code>\u3002\u6b64\u5916\u8fd8\u6709\u5355\u72ec\u7684 <code class=\"option\">--lc-*</code> \u548c <code class=\"option\">--icu-locale</code> \u9009\u9879\uff08\u89c1\u4e0b\u6587\uff09\uff0c\u7528\u4e8e\u4e3a\u5404\u4e2a\u533a\u57df\u8bbe\u7f6e\u7c7b\u522b\u8bbe\u7f6e\u503c\u3002\u8bf7\u6ce8\u610f\uff0c\u4e0d\u540c\u533a\u57df\u8bbe\u7f6e\u7c7b\u522b\u4e4b\u95f4\u82e5\u8bbe\u7f6e\u4e0d\u4e00\u81f4\uff0c\u53ef\u80fd\u4ea7\u751f\u4e0d\u5408\u7406\u7684\u7ed3\u679c\uff0c\u56e0\u6b64\u5e94\u8c28\u614e\u4f7f\u7528\u3002</p>\n<p lang=\"zh\">\u4e5f\u53ef\u4ee5\u6307\u5b9a --locale-provider=icu\uff0c\u8ba9 initdb \u4f7f\u7528 ICU \u5e93\u63d0\u4f9b\u533a\u57df\u8bbe\u7f6e\u670d\u52a1\u3002\u670d\u52a1\u5668\u5fc5\u987b\u5728\u6784\u5efa\u65f6\u542f\u7528 ICU \u652f\u6301\u3002\u4f7f\u7528 --icu-locale \u9009\u9879\u9009\u62e9\u5177\u4f53\u7684 ICU \u533a\u57df ID\u3002\u6ce8\u610f\uff0c\u51fa\u4e8e\u5b9e\u73b0\u65b9\u9762\u7684\u539f\u56e0\u4ee5\u53ca\u5bf9\u65e7\u4ee3\u7801\u7684\u517c\u5bb9\uff0c\u5373\u4f7f\u4f7f\u7528 ICU \u533a\u57df\u8bbe\u7f6e\u63d0\u4f9b\u8005\uff0cinitdb \u4ecd\u4f1a\u9009\u62e9\u5e76\u521d\u59cb\u5316 libc \u533a\u57df\u8bbe\u7f6e\u3002</p>\n<p lang=\"zh\"><code class=\"command\">initdb</code>\u8fd0\u884c\u65f6\u4f1a\u6253\u5370\u51fa\u5b83\u9009\u62e9\u7684\u533a\u57df\u8bbe\u7f6e\u3002\u5982\u679c\u6709\u590d\u6742\u9700\u6c42\u6216\u8005\u6307\u5b9a\u4e86\u591a\u4e2a\u9009\u9879\uff0c\u5efa\u8bae\u68c0\u67e5\u7ed3\u679c\u662f\u5426\u7b26\u5408\u9884\u671f\u3002</p>\n<p lang=\"zh\">\u6709\u5173\u533a\u57df\u8bbe\u7f6e\u7684\u66f4\u591a\u7ec6\u8282\u89c1<a class=\"xref\" href=\"/docs/devel/locale.html\" title=\"23.1.\u00a0\u533a\u57df\u8bbe\u7f6e\u652f\u6301\">\u7b2c\u00a023.1\u00a0\u8282</a>\u3002</p>\n<p lang=\"zh\">\u8981\u4fee\u6539\u9ed8\u8ba4\u7f16\u7801\uff0c\u8bf7\u4f7f\u7528<code class=\"option\">--encoding</code>\u3002\u66f4\u591a\u7ec6\u8282\u89c1<a class=\"xref\" href=\"/docs/devel/multibyte.html\" title=\"23.3.\u00a0\u5b57\u7b26\u96c6\u652f\u6301\">\u7b2c\u00a023.3\u00a0\u8282</a>\u3002</p>\n</div>\n<div class=\"refsect1\" id=\"id-1.9.5.3.6\">\n<h2 lang=\"zh\">\u9009\u9879</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 lang=\"zh\">\u8be5\u9009\u9879\u6307\u5b9a<code class=\"filename\">pg_hba.conf</code>\u4e2d\u672c\u5730\u7528\u6237\u9ed8\u8ba4\u4f7f\u7528\u7684\u8ba4\u8bc1\u65b9\u6cd5\uff08<code class=\"literal\">host</code> \u548c <code class=\"literal\">local</code> \u884c\uff09\u3002\u6709\u6548\u503c\u6982\u89c8\u89c1<a class=\"xref\" href=\"/docs/devel/auth-pg-hba-conf.html\" title=\"20.1.\u00a0pg_hba.conf \u6587\u4ef6\">\u7b2c\u00a020.1\u00a0\u8282</a>\u3002</p>\n<p lang=\"zh\"><code class=\"command\">initdb</code>\u4f1a\u4f7f\u7528\u6307\u5b9a\u7684\u8ba4\u8bc1\u65b9\u6cd5\u9884\u586b\u5145<code class=\"filename\">pg_hba.conf</code> \u6761\u76ee\uff0c\u65e2\u7528\u4e8e\u975e\u590d\u5236\u8fde\u63a5\uff0c\u4e5f\u7528\u4e8e\u590d\u5236\u8fde\u63a5\u3002</p>\n<p lang=\"zh\">\u9664\u975e\u4fe1\u4efb\u7cfb\u7edf\u4e0a\u7684\u6240\u6709\u672c\u5730\u7528\u6237\uff0c\u5426\u5219\u4e0d\u8981\u4f7f\u7528<code class=\"literal\">trust</code>\u3002\u4e3a\u4e86\u4fbf\u4e8e\u5b89\u88c5\uff0c\u9ed8\u8ba4\u4f7f\u7528<code class=\"literal\">trust</code>\u3002</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 lang=\"zh\">\n<p>\u8be5\u9009\u9879\u6307\u5b9a<code class=\"filename\">pg_hba.conf</code>\u4e2d\u672c\u5730\u7528\u6237\u901a\u8fc7 TCP/IP \u8fde\u63a5\u65f6\uff08<code class=\"literal\">host</code> \u884c\uff09\u4f7f\u7528\u7684\u8ba4\u8bc1\u65b9\u6cd5\u3002</p>\n</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 lang=\"zh\">\n<p>\u8be5\u9009\u9879\u6307\u5b9a<code class=\"filename\">pg_hba.conf</code>\u4e2d\u672c\u5730\u7528\u6237\u901a\u8fc7 Unix \u57df\u5957\u63a5\u5b57\u8fde\u63a5\u65f6\uff08<code class=\"literal\">local</code> \u884c\uff09\u4f7f\u7528\u7684\u8ba4\u8bc1\u65b9\u6cd5\u3002</p>\n</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 lang=\"zh\">\n<p>\u8be5\u9009\u9879\u6307\u5b9a\u6570\u636e\u5e93\u96c6\u7c07\u5e94\u5b58\u653e\u7684\u76ee\u5f55\u3002\u8fd9\u662f<code class=\"command\">initdb</code>\u6240\u9700\u7684\u552f\u4e00\u4fe1\u606f\uff0c\u4f46\u4e5f\u53ef\u4ee5\u901a\u8fc7\u8bbe\u7f6e<code class=\"envar\">PGDATA</code>\u73af\u5883\u53d8\u91cf\u6765\u7701\u53bb\u663e\u5f0f\u5199\u51fa\u5b83\uff1b\u8fd9\u901a\u5e38\u66f4\u65b9\u4fbf\uff0c\u56e0\u4e3a\u6570\u636e\u5e93\u670d\u52a1\u5668\uff08<code class=\"command\">postgres</code>\uff09\u4e4b\u540e\u4e5f\u53ef\u4ee5\u901a\u8fc7\u540c\u4e00\u53d8\u91cf\u627e\u5230\u6570\u636e\u76ee\u5f55\u3002</p>\n</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 lang=\"zh\">\u9009\u62e9\u6a21\u677f\u6570\u636e\u5e93\u7684\u7f16\u7801\u3002\u8fd9\u4e5f\u5c06\u6210\u4e3a\u4ee5\u540e\u521b\u5efa\u7684\u4efb\u4f55\u6570\u636e\u5e93\u7684\u9ed8\u8ba4\u7f16\u7801\uff0c\u9664\u975e\u5728\u521b\u5efa\u65f6\u8986\u76d6\u5b83\u3002<span class=\"productname\">PostgreSQL</span>\u670d\u52a1\u5668\u652f\u6301\u7684\u5b57\u7b26\u96c6\u89c1<a class=\"xref\" href=\"/docs/devel/multibyte.html#MULTIBYTE-CHARSET-SUPPORTED\" title=\"23.3.1.\u00a0\u652f\u6301\u7684\u5b57\u7b26\u96c6\">\u7b2c\u00a023.3.1\u00a0\u8282</a>\u3002</p>\n<p lang=\"zh\">\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c\u6a21\u677f\u6570\u636e\u5e93\u7684\u7f16\u7801\u7531\u533a\u57df\u8bbe\u7f6e\u51b3\u5b9a\u3002\u5982\u679c\u6307\u5b9a --no-locale\uff08\u6216\u7b49\u4ef7\u5730\u5c06\u533a\u57df\u8bbe\u7f6e\u8bbe\u4e3a C \u6216 POSIX\uff09\uff0c\u5219 ICU \u63d0\u4f9b\u8005\u7684\u9ed8\u8ba4\u7f16\u7801\u4e3a UTF8\uff0clibc \u63d0\u4f9b\u8005\u7684\u9ed8\u8ba4\u7f16\u7801\u4e3a SQL_ASCII\u3002</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 lang=\"zh\">\u5141\u8bb8\u4e0e\u96c6\u7fa4\u6240\u6709\u8005\u540c\u7ec4\u7684\u7528\u6237\u8bfb\u53d6 initdb \u521b\u5efa\u7684\u6240\u6709\u96c6\u7fa4\u6587\u4ef6\u3002Windows \u4e0d\u652f\u6301 POSIX \u98ce\u683c\u7684\u7ec4\u6743\u9650\uff0c\u56e0\u6b64\u4f1a\u5ffd\u7565\u6b64\u9009\u9879\u3002</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 lang=\"zh\">\n<p>\u5f53\u4f7f\u7528 ICU \u63d0\u4f9b\u7a0b\u5e8f\u65f6\uff0c\u6307\u5b9a ICU \u533a\u57df\u8bbe\u7f6e\u3002\u533a\u57df\u8bbe\u7f6e\u652f\u6301\u89c1<a class=\"xref\" href=\"/docs/devel/locale.html\" title=\"23.1.\u00a0\u533a\u57df\u8bbe\u7f6e\u652f\u6301\">\u7b2c\u00a023.1\u00a0\u8282</a>\u3002</p>\n</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 lang=\"zh\">\n<p>\u6307\u5b9a\u9644\u52a0\u7684\u6392\u5e8f\u89c4\u5219\uff0c\u4ee5\u5b9a\u5236\u9ed8\u8ba4\u6392\u5e8f\u89c4\u5219\u7684\u884c\u4e3a\u3002\u8be5\u9009\u9879\u4ec5\u652f\u6301 ICU\u3002</p>\n</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 lang=\"zh\">\u5bf9\u6570\u636e\u9875\u542f\u7528\u6821\u9a8c\u548c\uff0c\u4ee5\u5e2e\u52a9\u68c0\u6d4b\u539f\u672c\u4f1a\u6084\u65e0\u58f0\u606f\u53d1\u751f\u7684\u3001\u7531 I/O \u7cfb\u7edf\u5bfc\u81f4\u7684\u635f\u574f\u3002\u8be5\u9879\u9ed8\u8ba4\u542f\u7528\uff1b\u4f7f\u7528<a class=\"xref\" href=\"/docs/devel/app-initdb.html#APP-INITDB-NO-DATA-CHECKSUMS\"><code class=\"option\">--no-data-checksums</code></a>\u53ef\u7981\u7528\u6821\u9a8c\u548c\u3002</p>\n<p lang=\"zh\">\u542f\u7528\u6821\u9a8c\u548c\u53ef\u80fd\u4f1a\u5e26\u6765\u5c0f\u5e45\u6027\u80fd\u635f\u5931\u3002\u5982\u679c\u542f\u7528\uff0c\u5c31\u4f1a\u4e3a\u6240\u6709\u6570\u636e\u5e93\u4e2d\u7684\u6240\u6709\u5bf9\u8c61\u8ba1\u7b97\u6821\u9a8c\u548c\u3002\u6240\u6709\u6821\u9a8c\u548c\u5931\u8d25\u90fd\u4f1a\u5728 <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>\u89c6\u56fe\u4e2d\u62a5\u544a\u3002\u8be6\u89c1<a class=\"xref\" href=\"/docs/devel/checksums.html\" title=\"28.2.\u00a0\u6570\u636e\u6821\u9a8c\u548c\">\u7b2c\u00a028.2\u00a0\u8282</a>\u3002</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 lang=\"zh\">\u8bbe\u7f6e\u6570\u636e\u5e93\u96c6\u7c07\u7684\u9ed8\u8ba4\u533a\u57df\u8bbe\u7f6e\u3002\u5982\u679c\u672a\u6307\u5b9a\u8be5\u9009\u9879\uff0c\u533a\u57df\u8bbe\u7f6e\u5c06\u7ee7\u627f\u81ea <code class=\"command\">initdb</code>\u8fd0\u884c\u65f6\u6240\u5728\u7684\u73af\u5883\u3002\u533a\u57df\u8bbe\u7f6e\u652f\u6301\u89c1<a class=\"xref\" href=\"/docs/devel/locale.html\" title=\"23.1.\u00a0\u533a\u57df\u8bbe\u7f6e\u652f\u6301\">\u7b2c\u00a023.1\u00a0\u8282</a>\u3002</p>\n<p lang=\"zh\">\u5982\u679c<code class=\"option\">--locale-provider</code>\u4e3a<code class=\"literal\">builtin</code>\uff0c\u5219\u5fc5\u987b\u6307\u5b9a<code class=\"option\">--locale</code>\u6216<code class=\"option\">--builtin-locale</code>\uff0c\u5e76\u5c06\u5176\u8bbe\u7f6e\u4e3a<code class=\"literal\">C</code>\u3001<code class=\"literal\">C.UTF-8</code>\u6216 <code class=\"literal\">PG_UNICODE_FAST</code>\u3002</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 lang=\"zh\">\n<p>\u7c7b\u4f3c\u4e8e<code class=\"option\">--locale</code>\uff0c\u4f46\u53ea\u5728\u6307\u5b9a\u7684\u7c7b\u522b\u4e2d\u8bbe\u7f6e\u533a\u57df\u8bbe\u7f6e\u3002</p>\n</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 lang=\"zh\">\n<p>\u7b49\u4ef7\u4e8e<code class=\"option\">--locale=C</code>\u3002</p>\n</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 lang=\"zh\">\n<p>\u5f53\u4f7f\u7528 builtin \u63d0\u4f9b\u7a0b\u5e8f\u65f6\uff0c\u6307\u5b9a\u533a\u57df\u8bbe\u7f6e\u540d\u79f0\u3002\u533a\u57df\u8bbe\u7f6e\u652f\u6301\u89c1<a class=\"xref\" href=\"/docs/devel/locale.html\" title=\"23.1.\u00a0\u533a\u57df\u8bbe\u7f6e\u652f\u6301\">\u7b2c\u00a023.1\u00a0\u8282</a>\u3002</p>\n</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 lang=\"zh\">\n<p>\u8be5\u9009\u9879\u8bbe\u7f6e\u65b0\u96c6\u7c07\u4e2d\u521b\u5efa\u7684\u6570\u636e\u5e93\u6240\u4f7f\u7528\u7684\u533a\u57df\u8bbe\u7f6e\u63d0\u4f9b\u7a0b\u5e8f\u3002\u540e\u7eed\u521b\u5efa\u65b0\u6570\u636e\u5e93\u65f6\uff0c\u53ef\u4ee5\u5728<code class=\"command\">CREATE DATABASE</code>\u547d\u4ee4\u4e2d\u8986\u76d6\u5b83\u3002\u9ed8\u8ba4\u503c\u4e3a <code class=\"literal\">libc</code>\uff08\u89c1<a class=\"xref\" href=\"/docs/devel/locale.html#LOCALE-PROVIDERS\" title=\"23.1.4.\u00a0\u533a\u57df\u8bbe\u7f6e\u63d0\u4f9b\u7a0b\u5e8f\">\u7b2c\u00a023.1.4\u00a0\u8282</a>\uff09\u3002</p>\n</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 lang=\"zh\">\n<p>\u4e0d\u542f\u7528\u6570\u636e\u6821\u9a8c\u548c\u3002</p>\n</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 lang=\"zh\">\n<p>\u4f7f<code class=\"command\">initdb</code>\u4ece\u6587\u4ef6\u4e2d\u8bfb\u53d6\u5f15\u5bfc\u8d85\u7ea7\u7528\u6237\u7684\u5bc6\u7801\u3002\u6587\u4ef6\u7684\u7b2c\u4e00\u884c\u4f1a\u88ab\u5f53\u4f5c\u5bc6\u7801\u3002</p>\n</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 lang=\"zh\">\n<p>\u8bbe\u7f6e\u9ed8\u8ba4\u6587\u672c\u68c0\u7d22\u914d\u7f6e\u3002\u66f4\u591a\u4fe1\u606f\u89c1<a class=\"xref\" href=\"/docs/devel/runtime-config-client.html#GUC-DEFAULT-TEXT-SEARCH-CONFIG\">default_text_search_config</a>\u3002</p>\n</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 lang=\"zh\">\n<p>\u8bbe\u7f6e<a class=\"glossterm\" href=\"/docs/devel/glossary.html#GLOSSARY-BOOTSTRAP-SUPERUSER\"></a><a class=\"glossterm\" href=\"/docs/devel/glossary.html#GLOSSARY-BOOTSTRAP-SUPERUSER\" title=\"\u5f15\u5bfc\u8d85\u7ea7\u7528\u6237\">\u5f15\u5bfc\u8d85\u7ea7\u7528\u6237</a>\u7684\u7528\u6237\u540d\u3002\u9ed8\u8ba4\u503c\u662f\u8fd0\u884c<code class=\"command\">initdb</code>\u7684\u64cd\u4f5c\u7cfb\u7edf\u7528\u6237\u540d\u3002</p>\n</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 lang=\"zh\">\n<p>\u4f7f<code class=\"command\">initdb</code>\u63d0\u793a\u8f93\u5165\u8981\u8d4b\u7ed9\u5f15\u5bfc\u8d85\u7ea7\u7528\u6237\u7684\u5bc6\u7801\u3002\u5982\u679c\u4e0d\u6253\u7b97\u4f7f\u7528\u5bc6\u7801\u8ba4\u8bc1\uff0c\u8fd9\u4e00\u70b9\u5e76\u4e0d\u91cd\u8981\u3002\u5426\u5219\uff0c\u5728\u8bbe\u7f6e\u5bc6\u7801\u4e4b\u524d\u5c06\u65e0\u6cd5\u4f7f\u7528\u5bc6\u7801\u8ba4\u8bc1\u3002</p>\n</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 lang=\"zh\">\n<p>\u8be5\u9009\u9879\u6307\u5b9a\u9884\u5199\u5f0f\u65e5\u5fd7\uff08WAL\uff09\u5e94\u5b58\u653e\u7684\u76ee\u5f55\u3002</p>\n</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 lang=\"zh\">\u8bbe\u7f6e WAL \u6bb5\u5927\u5c0f\uff0c\u5355\u4f4d\u4e3a\u5146\u5b57\u8282\u3002\u8fd9\u662f WAL \u65e5\u5fd7\u4e2d\u6bcf\u4e2a\u72ec\u7acb\u6587\u4ef6\u7684\u5927\u5c0f\u3002\u9ed8\u8ba4\u5927\u5c0f\u4e3a 16 \u5146\u5b57\u8282\u3002\u53d6\u503c\u5fc5\u987b\u662f 1 \u5230 1024\uff08\u5146\u5b57\u8282\uff09\u4e4b\u95f4\u7684 2 \u7684\u5e42\u3002\u6b64\u9009\u9879\u53ea\u80fd\u5728\u521d\u59cb\u5316\u65f6\u8bbe\u7f6e\uff0c\u4e4b\u540e\u65e0\u6cd5\u66f4\u6539\u3002</p>\n<p lang=\"zh\">\u8c03\u6574\u8be5\u5927\u5c0f\u53ef\u80fd\u6709\u52a9\u4e8e\u63a7\u5236 WAL \u65e5\u5fd7\u4f20\u9001\u6216\u5f52\u6863\u7684\u7c92\u5ea6\u3002\u6b64\u5916\uff0c\u5728 WAL \u91cf\u5f88\u5927\u7684\u6570\u636e\u5e93\u4e2d\uff0c\u6bcf\u4e2a\u76ee\u5f55\u4e2d\u7684 WAL \u6587\u4ef6\u6570\u91cf\u53ef\u80fd\u4f1a\u6210\u4e3a\u6027\u80fd\u548c\u7ba1\u7406\u95ee\u9898\u3002\u589e\u5927 WAL \u6587\u4ef6\u5927\u5c0f\u4f1a\u51cf\u5c11 WAL \u6587\u4ef6\u6570\u91cf\u3002</p>\n</dd>\n</dl>\n</div>\n<p lang=\"zh\">\u8fd8\u63d0\u4f9b\u4e86\u5176\u4ed6\u4e00\u4e9b\u8f83\u5c11\u4f7f\u7528\u7684\u9009\u9879\uff1a</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 lang=\"zh\">\u5728 initdb \u671f\u95f4\u5f3a\u5236\u5c06\u670d\u52a1\u5668\u53c2\u6570 name \u8bbe\u4e3a value\uff0c\u5e76\u628a\u8be5\u8bbe\u7f6e\u5199\u5165\u751f\u6210\u7684 postgresql.conf \u6587\u4ef6\uff0c\u4f7f\u5176\u5728\u4e4b\u540e\u7684\u670d\u52a1\u5668\u8fd0\u884c\u4e2d\u4e5f\u751f\u6548\u3002\u6b64\u9009\u9879\u53ef\u591a\u6b21\u4f7f\u7528\uff0c\u4ee5\u8bbe\u7f6e\u591a\u4e2a\u53c2\u6570\u3002\u5b83\u4e3b\u8981\u7528\u4e8e\u73af\u5883\u6761\u4ef6\u5bfc\u81f4\u670d\u52a1\u5668\u5b8c\u5168\u65e0\u6cd5\u4f7f\u7528\u9ed8\u8ba4\u53c2\u6570\u542f\u52a8\u7684\u60c5\u51b5\u3002</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 lang=\"zh\">\n<p>\u6253\u5370\u5f15\u5bfc\u540e\u7aef\u7684\u8c03\u8bd5\u8f93\u51fa\uff0c\u4ee5\u53ca\u5c11\u91cf\u666e\u901a\u7528\u6237\u901a\u5e38\u4e0d\u611f\u5174\u8da3\u7684\u5176\u4ed6\u6d88\u606f\u3002\u5f15\u5bfc\u540e\u7aef\u662f <code class=\"command\">initdb</code>\u7528\u6765\u521b\u5efa\u7cfb\u7edf\u76ee\u5f55\u8868\u7684\u7a0b\u5e8f\u3002\u8be5\u9009\u9879\u4f1a\u4ea7\u751f\u5927\u91cf\u6781\u5176\u4e4f\u5473\u7684\u8f93\u51fa\u3002</p>\n</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 lang=\"zh\">\n<p>\u4f7f\u7528<code class=\"literal\">debug_discard_caches=1</code>\u9009\u9879\u8fd0\u884c\u5f15\u5bfc\u540e\u7aef\u3002\u8fd9\u4f1a\u82b1\u8d39\u5f88\u957f\u65f6\u95f4\uff0c\u53ea\u5bf9\u6df1\u5ea6\u8c03\u8bd5\u6709\u7528\u3002</p>\n</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 lang=\"zh\">\n<p>\u6307\u5b9a<code class=\"command\">initdb</code>\u521d\u59cb\u5316\u6570\u636e\u5e93\u96c6\u7c07\u65f6\u5e94\u5230\u54ea\u91cc\u67e5\u627e\u5176\u8f93\u5165\u6587\u4ef6\u3002\u901a\u5e38\u4e0d\u9700\u8981\u8fd9\u6837\u505a\u3002\u82e5\u9700\u8981\u663e\u5f0f\u6307\u5b9a\u5176\u4f4d\u7f6e\uff0c\u7cfb\u7edf\u4f1a\u63d0\u793a\u3002</p>\n</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 lang=\"zh\">\n<p>\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c\u5982\u679c<code class=\"command\">initdb</code>\u53d1\u73b0\u67d0\u4e2a\u9519\u8bef\u4f7f\u5176\u65e0\u6cd5\u5b8c\u6574\u521b\u5efa\u6570\u636e\u5e93\u96c6\u7c07\uff0c\u5c31\u4f1a\u5220\u9664\u5b83\u5728\u53d1\u73b0\u65e0\u6cd5\u5b8c\u6210\u4efb\u52a1\u4e4b\u524d\u53ef\u80fd\u5df2\u521b\u5efa\u7684\u6240\u6709\u6587\u4ef6\u3002\u8be5\u9009\u9879\u4f1a\u7981\u6b62\u8fd9\u79cd\u6e05\u7406\uff0c\u56e0\u6b64\u5bf9\u8c03\u8bd5\u6709\u7528\u3002</p>\n</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 lang=\"zh\">\n<p>\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c<code class=\"command\">initdb</code>\u4f1a\u7b49\u5f85\u6240\u6709\u6587\u4ef6\u90fd\u5b89\u5168\u5199\u5165\u78c1\u76d8\u3002\u8be5\u9009\u9879\u4f7f <code class=\"command\">initdb</code>\u5728\u4e0d\u7b49\u5f85\u7684\u60c5\u51b5\u4e0b\u8fd4\u56de\uff0c\u901f\u5ea6\u66f4\u5feb\uff0c\u4f46\u8fd9\u610f\u5473\u7740\u5982\u679c\u540e\u7eed\u64cd\u4f5c\u7cfb\u7edf\u5d29\u6e83\uff0c\u6570\u636e\u76ee\u5f55\u53ef\u80fd\u4f1a\u635f\u574f\u3002\u901a\u5e38\uff0c\u8be5\u9009\u9879\u9002\u7528\u4e8e\u6d4b\u8bd5\uff0c\u4f46\u4e0d\u5e94\u7528\u4e8e\u521b\u5efa\u751f\u4ea7\u73af\u5883\u5b89\u88c5\u3002</p>\n</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 lang=\"zh\">\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c<code class=\"command\">initdb</code>\u4f1a\u5c06\u6240\u6709\u6570\u636e\u5e93\u6587\u4ef6\u5b89\u5168\u5730\u5199\u5165\u78c1\u76d8\u3002\u8be5\u9009\u9879\u6307\u793a<code class=\"command\">initdb</code>\u8df3\u8fc7\u540c\u6b65\u5404\u4e2a\u6570\u636e\u5e93\u76ee\u5f55\u4e2d\u7684\u6240\u6709\u6587\u4ef6\u3001\u8fd9\u4e9b\u6570\u636e\u5e93\u76ee\u5f55\u672c\u8eab\u4ee5\u53ca\u8868\u7a7a\u95f4\u76ee\u5f55\uff0c\u4e5f\u5c31\u662f<code class=\"filename\">base</code>\u5b50\u76ee\u5f55\u4e2d\u7684\u6240\u6709\u5185\u5bb9\u548c\u4efb\u4f55\u5176\u4ed6\u8868\u7a7a\u95f4\u76ee\u5f55\u3002\u5176\u4ed6\u6587\u4ef6\uff0c\u4f8b\u5982<code class=\"literal\">pg_wal</code>\u548c<code class=\"literal\">pg_xact</code>\u4e2d\u7684\u6587\u4ef6\uff0c\u4ecd\u4f1a\u88ab\u540c\u6b65\uff0c\u9664\u975e\u4e5f\u6307\u5b9a\u4e86<code class=\"option\">--no-sync</code>\u3002</p>\n<p lang=\"zh\">\u8bf7\u6ce8\u610f\uff0c\u5982\u679c<code class=\"option\">--no-sync-data-files</code>\u4e0e <code class=\"option\">--sync-method=syncfs</code>\u4e00\u8d77\u4f7f\u7528\uff0c\u4e0a\u8ff0\u90e8\u5206\u6216\u5168\u90e8\u6587\u4ef6\u4e0e\u76ee\u5f55\u4ecd\u4f1a\u88ab\u540c\u6b65\uff0c\u56e0\u4e3a<code class=\"literal\">syncfs</code>\u5904\u7406\u7684\u662f\u6574\u4e2a\u6587\u4ef6\u7cfb\u7edf\u3002</p>\n<p lang=\"zh\">\u8be5\u9009\u9879\u4e3b\u8981\u4f9b\u90a3\u4e9b\u4f1a\u53e6\u884c\u786e\u4fdd\u8fd9\u4e9b\u88ab\u8df3\u8fc7\u6587\u4ef6\u5df2\u540c\u6b65\u5230\u78c1\u76d8\u7684\u5de5\u5177\u5728\u5185\u90e8\u4f7f\u7528\u3002</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 lang=\"zh\">\n<p>\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c<code class=\"command\">initdb</code>\u4f1a\u5728\u5176\u8f93\u51fa\u672b\u5c3e\u5199\u51fa\u5982\u4f55\u542f\u52a8\u96c6\u7c07\u7684\u8bf4\u660e\u3002\u8be5\u9009\u9879\u4f1a\u7701\u7565\u8fd9\u4e9b\u8bf4\u660e\u3002\u5b83\u4e3b\u8981\u4f9b\u90a3\u4e9b\u5bf9<code class=\"command\">initdb</code>\u8fdb\u884c\u5e73\u53f0\u7279\u5b9a\u5c01\u88c5\u7684\u5de5\u5177\u4f7f\u7528\uff0c\u56e0\u4e3a\u5728\u8fd9\u79cd\u60c5\u51b5\u4e0b\u90a3\u4e9b\u8bf4\u660e\u5f88\u53ef\u80fd\u5e76\u4e0d\u6b63\u786e\u3002</p>\n</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 lang=\"zh\">\n<p>\u663e\u793a\u5185\u90e8\u8bbe\u7f6e\u5e76\u9000\u51fa\uff0c\u4e0d\u6267\u884c\u5176\u4ed6\u64cd\u4f5c\u3002\u53ef\u7528\u4e8e\u8c03\u8bd5<span class=\"application\">initdb</span>\u7684\u5b89\u88c5\u3002</p>\n</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 lang=\"zh\">\u8bbe\u4e3a<code class=\"literal\">fsync</code>\uff08\u9ed8\u8ba4\u503c\uff09\u65f6\uff0c<code class=\"command\">initdb</code>\u4f1a\u9012\u5f52\u6253\u5f00\u5e76\u540c\u6b65\u6570\u636e\u76ee\u5f55\u4e2d\u7684\u6240\u6709\u6587\u4ef6\u3002\u67e5\u627e\u6587\u4ef6\u65f6\u4f1a\u8ddf\u968f WAL \u76ee\u5f55\u548c\u6bcf\u4e2a\u5df2\u914d\u7f6e\u8868\u7a7a\u95f4\u7684\u7b26\u53f7\u94fe\u63a5\u3002</p>\n<p lang=\"zh\">\u5728 Linux \u4e0a\uff0c\u4e5f\u53ef\u4ee5\u6539\u7528<code class=\"literal\">syncfs</code>\uff0c\u8bf7\u6c42\u64cd\u4f5c\u7cfb\u7edf\u540c\u6b65\u5305\u542b\u6570\u636e\u76ee\u5f55\u3001WAL \u6587\u4ef6\u4ee5\u53ca\u6bcf\u4e2a\u8868\u7a7a\u95f4\u7684\u6574\u4e2a\u6587\u4ef6\u7cfb\u7edf\u3002\u4f7f\u7528<code class=\"literal\">syncfs</code>\u65f6\u9700\u6ce8\u610f\u7684\u4e8b\u9879\u89c1<a class=\"xref\" href=\"/docs/devel/runtime-config-error-handling.html#GUC-RECOVERY-INIT-SYNC-METHOD\">recovery_init_sync_method</a>\u3002</p>\n<p lang=\"zh\">\u4f7f\u7528<code class=\"option\">--no-sync</code>\u65f6\uff0c\u8be5\u9009\u9879\u4e0d\u8d77\u4f5c\u7528\u3002</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 lang=\"zh\">\n<p>\u5c06\u6240\u6709\u6570\u636e\u5e93\u6587\u4ef6\u5b89\u5168\u5730\u5199\u5165\u78c1\u76d8\u5e76\u9000\u51fa\u3002\u8fd9\u4e0d\u4f1a\u6267\u884c\u4efb\u4f55\u5e38\u89c4\u7684 <span class=\"application\">initdb</span>\u64cd\u4f5c\u3002\u901a\u5e38\uff0c\u8be5\u9009\u9879\u53ef\u7528\u4e8e\u5728\u5c06<a class=\"xref\" href=\"/docs/devel/runtime-config-wal.html#GUC-FSYNC\">fsync</a>\u4ece<code class=\"literal\">off</code>\u6539\u4e3a<code class=\"literal\">on</code>\u540e\uff0c\u786e\u4fdd\u80fd\u591f\u53ef\u9760\u6062\u590d\u3002</p>\n</p>\n</dd>\n</dl>\n</div>\n<p lang=\"zh\">\u5176\u4ed6\u9009\u9879\uff1a</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 lang=\"zh\">\n<p>\u6253\u5370<span class=\"application\">initdb</span>\u7248\u672c\u5e76\u9000\u51fa\u3002</p>\n</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 lang=\"zh\">\n<p>\u663e\u793a\u6709\u5173<span class=\"application\">initdb</span>\u547d\u4ee4\u884c\u53c2\u6570\u7684\u5e2e\u52a9\u5e76\u9000\u51fa\u3002</p>\n</p>\n</dd>\n</dl>\n</div>\n</div>\n<div class=\"refsect1\" id=\"id-1.9.5.3.7\">\n<h2 lang=\"zh\">\u73af\u5883</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 lang=\"zh\">\n<p>\u6307\u5b9a\u6570\u636e\u5e93\u96c6\u7c07\u5e94\u5b58\u653e\u7684\u76ee\u5f55\uff1b\u53ef\u4f7f\u7528<code class=\"option\">-D</code>\u9009\u9879\u8986\u76d6\u3002</p>\n</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 lang=\"zh\">\n<p>\u6307\u5b9a\u8bca\u65ad\u6d88\u606f\u662f\u5426\u4f7f\u7528\u989c\u8272\u3002\u53ef\u9009\u503c\u4e3a <code class=\"literal\">always</code>\u3001<code class=\"literal\">auto</code>\u548c <code class=\"literal\">never</code>\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-INITDB-ENVIRONMENT-TZ\"><span class=\"term\"><code class=\"envar\">TZ</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6307\u5b9a\u6240\u521b\u5efa\u6570\u636e\u5e93\u96c6\u7c07\u7684\u9ed8\u8ba4\u65f6\u533a\u3002\u8be5\u503c\u5e94\u4e3a\u5b8c\u6574\u7684\u65f6\u533a\u540d\u79f0\uff08\u89c1<a class=\"xref\" href=\"/docs/devel/datatype-datetime.html#DATATYPE-TIMEZONES\" title=\"8.5.3.\u00a0\u65f6\u533a\">\u7b2c\u00a08.5.3\u00a0\u8282</a>\uff09\u3002</p>\n</p>\n</dd>\n</dl>\n</div>\n</div>\n<div class=\"refsect1\" id=\"id-1.9.5.3.8\">\n<h2 lang=\"zh\">\u6ce8\u89e3</h2>\n<p lang=\"zh\">\u4e5f\u53ef\u4ee5\u901a\u8fc7 pg_ctl initdb \u8c03\u7528 initdb\u3002</p>\n</div>\n<div class=\"refsect1\" id=\"id-1.9.5.3.9\">\n<h2 lang=\"zh\">\u53e6\u89c1</h2><span class=\"simplelist\"><a class=\"xref\" href=\"https://pg.center/docs/devel/app-pg-ctl.html\" title=\"pg_ctl\"><span class=\"refentrytitle\"><span class=\"application\">pg_ctl</span></span></a>, <a class=\"xref\" href=\"https://pg.center/docs/devel/app-postgres.html\" title=\"postgres\"><span class=\"refentrytitle\"><span class=\"application\">postgres</span></span></a>, <a class=\"xref\" href=\"https://pg.center/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", "localization": {"status": "complete", "sources": [{"url": "/docs/devel/app-initdb.html", "method": "same-major semantic node", "sha256": "440643632826671ed1c0977ab94b5e0a2298de19f6ee879dc11cf388e647a5df", "language": "zh", "matched_nodes": ["#APP-INITDB/div[2]/p[1]", "#APP-INITDB/div[3]/h2[0]", "#APP-INITDB/div[4]/p[10]", "#APP-INITDB/div[4]/p[11]", "#APP-INITDB/div[4]/p[12]", "#APP-INITDB/div[4]/p[1]", "#APP-INITDB/div[4]/p[2]", "#APP-INITDB/div[4]/p[3]", "#APP-INITDB/div[4]/p[4]", "#APP-INITDB/div[4]/p[5]", "#APP-INITDB/div[4]/p[6]", "#APP-INITDB/div[4]/p[7]", "#APP-INITDB/div[4]/p[8]", "#APP-INITDB/div[5]/div[1]/dl[0]/dd[11]", "#APP-INITDB/div[5]/div[1]/dl[0]/dd[13]", "#APP-INITDB/div[5]/div[1]/dl[0]/dd[15]", "#APP-INITDB/div[5]/div[1]/dl[0]/dd[17]/p[0]", "#APP-INITDB/div[5]/div[1]/dl[0]/dd[17]/p[1]", "#APP-INITDB/div[5]/div[1]/dl[0]/dd[19]/p[0]", "#APP-INITDB/div[5]/div[1]/dl[0]/dd[19]/p[1]", "#APP-INITDB/div[5]/div[1]/dl[0]/dd[1]/p[0]", "#APP-INITDB/div[5]/div[1]/dl[0]/dd[1]/p[1]", "#APP-INITDB/div[5]/div[1]/dl[0]/dd[1]/p[2]", "#APP-INITDB/div[5]/div[1]/dl[0]/dd[21]", "#APP-INITDB/div[5]/div[1]/dl[0]/dd[23]", "#APP-INITDB/div[5]/div[1]/dl[0]/dd[25]", "#APP-INITDB/div[5]/div[1]/dl[0]/dd[27]", "#APP-INITDB/div[5]/div[1]/dl[0]/dd[29]", "#APP-INITDB/div[5]/div[1]/dl[0]/dd[31]", "#APP-INITDB/div[5]/div[1]/dl[0]/dd[33]", "#APP-INITDB/div[5]/div[1]/dl[0]/dd[35]", "#APP-INITDB/div[5]/div[1]/dl[0]/dd[37]", "#APP-INITDB/div[5]/div[1]/dl[0]/dd[39]", "#APP-INITDB/div[5]/div[1]/dl[0]/dd[3]", "#APP-INITDB/div[5]/div[1]/dl[0]/dd[41]/p[1]", "#APP-INITDB/div[5]/div[1]/dl[0]/dd[5]", "#APP-INITDB/div[5]/div[1]/dl[0]/dd[7]", "#APP-INITDB/div[5]/div[1]/dl[0]/dd[9]/p[0]", "#APP-INITDB/div[5]/div[3]/dl[0]/dd[11]", "#APP-INITDB/div[5]/div[3]/dl[0]/dd[13]/p[0]", "#APP-INITDB/div[5]/div[3]/dl[0]/dd[13]/p[1]", "#APP-INITDB/div[5]/div[3]/dl[0]/dd[13]/p[2]", "#APP-INITDB/div[5]/div[3]/dl[0]/dd[15]", "#APP-INITDB/div[5]/div[3]/dl[0]/dd[17]", "#APP-INITDB/div[5]/div[3]/dl[0]/dd[19]/p[0]", "#APP-INITDB/div[5]/div[3]/dl[0]/dd[19]/p[1]", "#APP-INITDB/div[5]/div[3]/dl[0]/dd[19]/p[2]", "#APP-INITDB/div[5]/div[3]/dl[0]/dd[21]", "#APP-INITDB/div[5]/div[3]/dl[0]/dd[3]", "#APP-INITDB/div[5]/div[3]/dl[0]/dd[5]", "#APP-INITDB/div[5]/div[3]/dl[0]/dd[7]", "#APP-INITDB/div[5]/div[3]/dl[0]/dd[9]", "#APP-INITDB/div[5]/div[5]/dl[0]/dd[1]", "#APP-INITDB/div[5]/div[5]/dl[0]/dd[3]", "#APP-INITDB/div[5]/p[2]", "#APP-INITDB/div[5]/p[4]", "#APP-INITDB/div[6]/div[1]/dl[0]/dd[1]", "#APP-INITDB/div[6]/div[1]/dl[0]/dd[3]", "#APP-INITDB/div[6]/div[1]/dl[0]/dd[5]", "#APP-INITDB/div[6]/h2[0]", "#APP-INITDB/div[7]/h2[0]", "#APP-INITDB/div[8]/h2[0]"]}], "language": "zh", "original_text": {"/summary": "initdb \u2014 create a new PostgreSQL database cluster", "/category": "Server applications", "/versions/20/description/0": "initdb \u2014 create a new PostgreSQL database cluster", "/versions/20/facts/0/label": "Documented executable", "/versions/20/facts/1/label": "Executable version", "/versions/20/facts/2/label": "Reference inventory", "/versions/20/facts/2/value": "Server applications", "/versions/20/facts/3/label": "Option definition groups", "/versions/20/tables/0/title": "Documented options", "/versions/20/tables/1/title": "Environment variables", "/versions/20/tables/0/rows/0/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.", "/versions/20/tables/0/rows/1/summary": "This option specifies the authentication method for local users via TCP/IP connections used in pg_hba.conf ( host lines).", "/versions/20/tables/0/rows/2/summary": "This option specifies the authentication method for local users via Unix-domain socket connections used in pg_hba.conf ( local lines).", "/versions/20/tables/0/rows/3/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.", "/versions/20/tables/0/rows/4/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 .", "/versions/20/tables/0/rows/5/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.", "/versions/20/tables/0/rows/6/summary": "Specifies the ICU locale when the ICU provider is used. Locale support is described in Section 23.1 .", "/versions/20/tables/0/rows/7/summary": "Specifies additional collation rules to customize the behavior of the default collation. This is supported for ICU only.", "/versions/20/tables/0/rows/8/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.", "/versions/20/tables/0/rows/9/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 .", "/versions/20/tables/0/columns/0/label": "Option and arguments", "/versions/20/tables/0/columns/1/label": "Description", "/versions/20/tables/0/rows/10/summary": "Like --locale , but only sets the locale in the specified category.", "/versions/20/tables/0/rows/11/summary": "Equivalent to --locale=C .", "/versions/20/tables/0/rows/12/summary": "Specifies the locale name when the builtin provider is used. Locale support is described in Section 23.1 .", "/versions/20/tables/0/rows/13/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 ).", "/versions/20/tables/0/rows/14/summary": "Do not enable data checksums.", "/versions/20/tables/0/rows/15/summary": "Makes initdb read the bootstrap superuser's password from a file. The first line of the file is taken as the password.", "/versions/20/tables/0/rows/16/summary": "Sets the default text search configuration. See default_text_search_config for further information.", "/versions/20/tables/0/rows/17/summary": "Sets the user name of the bootstrap superuser . This defaults to the name of the operating-system user running initdb .", "/versions/20/tables/0/rows/18/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.", "/versions/20/tables/0/rows/19/summary": "This option specifies the directory where the write-ahead log should be stored.", "/versions/20/tables/0/rows/20/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.", "/versions/20/tables/0/rows/21/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.", "/versions/20/tables/0/rows/22/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.", "/versions/20/tables/0/rows/23/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.", "/versions/20/tables/0/rows/24/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.", "/versions/20/tables/0/rows/25/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.", "/versions/20/tables/0/rows/26/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.", "/versions/20/tables/0/rows/27/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.", "/versions/20/tables/0/rows/28/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.", "/versions/20/tables/0/rows/29/summary": "Show internal settings and exit, without doing anything else. This can be used to debug the initdb installation.", "/versions/20/tables/0/rows/30/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.", "/versions/20/tables/0/rows/31/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 .", "/versions/20/tables/0/rows/32/summary": "Print the initdb version and exit.", "/versions/20/tables/0/rows/33/summary": "Show help about initdb command line arguments, and exit.", "/versions/20/tables/1/columns/0/label": "Variable", "/versions/20/tables/1/columns/1/label": "Meaning", "/versions/20/tables/1/rows/0/description": "Specifies the directory where the database cluster is to be stored; can be overridden using the -D option.", "/versions/20/tables/1/rows/1/description": "Specifies whether to use color in diagnostic messages. Possible values are always , auto and never .", "/versions/20/tables/1/rows/2/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 )."}, "fallback_fields": [], "source_language": "en", "original_snapshot_sha256": "4efc0fa68cae350a3694f3e5a91f0220440ef62d2de650afe7512dc418625c63"}, "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", "manual_language": "zh"}}}, "snapshot": {"facts": [{"label": "\u624b\u518c\u4e2d\u7684\u53ef\u6267\u884c\u7a0b\u5e8f", "value": "initdb"}, {"label": "\u7a0b\u5e8f\u7248\u672c", "value": "18.6"}, {"label": "\u53c2\u8003\u6e05\u5355", "value": "\u670d\u52a1\u7aef\u7a0b\u5e8f"}, {"label": "\u9009\u9879\u5b9a\u4e49\u7ec4", "value": "34"}], "tables": [{"key": "options", "rows": [{"summary": "\u8be5\u9009\u9879\u6307\u5b9a pg_hba.conf \u4e2d\u672c\u5730\u7528\u6237\u9ed8\u8ba4\u4f7f\u7528\u7684\u8ba4\u8bc1\u65b9\u6cd5\uff08 host \u548c local \u884c\uff09\u3002\u6709\u6548\u503c\u6982\u89c8\u89c1 \u7b2c 20.1 \u8282 \u3002", "signature": {"url": "/docs/18/app-initdb.html#APP-INITDB-OPTION-AUTH", "text": "-A authmethod --auth= authmethod"}}, {"summary": "\u8be5\u9009\u9879\u6307\u5b9a pg_hba.conf \u4e2d\u672c\u5730\u7528\u6237\u901a\u8fc7 TCP/IP \u8fde\u63a5\u65f6\uff08 host \u884c\uff09\u4f7f\u7528\u7684\u8ba4\u8bc1\u65b9\u6cd5\u3002", "signature": {"url": "/docs/18/app-initdb.html#APP-INITDB-OPTION-AUTH-HOST", "text": "--auth-host= authmethod"}}, {"summary": "\u8be5\u9009\u9879\u6307\u5b9a pg_hba.conf \u4e2d\u672c\u5730\u7528\u6237\u901a\u8fc7 Unix \u57df\u5957\u63a5\u5b57\u8fde\u63a5\u65f6\uff08 local \u884c\uff09\u4f7f\u7528\u7684\u8ba4\u8bc1\u65b9\u6cd5\u3002", "signature": {"url": "/docs/18/app-initdb.html#APP-INITDB-OPTION-AUTH-LOCAL", "text": "--auth-local= authmethod"}}, {"summary": "\u8be5\u9009\u9879\u6307\u5b9a\u6570\u636e\u5e93\u96c6\u7c07\u5e94\u5b58\u653e\u7684\u76ee\u5f55\u3002\u8fd9\u662f initdb \u6240\u9700\u7684\u552f\u4e00\u4fe1\u606f\uff0c\u4f46\u4e5f\u53ef\u4ee5\u901a\u8fc7\u8bbe\u7f6e PGDATA \u73af\u5883\u53d8\u91cf\u6765\u7701\u53bb\u663e\u5f0f\u5199\u51fa\u5b83\uff1b\u8fd9\u901a\u5e38\u66f4\u65b9\u4fbf\uff0c\u56e0\u4e3a\u6570\u636e\u5e93\u670d\u52a1\u5668\uff08 postgres \uff09\u4e4b\u540e\u4e5f\u53ef\u4ee5\u901a\u8fc7\u540c\u4e00\u53d8\u91cf\u627e\u5230\u6570\u636e\u76ee\u5f55\u3002", "signature": {"url": "/docs/18/app-initdb.html#APP-INITDB-OPTION-PGDATA", "text": "-D directory --pgdata= directory"}}, {"summary": "\u9009\u62e9\u6a21\u677f\u6570\u636e\u5e93\u7684\u7f16\u7801\u3002\u8fd9\u4e5f\u5c06\u6210\u4e3a\u4ee5\u540e\u521b\u5efa\u7684\u4efb\u4f55\u6570\u636e\u5e93\u7684\u9ed8\u8ba4\u7f16\u7801\uff0c\u9664\u975e\u5728\u521b\u5efa\u65f6\u8986\u76d6\u5b83\u3002 PostgreSQL \u670d\u52a1\u5668\u652f\u6301\u7684\u5b57\u7b26\u96c6\u89c1 \u7b2c 23.3.1 \u8282 \u3002", "signature": {"url": "/docs/18/app-initdb.html#APP-INITDB-OPTION-ENCODING", "text": "-E encoding --encoding= encoding"}}, {"summary": "\u5141\u8bb8\u4e0e\u96c6\u7c07\u62e5\u6709\u8005\u540c\u7ec4\u7684\u7528\u6237\u8bfb\u53d6\u7531 initdb \u521b\u5efa\u7684\u6240\u6709\u96c6\u7c07\u6587\u4ef6\u3002\u8be5\u9009\u9879\u5728 Windows \u4e0a\u4f1a\u88ab\u5ffd\u7565\uff0c\u56e0\u4e3a\u5b83\u4e0d\u652f\u6301 POSIX \u98ce\u683c\u7684\u7ec4\u6743\u9650\u3002", "signature": {"url": "/docs/18/app-initdb.html#APP-INITDB-ALLOW-GROUP-ACCESS", "text": "-g --allow-group-access"}}, {"summary": "\u5f53\u4f7f\u7528 ICU \u63d0\u4f9b\u7a0b\u5e8f\u65f6\uff0c\u6307\u5b9a ICU \u533a\u57df\u8bbe\u7f6e\u3002\u533a\u57df\u8bbe\u7f6e\u652f\u6301\u89c1 \u7b2c 23.1 \u8282 \u3002", "signature": {"url": "/docs/18/app-initdb.html#APP-INITDB-ICU-LOCALE", "text": "--icu-locale= locale"}}, {"summary": "\u6307\u5b9a\u9644\u52a0\u7684\u6392\u5e8f\u89c4\u5219\uff0c\u4ee5\u5b9a\u5236\u9ed8\u8ba4\u6392\u5e8f\u89c4\u5219\u7684\u884c\u4e3a\u3002\u8be5\u9009\u9879\u4ec5\u652f\u6301 ICU\u3002", "signature": {"url": "/docs/18/app-initdb.html#APP-INITDB-ICU-RULES", "text": "--icu-rules= rules"}}, {"summary": "\u5bf9\u6570\u636e\u9875\u542f\u7528\u6821\u9a8c\u548c\uff0c\u4ee5\u5e2e\u52a9\u68c0\u6d4b\u539f\u672c\u4f1a\u6084\u65e0\u58f0\u606f\u53d1\u751f\u7684\u3001\u7531 I/O \u7cfb\u7edf\u5bfc\u81f4\u7684\u635f\u574f\u3002\u8be5\u9879\u9ed8\u8ba4\u542f\u7528\uff1b\u4f7f\u7528 --no-data-checksums \u53ef\u7981\u7528\u6821\u9a8c\u548c\u3002", "signature": {"url": "/docs/18/app-initdb.html#APP-INITDB-DATA-CHECKSUMS", "text": "-k --data-checksums"}}, {"summary": "\u8bbe\u7f6e\u6570\u636e\u5e93\u96c6\u7c07\u7684\u9ed8\u8ba4\u533a\u57df\u8bbe\u7f6e\u3002\u5982\u679c\u672a\u6307\u5b9a\u8be5\u9009\u9879\uff0c\u533a\u57df\u8bbe\u7f6e\u5c06\u7ee7\u627f\u81ea initdb \u8fd0\u884c\u65f6\u6240\u5728\u7684\u73af\u5883\u3002\u533a\u57df\u8bbe\u7f6e\u652f\u6301\u89c1 \u7b2c 23.1 \u8282 \u3002", "signature": {"url": "/docs/18/app-initdb.html#APP-INITDB-OPTION-LOCALE", "text": "--locale= locale"}}, {"summary": "\u7c7b\u4f3c\u4e8e --locale \uff0c\u4f46\u53ea\u5728\u6307\u5b9a\u7684\u7c7b\u522b\u4e2d\u8bbe\u7f6e\u533a\u57df\u8bbe\u7f6e\u3002", "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": "\u7b49\u4ef7\u4e8e --locale=C \u3002", "signature": {"url": "/docs/18/app-initdb.html#APP-INITDB-OPTION-NO-LOCALE", "text": "--no-locale"}}, {"summary": "\u5f53\u4f7f\u7528 builtin \u63d0\u4f9b\u7a0b\u5e8f\u65f6\uff0c\u6307\u5b9a\u533a\u57df\u8bbe\u7f6e\u540d\u79f0\u3002\u533a\u57df\u8bbe\u7f6e\u652f\u6301\u89c1 \u7b2c 23.1 \u8282 \u3002", "signature": {"url": "/docs/18/app-initdb.html#APP-INITDB-BUILTIN-LOCALE", "text": "--builtin-locale= locale"}}, {"summary": "\u8be5\u9009\u9879\u8bbe\u7f6e\u65b0\u96c6\u7c07\u4e2d\u521b\u5efa\u7684\u6570\u636e\u5e93\u6240\u4f7f\u7528\u7684\u533a\u57df\u8bbe\u7f6e\u63d0\u4f9b\u7a0b\u5e8f\u3002\u540e\u7eed\u521b\u5efa\u65b0\u6570\u636e\u5e93\u65f6\uff0c\u53ef\u4ee5\u5728 CREATE DATABASE \u547d\u4ee4\u4e2d\u8986\u76d6\u5b83\u3002\u9ed8\u8ba4\u503c\u4e3a libc \uff08\u89c1 \u7b2c 23.1.4 \u8282 \uff09\u3002", "signature": {"url": "/docs/18/app-initdb.html#APP-INITDB-OPTION-LOCALE-PROVIDER", "text": "--locale-provider={ builtin | libc | icu }"}}, {"summary": "\u4e0d\u542f\u7528\u6570\u636e\u6821\u9a8c\u548c\u3002", "signature": {"url": "/docs/18/app-initdb.html#APP-INITDB-NO-DATA-CHECKSUMS", "text": "--no-data-checksums"}}, {"summary": "\u4f7f initdb \u4ece\u6587\u4ef6\u4e2d\u8bfb\u53d6\u5f15\u5bfc\u8d85\u7ea7\u7528\u6237\u7684\u5bc6\u7801\u3002\u6587\u4ef6\u7684\u7b2c\u4e00\u884c\u4f1a\u88ab\u5f53\u4f5c\u5bc6\u7801\u3002", "signature": {"url": "/docs/18/app-initdb.html#APP-INITDB-OPTION-PWFILE", "text": "--pwfile= filename"}}, {"summary": "\u8bbe\u7f6e\u9ed8\u8ba4\u6587\u672c\u68c0\u7d22\u914d\u7f6e\u3002\u66f4\u591a\u4fe1\u606f\u89c1 default_text_search_config \u3002", "signature": {"url": "/docs/18/app-initdb.html#APP-INITDB-OPTION-TEXT-SEARCH-CONFIG", "text": "-T config --text-search-config= config"}}, {"summary": "\u8bbe\u7f6e \u5f15\u5bfc\u8d85\u7ea7\u7528\u6237 \u7684\u7528\u6237\u540d\u3002\u9ed8\u8ba4\u503c\u662f\u8fd0\u884c initdb \u7684\u64cd\u4f5c\u7cfb\u7edf\u7528\u6237\u540d\u3002", "signature": {"url": "/docs/18/app-initdb.html#APP-INITDB-OPTION-USERNAME", "text": "-U username --username= username"}}, {"summary": "\u4f7f initdb \u63d0\u793a\u8f93\u5165\u8981\u8d4b\u7ed9\u5f15\u5bfc\u8d85\u7ea7\u7528\u6237\u7684\u5bc6\u7801\u3002\u5982\u679c\u4e0d\u6253\u7b97\u4f7f\u7528\u5bc6\u7801\u8ba4\u8bc1\uff0c\u8fd9\u4e00\u70b9\u5e76\u4e0d\u91cd\u8981\u3002\u5426\u5219\uff0c\u5728\u8bbe\u7f6e\u5bc6\u7801\u4e4b\u524d\u5c06\u65e0\u6cd5\u4f7f\u7528\u5bc6\u7801\u8ba4\u8bc1\u3002", "signature": {"url": "/docs/18/app-initdb.html#APP-INITDB-OPTION-PWPROMPT", "text": "-W --pwprompt"}}, {"summary": "\u8be5\u9009\u9879\u6307\u5b9a\u9884\u5199\u5f0f\u65e5\u5fd7\uff08WAL\uff09\u5e94\u5b58\u653e\u7684\u76ee\u5f55\u3002", "signature": {"url": "/docs/18/app-initdb.html#APP-INITDB-OPTION-WALDIR", "text": "-X directory --waldir= directory"}}, {"summary": "\u8bbe\u7f6e WAL \u6bb5\u5927\u5c0f\uff0c\u5355\u4f4d\u4e3a\u5146\u5b57\u8282\u3002\u8fd9\u662f WAL \u65e5\u5fd7\u4e2d\u6bcf\u4e2a\u72ec\u7acb\u6587\u4ef6\u7684\u5927\u5c0f\u3002\u9ed8\u8ba4\u5927\u5c0f\u4e3a 16 \u5146\u5b57\u8282\u3002\u53d6\u503c\u5fc5\u987b\u662f 1 \u5230 1024\uff08\u5146\u5b57\u8282\uff09\u4e4b\u95f4\u7684 2 \u7684\u5e42\u3002\u6b64\u9009\u9879\u53ea\u80fd\u5728\u521d\u59cb\u5316\u65f6\u8bbe\u7f6e\uff0c\u4e4b\u540e\u65e0\u6cd5\u66f4\u6539\u3002", "signature": {"url": "/docs/18/app-initdb.html#APP-INITDB-OPTION-WAL-SEGSIZE", "text": "--wal-segsize= size"}}, {"summary": "\u5728 initdb \u671f\u95f4\u5f3a\u5236\u5c06\u670d\u52a1\u5668\u53c2\u6570 name \u8bbe\u4e3a value\uff0c\u5e76\u628a\u8be5\u8bbe\u7f6e\u5199\u5165\u751f\u6210\u7684 postgresql.conf \u6587\u4ef6\uff0c\u4f7f\u5176\u5728\u4e4b\u540e\u7684\u670d\u52a1\u5668\u8fd0\u884c\u4e2d\u4e5f\u751f\u6548\u3002\u6b64\u9009\u9879\u53ef\u591a\u6b21\u4f7f\u7528\uff0c\u4ee5\u8bbe\u7f6e\u591a\u4e2a\u53c2\u6570\u3002\u5b83\u4e3b\u8981\u7528\u4e8e\u73af\u5883\u6761\u4ef6\u5bfc\u81f4\u670d\u52a1\u5668\u5b8c\u5168\u65e0\u6cd5\u4f7f\u7528\u9ed8\u8ba4\u53c2\u6570\u542f\u52a8\u7684\u60c5\u51b5\u3002", "signature": {"url": "/docs/18/app-initdb.html#APP-INITDB-OPTION-SET", "text": "-c name = value --set name = value"}}, {"summary": "\u6253\u5370\u5f15\u5bfc\u540e\u7aef\u7684\u8c03\u8bd5\u8f93\u51fa\uff0c\u4ee5\u53ca\u5c11\u91cf\u666e\u901a\u7528\u6237\u901a\u5e38\u4e0d\u611f\u5174\u8da3\u7684\u5176\u4ed6\u6d88\u606f\u3002\u5f15\u5bfc\u540e\u7aef\u662f initdb \u7528\u6765\u521b\u5efa\u7cfb\u7edf\u76ee\u5f55\u8868\u7684\u7a0b\u5e8f\u3002\u8be5\u9009\u9879\u4f1a\u4ea7\u751f\u5927\u91cf\u6781\u5176\u4e4f\u5473\u7684\u8f93\u51fa\u3002", "signature": {"url": "/docs/18/app-initdb.html#APP-INITDB-OPTION-DEBUG", "text": "-d --debug"}}, {"summary": "\u4f7f\u7528 debug_discard_caches=1 \u9009\u9879\u8fd0\u884c\u5f15\u5bfc\u540e\u7aef\u3002\u8fd9\u4f1a\u82b1\u8d39\u5f88\u957f\u65f6\u95f4\uff0c\u53ea\u5bf9\u6df1\u5ea6\u8c03\u8bd5\u6709\u7528\u3002", "signature": {"url": "/docs/18/app-initdb.html#APP-INITDB-OPTION-DISCARD-CACHES", "text": "--discard-caches"}}, {"summary": "\u6307\u5b9a initdb \u521d\u59cb\u5316\u6570\u636e\u5e93\u96c6\u7c07\u65f6\u5e94\u5230\u54ea\u91cc\u67e5\u627e\u5176\u8f93\u5165\u6587\u4ef6\u3002\u901a\u5e38\u4e0d\u9700\u8981\u8fd9\u6837\u505a\u3002\u82e5\u9700\u8981\u663e\u5f0f\u6307\u5b9a\u5176\u4f4d\u7f6e\uff0c\u7cfb\u7edf\u4f1a\u63d0\u793a\u3002", "signature": {"url": "/docs/18/app-initdb.html#APP-INITDB-OPTION-L", "text": "-L directory"}}, {"summary": "\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c\u5982\u679c initdb \u53d1\u73b0\u67d0\u4e2a\u9519\u8bef\u4f7f\u5176\u65e0\u6cd5\u5b8c\u6574\u521b\u5efa\u6570\u636e\u5e93\u96c6\u7c07\uff0c\u5c31\u4f1a\u5220\u9664\u5b83\u5728\u53d1\u73b0\u65e0\u6cd5\u5b8c\u6210\u4efb\u52a1\u4e4b\u524d\u53ef\u80fd\u5df2\u521b\u5efa\u7684\u6240\u6709\u6587\u4ef6\u3002\u8be5\u9009\u9879\u4f1a\u7981\u6b62\u8fd9\u79cd\u6e05\u7406\uff0c\u56e0\u6b64\u5bf9\u8c03\u8bd5\u6709\u7528\u3002", "signature": {"url": "/docs/18/app-initdb.html#APP-INITDB-OPTION-NO-CLEAN", "text": "-n --no-clean"}}, {"summary": "\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c initdb \u4f1a\u7b49\u5f85\u6240\u6709\u6587\u4ef6\u90fd\u5b89\u5168\u5199\u5165\u78c1\u76d8\u3002\u8be5\u9009\u9879\u4f7f initdb \u5728\u4e0d\u7b49\u5f85\u7684\u60c5\u51b5\u4e0b\u8fd4\u56de\uff0c\u901f\u5ea6\u66f4\u5feb\uff0c\u4f46\u8fd9\u610f\u5473\u7740\u5982\u679c\u540e\u7eed\u64cd\u4f5c\u7cfb\u7edf\u5d29\u6e83\uff0c\u6570\u636e\u76ee\u5f55\u53ef\u80fd\u4f1a\u635f\u574f\u3002\u901a\u5e38\uff0c\u8be5\u9009\u9879\u9002\u7528\u4e8e\u6d4b\u8bd5\uff0c\u4f46\u4e0d\u5e94\u7528\u4e8e\u521b\u5efa\u751f\u4ea7\u73af\u5883\u5b89\u88c5\u3002", "signature": {"url": "/docs/18/app-initdb.html#APP-INITDB-OPTION-NO-SYNC", "text": "-N --no-sync"}}, {"summary": "\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c initdb \u4f1a\u5c06\u6240\u6709\u6570\u636e\u5e93\u6587\u4ef6\u5b89\u5168\u5730\u5199\u5165\u78c1\u76d8\u3002\u8be5\u9009\u9879\u6307\u793a initdb \u8df3\u8fc7\u540c\u6b65\u5404\u4e2a\u6570\u636e\u5e93\u76ee\u5f55\u4e2d\u7684\u6240\u6709\u6587\u4ef6\u3001\u8fd9\u4e9b\u6570\u636e\u5e93\u76ee\u5f55\u672c\u8eab\u4ee5\u53ca\u8868\u7a7a\u95f4\u76ee\u5f55\uff0c\u4e5f\u5c31\u662f base \u5b50\u76ee\u5f55\u4e2d\u7684\u6240\u6709\u5185\u5bb9\u548c\u4efb\u4f55\u5176\u4ed6\u8868\u7a7a\u95f4\u76ee\u5f55\u3002\u5176\u4ed6\u6587\u4ef6\uff0c\u4f8b\u5982 pg_wal \u548c pg_xact \u4e2d\u7684\u6587\u4ef6\uff0c\u4ecd\u4f1a\u88ab\u540c\u6b65\uff0c\u9664\u975e\u4e5f\u6307\u5b9a\u4e86 --no-sync \u3002", "signature": {"url": "/docs/18/app-initdb.html#APP-INITDB-OPTION-NO-SYNC-DATA-FILES", "text": "--no-sync-data-files"}}, {"summary": "\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c initdb \u4f1a\u5728\u5176\u8f93\u51fa\u672b\u5c3e\u5199\u51fa\u5982\u4f55\u542f\u52a8\u96c6\u7c07\u7684\u8bf4\u660e\u3002\u8be5\u9009\u9879\u4f1a\u7701\u7565\u8fd9\u4e9b\u8bf4\u660e\u3002\u5b83\u4e3b\u8981\u4f9b\u90a3\u4e9b\u5bf9 initdb \u8fdb\u884c\u5e73\u53f0\u7279\u5b9a\u5c01\u88c5\u7684\u5de5\u5177\u4f7f\u7528\uff0c\u56e0\u4e3a\u5728\u8fd9\u79cd\u60c5\u51b5\u4e0b\u90a3\u4e9b\u8bf4\u660e\u5f88\u53ef\u80fd\u5e76\u4e0d\u6b63\u786e\u3002", "signature": {"url": "/docs/18/app-initdb.html#APP-INITDB-OPTION-NO-INSTRUCTIONS", "text": "--no-instructions"}}, {"summary": "\u663e\u793a\u5185\u90e8\u8bbe\u7f6e\u5e76\u9000\u51fa\uff0c\u4e0d\u6267\u884c\u5176\u4ed6\u64cd\u4f5c\u3002\u53ef\u7528\u4e8e\u8c03\u8bd5 initdb \u7684\u5b89\u88c5\u3002", "signature": {"url": "/docs/18/app-initdb.html#APP-INITDB-OPTION-SHOW", "text": "-s --show"}}, {"summary": "\u8bbe\u4e3a fsync \uff08\u9ed8\u8ba4\u503c\uff09\u65f6\uff0c initdb \u4f1a\u9012\u5f52\u6253\u5f00\u5e76\u540c\u6b65\u6570\u636e\u76ee\u5f55\u4e2d\u7684\u6240\u6709\u6587\u4ef6\u3002\u67e5\u627e\u6587\u4ef6\u65f6\u4f1a\u8ddf\u968f WAL \u76ee\u5f55\u548c\u6bcf\u4e2a\u5df2\u914d\u7f6e\u8868\u7a7a\u95f4\u7684\u7b26\u53f7\u94fe\u63a5\u3002", "signature": {"url": "/docs/18/app-initdb.html#APP-INITDB-OPTION-SYNC-METHOD", "text": "--sync-method= method"}}, {"summary": "\u5c06\u6240\u6709\u6570\u636e\u5e93\u6587\u4ef6\u5b89\u5168\u5730\u5199\u5165\u78c1\u76d8\u5e76\u9000\u51fa\u3002\u8fd9\u4e0d\u4f1a\u6267\u884c\u4efb\u4f55\u5e38\u89c4\u7684 initdb \u64cd\u4f5c\u3002\u901a\u5e38\uff0c\u8be5\u9009\u9879\u53ef\u7528\u4e8e\u5728\u5c06 fsync \u4ece off \u6539\u4e3a on \u540e\uff0c\u786e\u4fdd\u80fd\u591f\u53ef\u9760\u6062\u590d\u3002", "signature": {"url": "/docs/18/app-initdb.html#APP-INITDB-OPTION-SYNC-ONLY", "text": "-S --sync-only"}}, {"summary": "\u6253\u5370 initdb \u7248\u672c\u5e76\u9000\u51fa\u3002", "signature": {"url": "/docs/18/app-initdb.html#APP-INITDB-OPTION-VERSION", "text": "-V --version"}}, {"summary": "\u663e\u793a\u6709\u5173 initdb \u547d\u4ee4\u884c\u53c2\u6570\u7684\u5e2e\u52a9\u5e76\u9000\u51fa\u3002", "signature": {"url": "/docs/18/app-initdb.html#APP-INITDB-OPTION-HELP", "text": "-? --help"}}], "title": "\u624b\u518c\u4e2d\u7684\u9009\u9879", "columns": [{"key": "signature", "label": "\u9009\u9879\u4e0e\u53c2\u6570"}, {"key": "summary", "label": "\u8bf4\u660e"}]}, {"key": "environment", "rows": [{"name": "PGDATA", "description": "\u6307\u5b9a\u6570\u636e\u5e93\u96c6\u7c07\u5e94\u5b58\u653e\u7684\u76ee\u5f55\uff1b\u53ef\u4f7f\u7528 -D \u9009\u9879\u8986\u76d6\u3002"}, {"name": "PG_COLOR", "description": "\u6307\u5b9a\u8bca\u65ad\u6d88\u606f\u662f\u5426\u4f7f\u7528\u989c\u8272\u3002\u53ef\u9009\u503c\u4e3a always \u3001 auto \u548c never \u3002"}, {"name": "TZ", "description": "\u6307\u5b9a\u6240\u521b\u5efa\u6570\u636e\u5e93\u96c6\u7c07\u7684\u9ed8\u8ba4\u65f6\u533a\u3002\u8be5\u503c\u5e94\u4e3a\u5b8c\u6574\u7684\u65f6\u533a\u540d\u79f0\uff08\u89c1 \u7b2c 8.5.3 \u8282 \uff09\u3002"}], "title": "\u73af\u5883\u53d8\u91cf", "columns": [{"key": "name", "label": "\u53d8\u91cf"}, {"key": "description", "label": "\u542b\u4e49"}]}], "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": "https://pg.center/docs/18/app-initdb.html", "file": "app-initdb.html", "label": "18.6 English manual \u00b7 app-initdb.html", "anchor": "", "sha256": "ca8245d2c61740de3b11df2b81993b18e311705e2c23bebfa7cafda1bcd15321", "language": "en", "original_url": "/docs/18/app-initdb.html"}, {"url": "https://pg.center/docs/18/reference-server.html", "file": "reference-server.html", "label": "Server applications inventory", "anchor": "", "sha256": "e9f8bbcc8e3641fadd1d20991e8aad6b532155b786ba5a1b7b364ec4f1a5bef3", "language": "en", "original_url": "/docs/18/reference-server.html"}], "sections": [], "synopsis": ["initdb [ option ...] [ --pgdata | -D ] directory"], "signature": "initdb [ option ...] [ --pgdata | -D ] directory", "description": ["initdb \u2014 \u521b\u5efa\u4e00\u4e2a\u65b0\u7684 PostgreSQL \u6570\u636e\u5e93\u96c6\u7c07"], "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 lang=\"zh\">initdb \u2014 \u521b\u5efa\u4e00\u4e2a\u65b0\u7684<span class=\"productname\">PostgreSQL</span>\u6570\u636e\u5e93\u96c6\u7c07</p>\n</div>\n<div class=\"refsynopsisdiv\">\n<h2 lang=\"zh\">\u5927\u7eb2</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 lang=\"zh\">\u8bf4\u660e</h2>\n<p lang=\"zh\"><code class=\"command\">initdb</code>\u521b\u5efa\u4e00\u4e2a\u65b0\u7684<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=\"\u6570\u636e\u5e93\u96c6\u7c07\">\u6570\u636e\u5e93\u96c6\u7c07</a>\u3002</p>\n<p lang=\"zh\">\u521b\u5efa\u6570\u636e\u5e93\u96c6\u7c07\u5305\u62ec\u521b\u5efa\u7528\u4e8e\u5b58\u653e\u96c6\u7c07\u6570\u636e\u7684<a class=\"glossterm\" href=\"/docs/18/glossary.html#GLOSSARY-DATA-DIRECTORY\"></a><a class=\"glossterm\" href=\"/docs/18/glossary.html#GLOSSARY-DATA-DIRECTORY\" title=\"\u6570\u636e\u76ee\u5f55\">\u76ee\u5f55</a>\uff0c\u751f\u6210\u5171\u4eab\u7cfb\u7edf\u76ee\u5f55\u8868\uff08\u5c5e\u4e8e\u6574\u4e2a\u96c6\u7c07\u800c\u4e0d\u662f\u67d0\u4e2a\u7279\u5b9a\u6570\u636e\u5e93\u7684\u8868\uff09\uff0c\u4ee5\u53ca\u521b\u5efa <code class=\"literal\">postgres</code>\u3001<code class=\"literal\">template1</code> \u548c <code class=\"literal\">template0</code> \u6570\u636e\u5e93\u3002<code class=\"literal\">postgres</code> \u6570\u636e\u5e93\u662f\u4e00\u4e2a\u9ed8\u8ba4\u6570\u636e\u5e93\uff0c\u4f9b\u7528\u6237\u3001\u5de5\u5177\u7a0b\u5e8f\u548c\u7b2c\u4e09\u65b9\u5e94\u7528\u7a0b\u5e8f\u4f7f\u7528\u3002<code class=\"literal\">template1</code> \u548c <code class=\"literal\">template0</code> \u7528\u4f5c\u540e\u7eed<code class=\"command\">CREATE DATABASE</code>\u547d\u4ee4\u590d\u5236\u7684\u6e90\u6570\u636e\u5e93\u3002<code class=\"literal\">template0</code> \u4e0d\u5e94\u88ab\u4fee\u6539\uff0c\u4f46\u53ef\u4ee5\u5411 <code class=\"literal\">template1</code> \u4e2d\u6dfb\u52a0\u5bf9\u8c61\uff0c\u8fd9\u4e9b\u5bf9\u8c61\u9ed8\u8ba4\u4f1a\u88ab\u590d\u5236\u5230\u4ee5\u540e\u521b\u5efa\u7684\u6570\u636e\u5e93\u4e2d\u3002\u66f4\u591a\u7ec6\u8282\u89c1<a class=\"xref\" href=\"/docs/18/manage-ag-templatedbs.html\" title=\"22.3.\u00a0\u6a21\u677f\u6570\u636e\u5e93\">\u7b2c\u00a022.3\u00a0\u8282</a>\u3002</p>\n<p lang=\"zh\">\u867d\u7136<code class=\"command\">initdb</code>\u4f1a\u5c1d\u8bd5\u521b\u5efa\u6307\u5b9a\u7684\u6570\u636e\u76ee\u5f55\uff0c\u4f46\u5982\u679c\u6240\u9700\u6570\u636e\u76ee\u5f55\u7684\u7236\u76ee\u5f55\u5f52 root \u6240\u6709\uff0c\u5b83\u53ef\u80fd\u6ca1\u6709\u8db3\u591f\u7684\u6743\u9650\u3002\u8981\u5728\u8fd9\u79cd\u73af\u5883\u4e2d\u521d\u59cb\u5316\uff0c\u53ef\u5148\u7531 root \u521b\u5efa\u4e00\u4e2a\u7a7a\u7684\u6570\u636e\u76ee\u5f55\uff0c\u7136\u540e\u7528<code class=\"command\">chown</code>\u5c06\u8be5\u76ee\u5f55\u7684\u6240\u6709\u6743\u8d4b\u4e88\u6570\u636e\u5e93\u7528\u6237\u8d26\u6237\uff0c\u518d\u7528 <code class=\"command\">su</code>\u5207\u6362\u4e3a\u8be5\u6570\u636e\u5e93\u7528\u6237\u6765\u8fd0\u884c<code class=\"command\">initdb</code>\u3002</p>\n<p lang=\"zh\"><code class=\"command\">initdb</code>\u5fc5\u987b\u4ee5\u5c06\u62e5\u6709\u670d\u52a1\u5668\u8fdb\u7a0b\u7684\u7528\u6237\u8eab\u4efd\u8fd0\u884c\uff0c\u56e0\u4e3a\u670d\u52a1\u5668\u9700\u8981\u8bbf\u95ee <code class=\"command\">initdb</code>\u521b\u5efa\u7684\u6587\u4ef6\u548c\u76ee\u5f55\u3002\u7531\u4e8e\u670d\u52a1\u5668\u4e0d\u80fd\u4ee5 root \u8eab\u4efd\u8fd0\u884c\uff0c\u56e0\u6b64\u4e5f\u7edd\u4e0d\u80fd\u4ee5 root \u8eab\u4efd\u8fd0\u884c<code class=\"command\">initdb</code>\u3002\uff08\u5b9e\u9645\u4e0a\u5b83\u4f1a\u62d2\u7edd\u8fd9\u6837\u505a\u3002\uff09</p>\n<p lang=\"zh\">\u51fa\u4e8e\u5b89\u5168\u539f\u56e0\uff0c<code class=\"command\">initdb</code>\u521b\u5efa\u7684\u65b0\u96c6\u7c07\u9ed8\u8ba4\u53ea\u6709\u96c6\u7c07\u62e5\u6709\u8005\u53ef\u4ee5\u8bbf\u95ee\u3002<code class=\"option\">--allow-group-access</code> \u9009\u9879\u5141\u8bb8\u4e0e\u96c6\u7c07\u62e5\u6709\u8005\u540c\u7ec4\u7684\u4efb\u4f55\u7528\u6237\u8bfb\u53d6\u96c6\u7c07\u4e2d\u7684\u6587\u4ef6\u3002\u8fd9\u5bf9\u7531\u975e\u7279\u6743\u7528\u6237\u6267\u884c\u5907\u4efd\u5f88\u6709\u7528\u3002</p>\n<p lang=\"zh\"><code class=\"command\">initdb</code>\u4f1a\u521d\u59cb\u5316\u6570\u636e\u5e93\u96c6\u7c07\u7684\u9ed8\u8ba4\u533a\u57df\u8bbe\u7f6e\u548c\u5b57\u7b26\u96c6\u7f16\u7801\u3002\u8fd9\u4e9b\u8bbe\u7f6e\u4e5f\u53ef\u4ee5\u5728\u521b\u5efa\u6bcf\u4e2a\u6570\u636e\u5e93\u65f6\u5206\u522b\u8bbe\u7f6e\u3002<code class=\"command\">initdb</code>\u4e3a\u6a21\u677f\u6570\u636e\u5e93\u786e\u5b9a\u8fd9\u4e9b\u8bbe\u7f6e\uff0c\u5b83\u4eec\u5c06\u4f5c\u4e3a\u6240\u6709\u5176\u4ed6\u6570\u636e\u5e93\u7684\u9ed8\u8ba4\u503c\u3002</p>\n<p lang=\"zh\">\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c<code class=\"command\">initdb</code>\u4f7f\u7528<code class=\"literal\">libc</code>\u533a\u57df\u8bbe\u7f6e\u63d0\u4f9b\u7a0b\u5e8f\uff08\u89c1<a class=\"xref\" href=\"/docs/18/locale.html#LOCALE-PROVIDERS\" title=\"23.1.4.\u00a0\u533a\u57df\u8bbe\u7f6e\u63d0\u4f9b\u7a0b\u5e8f\">\u7b2c\u00a023.1.4\u00a0\u8282</a>\uff09\u3002<code class=\"literal\">libc</code>\u533a\u57df\u8bbe\u7f6e\u63d0\u4f9b\u7a0b\u5e8f\u4f1a\u4ece\u73af\u5883\u4e2d\u83b7\u53d6\u533a\u57df\u8bbe\u7f6e\uff0c\u5e76\u6839\u636e\u533a\u57df\u8bbe\u7f6e\u786e\u5b9a\u7f16\u7801\u3002</p>\n<p lang=\"zh\">\u8981\u4e3a\u96c6\u7c07\u9009\u62e9\u4e0d\u540c\u7684\u533a\u57df\u8bbe\u7f6e\uff0c\u8bf7\u4f7f\u7528<code class=\"option\">--locale</code>\u3002\u6b64\u5916\u8fd8\u6709\u5355\u72ec\u7684 <code class=\"option\">--lc-*</code> \u548c <code class=\"option\">--icu-locale</code> \u9009\u9879\uff08\u89c1\u4e0b\u6587\uff09\uff0c\u7528\u4e8e\u4e3a\u5404\u4e2a\u533a\u57df\u8bbe\u7f6e\u7c7b\u522b\u8bbe\u7f6e\u503c\u3002\u8bf7\u6ce8\u610f\uff0c\u4e0d\u540c\u533a\u57df\u8bbe\u7f6e\u7c7b\u522b\u4e4b\u95f4\u82e5\u8bbe\u7f6e\u4e0d\u4e00\u81f4\uff0c\u53ef\u80fd\u4ea7\u751f\u4e0d\u5408\u7406\u7684\u7ed3\u679c\uff0c\u56e0\u6b64\u5e94\u8c28\u614e\u4f7f\u7528\u3002</p>\n<p lang=\"zh\">\u4e5f\u53ef\u4ee5\u6307\u5b9a --locale-provider=icu\uff0c\u8ba9 initdb \u4f7f\u7528 ICU \u5e93\u63d0\u4f9b\u533a\u57df\u8bbe\u7f6e\u670d\u52a1\u3002\u670d\u52a1\u5668\u5fc5\u987b\u5728\u6784\u5efa\u65f6\u542f\u7528 ICU \u652f\u6301\u3002\u4f7f\u7528 --icu-locale \u9009\u9879\u9009\u62e9\u5177\u4f53\u7684 ICU \u533a\u57df ID\u3002\u6ce8\u610f\uff0c\u51fa\u4e8e\u5b9e\u73b0\u65b9\u9762\u7684\u539f\u56e0\u4ee5\u53ca\u5bf9\u65e7\u4ee3\u7801\u7684\u517c\u5bb9\uff0c\u5373\u4f7f\u4f7f\u7528 ICU \u533a\u57df\u8bbe\u7f6e\u63d0\u4f9b\u8005\uff0cinitdb \u4ecd\u4f1a\u9009\u62e9\u5e76\u521d\u59cb\u5316 libc \u533a\u57df\u8bbe\u7f6e\u3002</p>\n<p lang=\"zh\"><code class=\"command\">initdb</code>\u8fd0\u884c\u65f6\u4f1a\u6253\u5370\u51fa\u5b83\u9009\u62e9\u7684\u533a\u57df\u8bbe\u7f6e\u3002\u5982\u679c\u6709\u590d\u6742\u9700\u6c42\u6216\u8005\u6307\u5b9a\u4e86\u591a\u4e2a\u9009\u9879\uff0c\u5efa\u8bae\u68c0\u67e5\u7ed3\u679c\u662f\u5426\u7b26\u5408\u9884\u671f\u3002</p>\n<p lang=\"zh\">\u6709\u5173\u533a\u57df\u8bbe\u7f6e\u7684\u66f4\u591a\u7ec6\u8282\u89c1<a class=\"xref\" href=\"/docs/18/locale.html\" title=\"23.1.\u00a0\u533a\u57df\u8bbe\u7f6e\u652f\u6301\">\u7b2c\u00a023.1\u00a0\u8282</a>\u3002</p>\n<p lang=\"zh\">\u8981\u4fee\u6539\u9ed8\u8ba4\u7f16\u7801\uff0c\u8bf7\u4f7f\u7528<code class=\"option\">--encoding</code>\u3002\u66f4\u591a\u7ec6\u8282\u89c1<a class=\"xref\" href=\"/docs/18/multibyte.html\" title=\"23.3.\u00a0\u5b57\u7b26\u96c6\u652f\u6301\">\u7b2c\u00a023.3\u00a0\u8282</a>\u3002</p>\n</div>\n<div class=\"refsect1\" id=\"id-1.9.5.3.6\">\n<h2 lang=\"zh\">\u9009\u9879</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 lang=\"zh\">\u8be5\u9009\u9879\u6307\u5b9a<code class=\"filename\">pg_hba.conf</code>\u4e2d\u672c\u5730\u7528\u6237\u9ed8\u8ba4\u4f7f\u7528\u7684\u8ba4\u8bc1\u65b9\u6cd5\uff08<code class=\"literal\">host</code> \u548c <code class=\"literal\">local</code> \u884c\uff09\u3002\u6709\u6548\u503c\u6982\u89c8\u89c1<a class=\"xref\" href=\"/docs/18/auth-pg-hba-conf.html\" title=\"20.1.\u00a0pg_hba.conf \u6587\u4ef6\">\u7b2c\u00a020.1\u00a0\u8282</a>\u3002</p>\n<p lang=\"zh\"><code class=\"command\">initdb</code>\u4f1a\u4f7f\u7528\u6307\u5b9a\u7684\u8ba4\u8bc1\u65b9\u6cd5\u9884\u586b\u5145<code class=\"filename\">pg_hba.conf</code> \u6761\u76ee\uff0c\u65e2\u7528\u4e8e\u975e\u590d\u5236\u8fde\u63a5\uff0c\u4e5f\u7528\u4e8e\u590d\u5236\u8fde\u63a5\u3002</p>\n<p lang=\"zh\">\u9664\u975e\u4fe1\u4efb\u7cfb\u7edf\u4e0a\u7684\u6240\u6709\u672c\u5730\u7528\u6237\uff0c\u5426\u5219\u4e0d\u8981\u4f7f\u7528<code class=\"literal\">trust</code>\u3002\u4e3a\u4e86\u4fbf\u4e8e\u5b89\u88c5\uff0c\u9ed8\u8ba4\u4f7f\u7528<code class=\"literal\">trust</code>\u3002</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 lang=\"zh\">\n<p>\u8be5\u9009\u9879\u6307\u5b9a<code class=\"filename\">pg_hba.conf</code>\u4e2d\u672c\u5730\u7528\u6237\u901a\u8fc7 TCP/IP \u8fde\u63a5\u65f6\uff08<code class=\"literal\">host</code> \u884c\uff09\u4f7f\u7528\u7684\u8ba4\u8bc1\u65b9\u6cd5\u3002</p>\n</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 lang=\"zh\">\n<p>\u8be5\u9009\u9879\u6307\u5b9a<code class=\"filename\">pg_hba.conf</code>\u4e2d\u672c\u5730\u7528\u6237\u901a\u8fc7 Unix \u57df\u5957\u63a5\u5b57\u8fde\u63a5\u65f6\uff08<code class=\"literal\">local</code> \u884c\uff09\u4f7f\u7528\u7684\u8ba4\u8bc1\u65b9\u6cd5\u3002</p>\n</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 lang=\"zh\">\n<p>\u8be5\u9009\u9879\u6307\u5b9a\u6570\u636e\u5e93\u96c6\u7c07\u5e94\u5b58\u653e\u7684\u76ee\u5f55\u3002\u8fd9\u662f<code class=\"command\">initdb</code>\u6240\u9700\u7684\u552f\u4e00\u4fe1\u606f\uff0c\u4f46\u4e5f\u53ef\u4ee5\u901a\u8fc7\u8bbe\u7f6e<code class=\"envar\">PGDATA</code>\u73af\u5883\u53d8\u91cf\u6765\u7701\u53bb\u663e\u5f0f\u5199\u51fa\u5b83\uff1b\u8fd9\u901a\u5e38\u66f4\u65b9\u4fbf\uff0c\u56e0\u4e3a\u6570\u636e\u5e93\u670d\u52a1\u5668\uff08<code class=\"command\">postgres</code>\uff09\u4e4b\u540e\u4e5f\u53ef\u4ee5\u901a\u8fc7\u540c\u4e00\u53d8\u91cf\u627e\u5230\u6570\u636e\u76ee\u5f55\u3002</p>\n</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 lang=\"zh\">\u9009\u62e9\u6a21\u677f\u6570\u636e\u5e93\u7684\u7f16\u7801\u3002\u8fd9\u4e5f\u5c06\u6210\u4e3a\u4ee5\u540e\u521b\u5efa\u7684\u4efb\u4f55\u6570\u636e\u5e93\u7684\u9ed8\u8ba4\u7f16\u7801\uff0c\u9664\u975e\u5728\u521b\u5efa\u65f6\u8986\u76d6\u5b83\u3002<span class=\"productname\">PostgreSQL</span>\u670d\u52a1\u5668\u652f\u6301\u7684\u5b57\u7b26\u96c6\u89c1<a class=\"xref\" href=\"/docs/18/multibyte.html#MULTIBYTE-CHARSET-SUPPORTED\" title=\"23.3.1.\u00a0\u652f\u6301\u7684\u5b57\u7b26\u96c6\">\u7b2c\u00a023.3.1\u00a0\u8282</a>\u3002</p>\n<p lang=\"zh\">\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c\u6a21\u677f\u6570\u636e\u5e93\u7684\u7f16\u7801\u7531\u533a\u57df\u8bbe\u7f6e\u51b3\u5b9a\u3002\u5982\u679c\u6307\u5b9a --no-locale\uff08\u6216\u7b49\u4ef7\u5730\u5c06\u533a\u57df\u8bbe\u7f6e\u8bbe\u4e3a C \u6216 POSIX\uff09\uff0c\u5219 ICU \u63d0\u4f9b\u8005\u7684\u9ed8\u8ba4\u7f16\u7801\u4e3a UTF8\uff0clibc \u63d0\u4f9b\u8005\u7684\u9ed8\u8ba4\u7f16\u7801\u4e3a SQL_ASCII\u3002</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 lang=\"zh\">\u5141\u8bb8\u4e0e\u96c6\u7fa4\u6240\u6709\u8005\u540c\u7ec4\u7684\u7528\u6237\u8bfb\u53d6 initdb \u521b\u5efa\u7684\u6240\u6709\u96c6\u7fa4\u6587\u4ef6\u3002Windows \u4e0d\u652f\u6301 POSIX \u98ce\u683c\u7684\u7ec4\u6743\u9650\uff0c\u56e0\u6b64\u4f1a\u5ffd\u7565\u6b64\u9009\u9879\u3002</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 lang=\"zh\">\n<p>\u5f53\u4f7f\u7528 ICU \u63d0\u4f9b\u7a0b\u5e8f\u65f6\uff0c\u6307\u5b9a ICU \u533a\u57df\u8bbe\u7f6e\u3002\u533a\u57df\u8bbe\u7f6e\u652f\u6301\u89c1<a class=\"xref\" href=\"/docs/18/locale.html\" title=\"23.1.\u00a0\u533a\u57df\u8bbe\u7f6e\u652f\u6301\">\u7b2c\u00a023.1\u00a0\u8282</a>\u3002</p>\n</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 lang=\"zh\">\n<p>\u6307\u5b9a\u9644\u52a0\u7684\u6392\u5e8f\u89c4\u5219\uff0c\u4ee5\u5b9a\u5236\u9ed8\u8ba4\u6392\u5e8f\u89c4\u5219\u7684\u884c\u4e3a\u3002\u8be5\u9009\u9879\u4ec5\u652f\u6301 ICU\u3002</p>\n</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 lang=\"zh\">\u5bf9\u6570\u636e\u9875\u542f\u7528\u6821\u9a8c\u548c\uff0c\u4ee5\u5e2e\u52a9\u68c0\u6d4b\u539f\u672c\u4f1a\u6084\u65e0\u58f0\u606f\u53d1\u751f\u7684\u3001\u7531 I/O \u7cfb\u7edf\u5bfc\u81f4\u7684\u635f\u574f\u3002\u8be5\u9879\u9ed8\u8ba4\u542f\u7528\uff1b\u4f7f\u7528<a class=\"xref\" href=\"/docs/18/app-initdb.html#APP-INITDB-NO-DATA-CHECKSUMS\"><code class=\"option\">--no-data-checksums</code></a>\u53ef\u7981\u7528\u6821\u9a8c\u548c\u3002</p>\n<p lang=\"zh\">\u542f\u7528\u6821\u9a8c\u548c\u53ef\u80fd\u4f1a\u5e26\u6765\u5c0f\u5e45\u6027\u80fd\u635f\u5931\u3002\u5982\u679c\u542f\u7528\uff0c\u5c31\u4f1a\u4e3a\u6240\u6709\u6570\u636e\u5e93\u4e2d\u7684\u6240\u6709\u5bf9\u8c61\u8ba1\u7b97\u6821\u9a8c\u548c\u3002\u6240\u6709\u6821\u9a8c\u548c\u5931\u8d25\u90fd\u4f1a\u5728 <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>\u89c6\u56fe\u4e2d\u62a5\u544a\u3002\u8be6\u89c1<a class=\"xref\" href=\"/docs/18/checksums.html\" title=\"28.2.\u00a0\u6570\u636e\u6821\u9a8c\u548c\">\u7b2c\u00a028.2\u00a0\u8282</a>\u3002</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 lang=\"zh\">\u8bbe\u7f6e\u6570\u636e\u5e93\u96c6\u7c07\u7684\u9ed8\u8ba4\u533a\u57df\u8bbe\u7f6e\u3002\u5982\u679c\u672a\u6307\u5b9a\u8be5\u9009\u9879\uff0c\u533a\u57df\u8bbe\u7f6e\u5c06\u7ee7\u627f\u81ea <code class=\"command\">initdb</code>\u8fd0\u884c\u65f6\u6240\u5728\u7684\u73af\u5883\u3002\u533a\u57df\u8bbe\u7f6e\u652f\u6301\u89c1<a class=\"xref\" href=\"/docs/18/locale.html\" title=\"23.1.\u00a0\u533a\u57df\u8bbe\u7f6e\u652f\u6301\">\u7b2c\u00a023.1\u00a0\u8282</a>\u3002</p>\n<p lang=\"zh\">\u5982\u679c<code class=\"option\">--locale-provider</code>\u4e3a<code class=\"literal\">builtin</code>\uff0c\u5219\u5fc5\u987b\u6307\u5b9a<code class=\"option\">--locale</code>\u6216<code class=\"option\">--builtin-locale</code>\uff0c\u5e76\u5c06\u5176\u8bbe\u7f6e\u4e3a<code class=\"literal\">C</code>\u3001<code class=\"literal\">C.UTF-8</code>\u6216 <code class=\"literal\">PG_UNICODE_FAST</code>\u3002</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 lang=\"zh\">\n<p>\u7c7b\u4f3c\u4e8e<code class=\"option\">--locale</code>\uff0c\u4f46\u53ea\u5728\u6307\u5b9a\u7684\u7c7b\u522b\u4e2d\u8bbe\u7f6e\u533a\u57df\u8bbe\u7f6e\u3002</p>\n</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 lang=\"zh\">\n<p>\u7b49\u4ef7\u4e8e<code class=\"option\">--locale=C</code>\u3002</p>\n</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 lang=\"zh\">\n<p>\u5f53\u4f7f\u7528 builtin \u63d0\u4f9b\u7a0b\u5e8f\u65f6\uff0c\u6307\u5b9a\u533a\u57df\u8bbe\u7f6e\u540d\u79f0\u3002\u533a\u57df\u8bbe\u7f6e\u652f\u6301\u89c1<a class=\"xref\" href=\"/docs/18/locale.html\" title=\"23.1.\u00a0\u533a\u57df\u8bbe\u7f6e\u652f\u6301\">\u7b2c\u00a023.1\u00a0\u8282</a>\u3002</p>\n</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 lang=\"zh\">\n<p>\u8be5\u9009\u9879\u8bbe\u7f6e\u65b0\u96c6\u7c07\u4e2d\u521b\u5efa\u7684\u6570\u636e\u5e93\u6240\u4f7f\u7528\u7684\u533a\u57df\u8bbe\u7f6e\u63d0\u4f9b\u7a0b\u5e8f\u3002\u540e\u7eed\u521b\u5efa\u65b0\u6570\u636e\u5e93\u65f6\uff0c\u53ef\u4ee5\u5728<code class=\"command\">CREATE DATABASE</code>\u547d\u4ee4\u4e2d\u8986\u76d6\u5b83\u3002\u9ed8\u8ba4\u503c\u4e3a <code class=\"literal\">libc</code>\uff08\u89c1<a class=\"xref\" href=\"/docs/18/locale.html#LOCALE-PROVIDERS\" title=\"23.1.4.\u00a0\u533a\u57df\u8bbe\u7f6e\u63d0\u4f9b\u7a0b\u5e8f\">\u7b2c\u00a023.1.4\u00a0\u8282</a>\uff09\u3002</p>\n</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 lang=\"zh\">\n<p>\u4e0d\u542f\u7528\u6570\u636e\u6821\u9a8c\u548c\u3002</p>\n</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 lang=\"zh\">\n<p>\u4f7f<code class=\"command\">initdb</code>\u4ece\u6587\u4ef6\u4e2d\u8bfb\u53d6\u5f15\u5bfc\u8d85\u7ea7\u7528\u6237\u7684\u5bc6\u7801\u3002\u6587\u4ef6\u7684\u7b2c\u4e00\u884c\u4f1a\u88ab\u5f53\u4f5c\u5bc6\u7801\u3002</p>\n</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 lang=\"zh\">\n<p>\u8bbe\u7f6e\u9ed8\u8ba4\u6587\u672c\u68c0\u7d22\u914d\u7f6e\u3002\u66f4\u591a\u4fe1\u606f\u89c1<a class=\"xref\" href=\"/docs/18/runtime-config-client.html#GUC-DEFAULT-TEXT-SEARCH-CONFIG\">default_text_search_config</a>\u3002</p>\n</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 lang=\"zh\">\n<p>\u8bbe\u7f6e<a class=\"glossterm\" href=\"/docs/18/glossary.html#GLOSSARY-BOOTSTRAP-SUPERUSER\"></a><a class=\"glossterm\" href=\"/docs/18/glossary.html#GLOSSARY-BOOTSTRAP-SUPERUSER\" title=\"\u5f15\u5bfc\u8d85\u7ea7\u7528\u6237\">\u5f15\u5bfc\u8d85\u7ea7\u7528\u6237</a>\u7684\u7528\u6237\u540d\u3002\u9ed8\u8ba4\u503c\u662f\u8fd0\u884c<code class=\"command\">initdb</code>\u7684\u64cd\u4f5c\u7cfb\u7edf\u7528\u6237\u540d\u3002</p>\n</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 lang=\"zh\">\n<p>\u4f7f<code class=\"command\">initdb</code>\u63d0\u793a\u8f93\u5165\u8981\u8d4b\u7ed9\u5f15\u5bfc\u8d85\u7ea7\u7528\u6237\u7684\u5bc6\u7801\u3002\u5982\u679c\u4e0d\u6253\u7b97\u4f7f\u7528\u5bc6\u7801\u8ba4\u8bc1\uff0c\u8fd9\u4e00\u70b9\u5e76\u4e0d\u91cd\u8981\u3002\u5426\u5219\uff0c\u5728\u8bbe\u7f6e\u5bc6\u7801\u4e4b\u524d\u5c06\u65e0\u6cd5\u4f7f\u7528\u5bc6\u7801\u8ba4\u8bc1\u3002</p>\n</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 lang=\"zh\">\n<p>\u8be5\u9009\u9879\u6307\u5b9a\u9884\u5199\u5f0f\u65e5\u5fd7\uff08WAL\uff09\u5e94\u5b58\u653e\u7684\u76ee\u5f55\u3002</p>\n</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 lang=\"zh\">\u8bbe\u7f6e WAL \u6bb5\u5927\u5c0f\uff0c\u5355\u4f4d\u4e3a\u5146\u5b57\u8282\u3002\u8fd9\u662f WAL \u65e5\u5fd7\u4e2d\u6bcf\u4e2a\u72ec\u7acb\u6587\u4ef6\u7684\u5927\u5c0f\u3002\u9ed8\u8ba4\u5927\u5c0f\u4e3a 16 \u5146\u5b57\u8282\u3002\u53d6\u503c\u5fc5\u987b\u662f 1 \u5230 1024\uff08\u5146\u5b57\u8282\uff09\u4e4b\u95f4\u7684 2 \u7684\u5e42\u3002\u6b64\u9009\u9879\u53ea\u80fd\u5728\u521d\u59cb\u5316\u65f6\u8bbe\u7f6e\uff0c\u4e4b\u540e\u65e0\u6cd5\u66f4\u6539\u3002</p>\n<p lang=\"zh\">\u8c03\u6574\u8be5\u5927\u5c0f\u53ef\u80fd\u6709\u52a9\u4e8e\u63a7\u5236 WAL \u65e5\u5fd7\u4f20\u9001\u6216\u5f52\u6863\u7684\u7c92\u5ea6\u3002\u6b64\u5916\uff0c\u5728 WAL \u91cf\u5f88\u5927\u7684\u6570\u636e\u5e93\u4e2d\uff0c\u6bcf\u4e2a\u76ee\u5f55\u4e2d\u7684 WAL \u6587\u4ef6\u6570\u91cf\u53ef\u80fd\u4f1a\u6210\u4e3a\u6027\u80fd\u548c\u7ba1\u7406\u95ee\u9898\u3002\u589e\u5927 WAL \u6587\u4ef6\u5927\u5c0f\u4f1a\u51cf\u5c11 WAL \u6587\u4ef6\u6570\u91cf\u3002</p>\n</dd>\n</dl>\n</div>\n<p lang=\"zh\">\u8fd8\u63d0\u4f9b\u4e86\u5176\u4ed6\u4e00\u4e9b\u8f83\u5c11\u4f7f\u7528\u7684\u9009\u9879\uff1a</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 lang=\"zh\">\u5728 initdb \u671f\u95f4\u5f3a\u5236\u5c06\u670d\u52a1\u5668\u53c2\u6570 name \u8bbe\u4e3a value\uff0c\u5e76\u628a\u8be5\u8bbe\u7f6e\u5199\u5165\u751f\u6210\u7684 postgresql.conf \u6587\u4ef6\uff0c\u4f7f\u5176\u5728\u4e4b\u540e\u7684\u670d\u52a1\u5668\u8fd0\u884c\u4e2d\u4e5f\u751f\u6548\u3002\u6b64\u9009\u9879\u53ef\u591a\u6b21\u4f7f\u7528\uff0c\u4ee5\u8bbe\u7f6e\u591a\u4e2a\u53c2\u6570\u3002\u5b83\u4e3b\u8981\u7528\u4e8e\u73af\u5883\u6761\u4ef6\u5bfc\u81f4\u670d\u52a1\u5668\u5b8c\u5168\u65e0\u6cd5\u4f7f\u7528\u9ed8\u8ba4\u53c2\u6570\u542f\u52a8\u7684\u60c5\u51b5\u3002</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 lang=\"zh\">\n<p>\u6253\u5370\u5f15\u5bfc\u540e\u7aef\u7684\u8c03\u8bd5\u8f93\u51fa\uff0c\u4ee5\u53ca\u5c11\u91cf\u666e\u901a\u7528\u6237\u901a\u5e38\u4e0d\u611f\u5174\u8da3\u7684\u5176\u4ed6\u6d88\u606f\u3002\u5f15\u5bfc\u540e\u7aef\u662f <code class=\"command\">initdb</code>\u7528\u6765\u521b\u5efa\u7cfb\u7edf\u76ee\u5f55\u8868\u7684\u7a0b\u5e8f\u3002\u8be5\u9009\u9879\u4f1a\u4ea7\u751f\u5927\u91cf\u6781\u5176\u4e4f\u5473\u7684\u8f93\u51fa\u3002</p>\n</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 lang=\"zh\">\n<p>\u4f7f\u7528<code class=\"literal\">debug_discard_caches=1</code>\u9009\u9879\u8fd0\u884c\u5f15\u5bfc\u540e\u7aef\u3002\u8fd9\u4f1a\u82b1\u8d39\u5f88\u957f\u65f6\u95f4\uff0c\u53ea\u5bf9\u6df1\u5ea6\u8c03\u8bd5\u6709\u7528\u3002</p>\n</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 lang=\"zh\">\n<p>\u6307\u5b9a<code class=\"command\">initdb</code>\u521d\u59cb\u5316\u6570\u636e\u5e93\u96c6\u7c07\u65f6\u5e94\u5230\u54ea\u91cc\u67e5\u627e\u5176\u8f93\u5165\u6587\u4ef6\u3002\u901a\u5e38\u4e0d\u9700\u8981\u8fd9\u6837\u505a\u3002\u82e5\u9700\u8981\u663e\u5f0f\u6307\u5b9a\u5176\u4f4d\u7f6e\uff0c\u7cfb\u7edf\u4f1a\u63d0\u793a\u3002</p>\n</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 lang=\"zh\">\n<p>\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c\u5982\u679c<code class=\"command\">initdb</code>\u53d1\u73b0\u67d0\u4e2a\u9519\u8bef\u4f7f\u5176\u65e0\u6cd5\u5b8c\u6574\u521b\u5efa\u6570\u636e\u5e93\u96c6\u7c07\uff0c\u5c31\u4f1a\u5220\u9664\u5b83\u5728\u53d1\u73b0\u65e0\u6cd5\u5b8c\u6210\u4efb\u52a1\u4e4b\u524d\u53ef\u80fd\u5df2\u521b\u5efa\u7684\u6240\u6709\u6587\u4ef6\u3002\u8be5\u9009\u9879\u4f1a\u7981\u6b62\u8fd9\u79cd\u6e05\u7406\uff0c\u56e0\u6b64\u5bf9\u8c03\u8bd5\u6709\u7528\u3002</p>\n</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 lang=\"zh\">\n<p>\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c<code class=\"command\">initdb</code>\u4f1a\u7b49\u5f85\u6240\u6709\u6587\u4ef6\u90fd\u5b89\u5168\u5199\u5165\u78c1\u76d8\u3002\u8be5\u9009\u9879\u4f7f <code class=\"command\">initdb</code>\u5728\u4e0d\u7b49\u5f85\u7684\u60c5\u51b5\u4e0b\u8fd4\u56de\uff0c\u901f\u5ea6\u66f4\u5feb\uff0c\u4f46\u8fd9\u610f\u5473\u7740\u5982\u679c\u540e\u7eed\u64cd\u4f5c\u7cfb\u7edf\u5d29\u6e83\uff0c\u6570\u636e\u76ee\u5f55\u53ef\u80fd\u4f1a\u635f\u574f\u3002\u901a\u5e38\uff0c\u8be5\u9009\u9879\u9002\u7528\u4e8e\u6d4b\u8bd5\uff0c\u4f46\u4e0d\u5e94\u7528\u4e8e\u521b\u5efa\u751f\u4ea7\u73af\u5883\u5b89\u88c5\u3002</p>\n</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 lang=\"zh\">\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c<code class=\"command\">initdb</code>\u4f1a\u5c06\u6240\u6709\u6570\u636e\u5e93\u6587\u4ef6\u5b89\u5168\u5730\u5199\u5165\u78c1\u76d8\u3002\u8be5\u9009\u9879\u6307\u793a<code class=\"command\">initdb</code>\u8df3\u8fc7\u540c\u6b65\u5404\u4e2a\u6570\u636e\u5e93\u76ee\u5f55\u4e2d\u7684\u6240\u6709\u6587\u4ef6\u3001\u8fd9\u4e9b\u6570\u636e\u5e93\u76ee\u5f55\u672c\u8eab\u4ee5\u53ca\u8868\u7a7a\u95f4\u76ee\u5f55\uff0c\u4e5f\u5c31\u662f<code class=\"filename\">base</code>\u5b50\u76ee\u5f55\u4e2d\u7684\u6240\u6709\u5185\u5bb9\u548c\u4efb\u4f55\u5176\u4ed6\u8868\u7a7a\u95f4\u76ee\u5f55\u3002\u5176\u4ed6\u6587\u4ef6\uff0c\u4f8b\u5982<code class=\"literal\">pg_wal</code>\u548c<code class=\"literal\">pg_xact</code>\u4e2d\u7684\u6587\u4ef6\uff0c\u4ecd\u4f1a\u88ab\u540c\u6b65\uff0c\u9664\u975e\u4e5f\u6307\u5b9a\u4e86<code class=\"option\">--no-sync</code>\u3002</p>\n<p lang=\"zh\">\u8bf7\u6ce8\u610f\uff0c\u5982\u679c<code class=\"option\">--no-sync-data-files</code>\u4e0e <code class=\"option\">--sync-method=syncfs</code>\u4e00\u8d77\u4f7f\u7528\uff0c\u4e0a\u8ff0\u90e8\u5206\u6216\u5168\u90e8\u6587\u4ef6\u4e0e\u76ee\u5f55\u4ecd\u4f1a\u88ab\u540c\u6b65\uff0c\u56e0\u4e3a<code class=\"literal\">syncfs</code>\u5904\u7406\u7684\u662f\u6574\u4e2a\u6587\u4ef6\u7cfb\u7edf\u3002</p>\n<p lang=\"zh\">\u8be5\u9009\u9879\u4e3b\u8981\u4f9b\u90a3\u4e9b\u4f1a\u53e6\u884c\u786e\u4fdd\u8fd9\u4e9b\u88ab\u8df3\u8fc7\u6587\u4ef6\u5df2\u540c\u6b65\u5230\u78c1\u76d8\u7684\u5de5\u5177\u5728\u5185\u90e8\u4f7f\u7528\u3002</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 lang=\"zh\">\n<p>\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c<code class=\"command\">initdb</code>\u4f1a\u5728\u5176\u8f93\u51fa\u672b\u5c3e\u5199\u51fa\u5982\u4f55\u542f\u52a8\u96c6\u7c07\u7684\u8bf4\u660e\u3002\u8be5\u9009\u9879\u4f1a\u7701\u7565\u8fd9\u4e9b\u8bf4\u660e\u3002\u5b83\u4e3b\u8981\u4f9b\u90a3\u4e9b\u5bf9<code class=\"command\">initdb</code>\u8fdb\u884c\u5e73\u53f0\u7279\u5b9a\u5c01\u88c5\u7684\u5de5\u5177\u4f7f\u7528\uff0c\u56e0\u4e3a\u5728\u8fd9\u79cd\u60c5\u51b5\u4e0b\u90a3\u4e9b\u8bf4\u660e\u5f88\u53ef\u80fd\u5e76\u4e0d\u6b63\u786e\u3002</p>\n</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 lang=\"zh\">\n<p>\u663e\u793a\u5185\u90e8\u8bbe\u7f6e\u5e76\u9000\u51fa\uff0c\u4e0d\u6267\u884c\u5176\u4ed6\u64cd\u4f5c\u3002\u53ef\u7528\u4e8e\u8c03\u8bd5<span class=\"application\">initdb</span>\u7684\u5b89\u88c5\u3002</p>\n</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 lang=\"zh\">\u8bbe\u4e3a<code class=\"literal\">fsync</code>\uff08\u9ed8\u8ba4\u503c\uff09\u65f6\uff0c<code class=\"command\">initdb</code>\u4f1a\u9012\u5f52\u6253\u5f00\u5e76\u540c\u6b65\u6570\u636e\u76ee\u5f55\u4e2d\u7684\u6240\u6709\u6587\u4ef6\u3002\u67e5\u627e\u6587\u4ef6\u65f6\u4f1a\u8ddf\u968f WAL \u76ee\u5f55\u548c\u6bcf\u4e2a\u5df2\u914d\u7f6e\u8868\u7a7a\u95f4\u7684\u7b26\u53f7\u94fe\u63a5\u3002</p>\n<p lang=\"zh\">\u5728 Linux \u4e0a\uff0c\u4e5f\u53ef\u4ee5\u6539\u7528<code class=\"literal\">syncfs</code>\uff0c\u8bf7\u6c42\u64cd\u4f5c\u7cfb\u7edf\u540c\u6b65\u5305\u542b\u6570\u636e\u76ee\u5f55\u3001WAL \u6587\u4ef6\u4ee5\u53ca\u6bcf\u4e2a\u8868\u7a7a\u95f4\u7684\u6574\u4e2a\u6587\u4ef6\u7cfb\u7edf\u3002\u4f7f\u7528<code class=\"literal\">syncfs</code>\u65f6\u9700\u6ce8\u610f\u7684\u4e8b\u9879\u89c1<a class=\"xref\" href=\"/docs/18/runtime-config-error-handling.html#GUC-RECOVERY-INIT-SYNC-METHOD\">recovery_init_sync_method</a>\u3002</p>\n<p lang=\"zh\">\u4f7f\u7528<code class=\"option\">--no-sync</code>\u65f6\uff0c\u8be5\u9009\u9879\u4e0d\u8d77\u4f5c\u7528\u3002</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 lang=\"zh\">\n<p>\u5c06\u6240\u6709\u6570\u636e\u5e93\u6587\u4ef6\u5b89\u5168\u5730\u5199\u5165\u78c1\u76d8\u5e76\u9000\u51fa\u3002\u8fd9\u4e0d\u4f1a\u6267\u884c\u4efb\u4f55\u5e38\u89c4\u7684 <span class=\"application\">initdb</span>\u64cd\u4f5c\u3002\u901a\u5e38\uff0c\u8be5\u9009\u9879\u53ef\u7528\u4e8e\u5728\u5c06<a class=\"xref\" href=\"/docs/18/runtime-config-wal.html#GUC-FSYNC\">fsync</a>\u4ece<code class=\"literal\">off</code>\u6539\u4e3a<code class=\"literal\">on</code>\u540e\uff0c\u786e\u4fdd\u80fd\u591f\u53ef\u9760\u6062\u590d\u3002</p>\n</p>\n</dd>\n</dl>\n</div>\n<p lang=\"zh\">\u5176\u4ed6\u9009\u9879\uff1a</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 lang=\"zh\">\n<p>\u6253\u5370<span class=\"application\">initdb</span>\u7248\u672c\u5e76\u9000\u51fa\u3002</p>\n</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 lang=\"zh\">\n<p>\u663e\u793a\u6709\u5173<span class=\"application\">initdb</span>\u547d\u4ee4\u884c\u53c2\u6570\u7684\u5e2e\u52a9\u5e76\u9000\u51fa\u3002</p>\n</p>\n</dd>\n</dl>\n</div>\n</div>\n<div class=\"refsect1\" id=\"id-1.9.5.3.7\">\n<h2 lang=\"zh\">\u73af\u5883</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 lang=\"zh\">\n<p>\u6307\u5b9a\u6570\u636e\u5e93\u96c6\u7c07\u5e94\u5b58\u653e\u7684\u76ee\u5f55\uff1b\u53ef\u4f7f\u7528<code class=\"option\">-D</code>\u9009\u9879\u8986\u76d6\u3002</p>\n</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 lang=\"zh\">\n<p>\u6307\u5b9a\u8bca\u65ad\u6d88\u606f\u662f\u5426\u4f7f\u7528\u989c\u8272\u3002\u53ef\u9009\u503c\u4e3a <code class=\"literal\">always</code>\u3001<code class=\"literal\">auto</code>\u548c <code class=\"literal\">never</code>\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-INITDB-ENVIRONMENT-TZ\"><span class=\"term\"><code class=\"envar\">TZ</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6307\u5b9a\u6240\u521b\u5efa\u6570\u636e\u5e93\u96c6\u7c07\u7684\u9ed8\u8ba4\u65f6\u533a\u3002\u8be5\u503c\u5e94\u4e3a\u5b8c\u6574\u7684\u65f6\u533a\u540d\u79f0\uff08\u89c1<a class=\"xref\" href=\"/docs/18/datatype-datetime.html#DATATYPE-TIMEZONES\" title=\"8.5.3.\u00a0\u65f6\u533a\">\u7b2c\u00a08.5.3\u00a0\u8282</a>\uff09\u3002</p>\n</p>\n</dd>\n</dl>\n</div>\n</div>\n<div class=\"refsect1\" id=\"id-1.9.5.3.8\">\n<h2 lang=\"zh\">\u6ce8\u89e3</h2>\n<p lang=\"zh\">\u4e5f\u53ef\u4ee5\u901a\u8fc7 pg_ctl initdb \u8c03\u7528 initdb\u3002</p>\n</div>\n<div class=\"refsect1\" id=\"id-1.9.5.3.9\">\n<h2 lang=\"zh\">\u53e6\u89c1</h2><span class=\"simplelist\"><a class=\"xref\" href=\"https://pg.center/docs/18/app-pg-ctl.html\" title=\"pg_ctl\"><span class=\"refentrytitle\"><span class=\"application\">pg_ctl</span></span></a>, <a class=\"xref\" href=\"https://pg.center/docs/18/app-postgres.html\" title=\"postgres\"><span class=\"refentrytitle\"><span class=\"application\">postgres</span></span></a>, <a class=\"xref\" href=\"https://pg.center/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", "localization": {"status": "complete", "sources": [{"url": "/docs/18/app-initdb.html", "method": "same-major semantic node", "sha256": "e3f685108b64d57c6304e908cf93735cce0f65259bff183081ecb5edb31db8be", "language": "zh", "matched_nodes": ["#APP-INITDB/div[2]/p[1]", "#APP-INITDB/div[3]/h2[0]", "#APP-INITDB/div[4]/p[10]", "#APP-INITDB/div[4]/p[11]", "#APP-INITDB/div[4]/p[12]", "#APP-INITDB/div[4]/p[1]", "#APP-INITDB/div[4]/p[2]", "#APP-INITDB/div[4]/p[3]", "#APP-INITDB/div[4]/p[4]", "#APP-INITDB/div[4]/p[5]", "#APP-INITDB/div[4]/p[6]", "#APP-INITDB/div[4]/p[7]", "#APP-INITDB/div[4]/p[8]", "#APP-INITDB/div[5]/div[1]/dl[0]/dd[11]", "#APP-INITDB/div[5]/div[1]/dl[0]/dd[13]", "#APP-INITDB/div[5]/div[1]/dl[0]/dd[15]", "#APP-INITDB/div[5]/div[1]/dl[0]/dd[17]/p[0]", "#APP-INITDB/div[5]/div[1]/dl[0]/dd[17]/p[1]", "#APP-INITDB/div[5]/div[1]/dl[0]/dd[19]/p[0]", "#APP-INITDB/div[5]/div[1]/dl[0]/dd[19]/p[1]", "#APP-INITDB/div[5]/div[1]/dl[0]/dd[1]/p[0]", "#APP-INITDB/div[5]/div[1]/dl[0]/dd[1]/p[1]", "#APP-INITDB/div[5]/div[1]/dl[0]/dd[1]/p[2]", "#APP-INITDB/div[5]/div[1]/dl[0]/dd[21]", "#APP-INITDB/div[5]/div[1]/dl[0]/dd[23]", "#APP-INITDB/div[5]/div[1]/dl[0]/dd[25]", "#APP-INITDB/div[5]/div[1]/dl[0]/dd[27]", "#APP-INITDB/div[5]/div[1]/dl[0]/dd[29]", "#APP-INITDB/div[5]/div[1]/dl[0]/dd[31]", "#APP-INITDB/div[5]/div[1]/dl[0]/dd[33]", "#APP-INITDB/div[5]/div[1]/dl[0]/dd[35]", "#APP-INITDB/div[5]/div[1]/dl[0]/dd[37]", "#APP-INITDB/div[5]/div[1]/dl[0]/dd[39]", "#APP-INITDB/div[5]/div[1]/dl[0]/dd[3]", "#APP-INITDB/div[5]/div[1]/dl[0]/dd[41]/p[1]", "#APP-INITDB/div[5]/div[1]/dl[0]/dd[5]", "#APP-INITDB/div[5]/div[1]/dl[0]/dd[7]", "#APP-INITDB/div[5]/div[1]/dl[0]/dd[9]/p[0]", "#APP-INITDB/div[5]/div[3]/dl[0]/dd[11]", "#APP-INITDB/div[5]/div[3]/dl[0]/dd[13]/p[0]", "#APP-INITDB/div[5]/div[3]/dl[0]/dd[13]/p[1]", "#APP-INITDB/div[5]/div[3]/dl[0]/dd[13]/p[2]", "#APP-INITDB/div[5]/div[3]/dl[0]/dd[15]", "#APP-INITDB/div[5]/div[3]/dl[0]/dd[17]", "#APP-INITDB/div[5]/div[3]/dl[0]/dd[19]/p[0]", "#APP-INITDB/div[5]/div[3]/dl[0]/dd[19]/p[1]", "#APP-INITDB/div[5]/div[3]/dl[0]/dd[19]/p[2]", "#APP-INITDB/div[5]/div[3]/dl[0]/dd[21]", "#APP-INITDB/div[5]/div[3]/dl[0]/dd[3]", "#APP-INITDB/div[5]/div[3]/dl[0]/dd[5]", "#APP-INITDB/div[5]/div[3]/dl[0]/dd[7]", "#APP-INITDB/div[5]/div[3]/dl[0]/dd[9]", "#APP-INITDB/div[5]/div[5]/dl[0]/dd[1]", "#APP-INITDB/div[5]/div[5]/dl[0]/dd[3]", "#APP-INITDB/div[5]/p[2]", "#APP-INITDB/div[5]/p[4]", "#APP-INITDB/div[6]/div[1]/dl[0]/dd[1]", "#APP-INITDB/div[6]/div[1]/dl[0]/dd[3]", "#APP-INITDB/div[6]/div[1]/dl[0]/dd[5]", "#APP-INITDB/div[6]/h2[0]", "#APP-INITDB/div[7]/h2[0]", "#APP-INITDB/div[8]/h2[0]"]}], "language": "zh", "original_text": {"/versions/18/description/0": "initdb \u2014 create a new PostgreSQL database cluster", "/versions/18/facts/0/label": "Documented executable", "/versions/18/facts/1/label": "Executable version", "/versions/18/facts/2/label": "Reference inventory", "/versions/18/facts/2/value": "Server applications", "/versions/18/facts/3/label": "Option definition groups", "/versions/18/tables/0/title": "Documented options", "/versions/18/tables/1/title": "Environment variables", "/versions/18/tables/0/rows/0/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.", "/versions/18/tables/0/rows/1/summary": "This option specifies the authentication method for local users via TCP/IP connections used in pg_hba.conf ( host lines).", "/versions/18/tables/0/rows/2/summary": "This option specifies the authentication method for local users via Unix-domain socket connections used in pg_hba.conf ( local lines).", "/versions/18/tables/0/rows/3/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.", "/versions/18/tables/0/rows/4/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 .", "/versions/18/tables/0/rows/5/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.", "/versions/18/tables/0/rows/6/summary": "Specifies the ICU locale when the ICU provider is used. Locale support is described in Section 23.1 .", "/versions/18/tables/0/rows/7/summary": "Specifies additional collation rules to customize the behavior of the default collation. This is supported for ICU only.", "/versions/18/tables/0/rows/8/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.", "/versions/18/tables/0/rows/9/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 .", "/versions/18/tables/0/columns/0/label": "Option and arguments", "/versions/18/tables/0/columns/1/label": "Description", "/versions/18/tables/0/rows/10/summary": "Like --locale , but only sets the locale in the specified category.", "/versions/18/tables/0/rows/11/summary": "Equivalent to --locale=C .", "/versions/18/tables/0/rows/12/summary": "Specifies the locale name when the builtin provider is used. Locale support is described in Section 23.1 .", "/versions/18/tables/0/rows/13/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 ).", "/versions/18/tables/0/rows/14/summary": "Do not enable data checksums.", "/versions/18/tables/0/rows/15/summary": "Makes initdb read the bootstrap superuser's password from a file. The first line of the file is taken as the password.", "/versions/18/tables/0/rows/16/summary": "Sets the default text search configuration. See default_text_search_config for further information.", "/versions/18/tables/0/rows/17/summary": "Sets the user name of the bootstrap superuser . This defaults to the name of the operating-system user running initdb .", "/versions/18/tables/0/rows/18/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.", "/versions/18/tables/0/rows/19/summary": "This option specifies the directory where the write-ahead log should be stored.", "/versions/18/tables/0/rows/20/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.", "/versions/18/tables/0/rows/21/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.", "/versions/18/tables/0/rows/22/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.", "/versions/18/tables/0/rows/23/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.", "/versions/18/tables/0/rows/24/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.", "/versions/18/tables/0/rows/25/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.", "/versions/18/tables/0/rows/26/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.", "/versions/18/tables/0/rows/27/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.", "/versions/18/tables/0/rows/28/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.", "/versions/18/tables/0/rows/29/summary": "Show internal settings and exit, without doing anything else. This can be used to debug the initdb installation.", "/versions/18/tables/0/rows/30/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.", "/versions/18/tables/0/rows/31/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 .", "/versions/18/tables/0/rows/32/summary": "Print the initdb version and exit.", "/versions/18/tables/0/rows/33/summary": "Show help about initdb command line arguments, and exit.", "/versions/18/tables/1/columns/0/label": "Variable", "/versions/18/tables/1/columns/1/label": "Meaning", "/versions/18/tables/1/rows/0/description": "Specifies the directory where the database cluster is to be stored; can be overridden using the -D option.", "/versions/18/tables/1/rows/1/description": "Specifies whether to use color in diagnostic messages. Possible values are always , auto and never .", "/versions/18/tables/1/rows/2/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 )."}, "fallback_fields": [], "source_language": "en", "original_snapshot_sha256": "37cd7f4e3209fafd295990dfc70e740646e1fdda165a02d17b328ba73f395fb5"}, "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", "manual_language": "zh"}, "comparison": {"left": "13", "right": "14", "status": "changed", "diff": "--- PostgreSQL 13\n+++ PostgreSQL 14\n@@ -45,7 +45,7 @@\n       \"signature\": \"-D directory --pgdata= directory\"\n     },\n     {\n-      \"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 .\",\n+      \"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 .\",\n       \"names\": [\n         \"-E encoding\",\n         \"--encoding= encoding\"\n@@ -61,7 +61,7 @@\n       \"signature\": \"-g --allow-group-access\"\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.\",\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       \"names\": [\n         \"-k\",\n         \"--data-checksums\"\n@@ -69,7 +69,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 23.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 24.1 .\",\n       \"names\": [\n         \"--locale= locale\"\n       ],\n@@ -103,6 +103,13 @@\n       \"signature\": \"-N --no-sync\"\n     },\n     {\n+      \"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.\",\n+      \"names\": [\n+        \"--no-instructions\"\n+      ],\n+      \"signature\": \"--no-instructions\"\n+    },\n+    {\n       \"description\": \"Makes initdb read the database superuser's password from a file. The first line of the file is taken as the password.\",\n       \"names\": [\n         \"--pwfile= filename\"\n@@ -163,6 +170,13 @@\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.\","}}