Home Explore Blog CI



postgresql

4th chunk of `doc/src/sgml/ref/createdb.sgml`
d36e653eeeed321e877a694d0b983fc6eaa0ca0ec2dbfd020000000100000aeb
 used
        as the directory for the Unix domain socket.
       </para>
      </listitem>
     </varlistentry>

     <varlistentry>
      <term><option>-p <replaceable class="parameter">port</replaceable></option></term>
      <term><option>--port=<replaceable class="parameter">port</replaceable></option></term>
      <listitem>
       <para>
        Specifies the TCP port or the local Unix domain socket file
        extension on which the server is listening for connections.
       </para>
      </listitem>
     </varlistentry>

     <varlistentry>
      <term><option>-U <replaceable class="parameter">username</replaceable></option></term>
      <term><option>--username=<replaceable class="parameter">username</replaceable></option></term>
      <listitem>
       <para>
        User name to connect as.
       </para>
      </listitem>
     </varlistentry>

     <varlistentry>
      <term><option>-w</option></term>
      <term><option>--no-password</option></term>
      <listitem>
       <para>
        Never issue a password prompt.  If the server requires
        password authentication and a password is not available by
        other means such as a <filename>.pgpass</filename> file, the
        connection attempt will fail.  This option can be useful in
        batch jobs and scripts where no user is present to enter a
        password.
       </para>
      </listitem>
     </varlistentry>

     <varlistentry>
      <term><option>-W</option></term>
      <term><option>--password</option></term>
      <listitem>
       <para>
        Force <application>createdb</application> to prompt for a
        password before connecting to a database.
       </para>

       <para>
        This option is never essential, since
        <application>createdb</application> will automatically prompt
        for a password if the server demands password authentication.
        However, <application>createdb</application> will waste a
        connection attempt finding out that the server wants a password.
        In some cases it is worth typing <option>-W</option> to avoid the extra
        connection attempt.
       </para>
      </listitem>
     </varlistentry>

     <varlistentry>
      <term><option>--maintenance-db=<replaceable class="parameter">dbname</replaceable></option></term>
      <listitem>
       <para>
         Specifies the name of the database to connect to when creating the
         new database. If not specified, the <literal>postgres</literal>
         database will be used; if that does not exist (or if it is the name
         of the new database being created), <literal>template1</literal> will
         be used.
         This can be a <link linkend="libpq-connstring">connection
         string</link>.  If so, connection string parameters

Title: createdb Connection Parameters: Host, Port, Username, Password Prompts, and Maintenance Database
Summary
This section details the command-line options for `createdb` related to connection parameters, including specifying the host, port, and username for connecting to the PostgreSQL server. It also covers options for handling password prompts, such as disabling them or forcing a password prompt. Lastly, it explains how to specify the maintenance database to connect to when creating the new database.