Home Explore Blog CI



postgresql

3rd chunk of `doc/src/sgml/ref/initdb.sgml`
de6d80d2fcfc6049c85f32e415a7bf8f380b6317bfc25ce40000000100000fa1
 overview of valid values.
       </para>

       <para>
        <command>initdb</command> will
        prepopulate <filename>pg_hba.conf</filename> entries using the
        specified authentication method for non-replication as well as
        replication connections.
       </para>

       <para>
        Do not use <literal>trust</literal> unless you trust all local users on your
        system.  <literal>trust</literal> is the default for ease of installation.
       </para>
      </listitem>
     </varlistentry>

     <varlistentry id="app-initdb-option-auth-host">
      <term><option>--auth-host=<replaceable class="parameter">authmethod</replaceable></option></term>
      <listitem>
       <para>
        This option specifies the authentication method for local users via
        TCP/IP connections used in <filename>pg_hba.conf</filename>
        (<literal>host</literal> lines).
       </para>
      </listitem>
     </varlistentry>

     <varlistentry id="app-initdb-option-auth-local">
      <term><option>--auth-local=<replaceable class="parameter">authmethod</replaceable></option></term>
      <listitem>
       <para>
        This option specifies the authentication method for local users via
        Unix-domain socket connections used in <filename>pg_hba.conf</filename>
        (<literal>local</literal> lines).
       </para>
      </listitem>
     </varlistentry>

     <varlistentry id="app-initdb-option-pgdata">
      <term><option>-D <replaceable class="parameter">directory</replaceable></option></term>
      <term><option>--pgdata=<replaceable class="parameter">directory</replaceable></option></term>
      <listitem>
       <para>
        This option specifies the directory where the database cluster
        should be stored. This is the only information required by
        <command>initdb</command>, but you can avoid writing it by
        setting the <envar>PGDATA</envar> environment variable, which
        can be convenient since the database server
        (<command>postgres</command>) can find the data
        directory later by the same variable.
       </para>
      </listitem>
     </varlistentry>

     <varlistentry id="app-initdb-option-encoding">
      <term><option>-E <replaceable class="parameter">encoding</replaceable></option></term>
      <term><option>--encoding=<replaceable class="parameter">encoding</replaceable></option></term>
      <listitem>
       <para>
        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
        <productname>PostgreSQL</productname> server are described in <xref
        linkend="multibyte-charset-supported"/>.
       </para>
       <para>
        By default, the template database encoding is derived from the
        locale. If <xref linkend="app-initdb-option-no-locale"/> is specified
        (or equivalently, if the locale is <literal>C</literal> or
        <literal>POSIX</literal>), then the default is <literal>UTF8</literal>
        for the ICU provider and <literal>SQL_ASCII</literal> for the
        <literal>libc</literal> provider.
       </para>
      </listitem>
     </varlistentry>

     <varlistentry id="app-initdb-allow-group-access">
      <term><option>-g</option></term>
      <term><option>--allow-group-access</option></term>
      <listitem>
       <para>
        Allows users in the same group as the cluster owner to read all cluster
        files created by <command>initdb</command>.  This option is ignored
        on <productname>Windows</productname> as it does not support
        <acronym>POSIX</acronym>-style group permissions.
       </para>
      </listitem>
     </varlistentry>

     <varlistentry id="app-initdb-icu-locale">
      <term><option>--icu-locale=<replaceable>locale</replaceable></option></term>
      <listitem>
       <para>
        Specifies the ICU locale when the ICU provider is used.

Title: initdb Options: Authentication, Data Directory, Encoding, and Group Access
Summary
This section describes various options for the `initdb` command, including `--auth-host` and `--auth-local` for specifying authentication methods for TCP/IP and Unix-domain socket connections respectively. The `-D` or `--pgdata` option sets the directory for storing the database cluster, while `-E` or `--encoding` selects the encoding for the template databases. The `-g` or `--allow-group-access` option allows users in the same group as the cluster owner to read cluster files.