1999-07-22 17:09:15 +02:00
|
|
|
<!--
|
1999-12-17 02:05:31 +01:00
|
|
|
$Header: /cvsroot/pgsql/doc/src/sgml/ref/initdb.sgml,v 1.6 1999/12/17 01:05:29 momjian Exp $
|
1999-07-22 17:09:15 +02:00
|
|
|
Postgres documentation
|
|
|
|
-->
|
|
|
|
|
1999-07-06 19:16:42 +02:00
|
|
|
<refentry id="APP-INITDB">
|
|
|
|
<refmeta>
|
1999-07-22 17:09:15 +02:00
|
|
|
<refentrytitle id="APP-INITDB-TITLE">
|
1999-07-06 19:16:42 +02:00
|
|
|
<application>initdb</application>
|
|
|
|
</refentrytitle>
|
|
|
|
<refmiscinfo>Application</refmiscinfo>
|
|
|
|
</refmeta>
|
|
|
|
<refnamediv>
|
|
|
|
<refname>
|
|
|
|
<application>initdb</application>
|
|
|
|
</refname>
|
|
|
|
<refpurpose>
|
1999-12-17 02:05:31 +01:00
|
|
|
Create a new <productname>PostgreSQL</productname> database installation
|
1999-07-06 19:16:42 +02:00
|
|
|
</refpurpose>
|
|
|
|
</refnamediv>
|
|
|
|
<refsynopsisdiv>
|
|
|
|
<refsynopsisdivinfo>
|
1999-12-17 02:05:31 +01:00
|
|
|
<date>1999-12-17</date>
|
1999-07-06 19:16:42 +02:00
|
|
|
</refsynopsisdivinfo>
|
|
|
|
<synopsis>
|
1999-12-17 02:05:31 +01:00
|
|
|
initdb [ --pgdata|-D <replaceable class="parameter">dbdir</replaceable> ]
|
|
|
|
[ --sysid|-i <replaceable class="parameter">sysid</replaceable> ]
|
|
|
|
[ --password|-W <replaceable class="parameter">password</replaceable> ]
|
|
|
|
[ --pgencoding|-e <replaceable class="parameter">encoding</replaceable> ]
|
|
|
|
[ --pglib|-L <replaceable class="parameter">libdir</replaceable> ]
|
|
|
|
[ --username|-u <replaceable class="parameter">name</replaceable> ]
|
|
|
|
[ --noclean | -n ] [ --debug | -d ] [ --template | -t ]
|
1999-07-06 19:16:42 +02:00
|
|
|
</synopsis>
|
1998-10-05 04:54:45 +02:00
|
|
|
|
1999-07-06 19:16:42 +02:00
|
|
|
<refsect2 id="R2-APP-INITDB-1">
|
|
|
|
<refsect2info>
|
1999-12-17 02:05:31 +01:00
|
|
|
<date>1999-11-17</date>
|
1999-07-06 19:16:42 +02:00
|
|
|
</refsect2info>
|
|
|
|
<title>
|
|
|
|
Inputs
|
|
|
|
</title>
|
|
|
|
<para>
|
1998-10-05 04:54:45 +02:00
|
|
|
|
1999-07-06 19:16:42 +02:00
|
|
|
<variablelist>
|
|
|
|
<varlistentry>
|
1999-12-17 02:05:31 +01:00
|
|
|
<term>--pgdata=<replaceable class="parameter">dbdir</replaceable></term>
|
|
|
|
<term>-D <replaceable class="parameter">dbdir</replaceable></term>
|
|
|
|
<term><envar>PGDATA</envar></term>
|
1999-07-06 19:16:42 +02:00
|
|
|
<listitem>
|
|
|
|
<para>
|
1999-12-17 02:05:31 +01:00
|
|
|
This option specifies where in the file system the database should be
|
|
|
|
stored. This is the only information required by initdb, but you can avoid
|
|
|
|
it by setting the <envar>PGDATA</envar> environment variable, which
|
|
|
|
can be convenient since the database server (<filename>postmaster</filename>)
|
|
|
|
can find the database directory later by the same variable.
|
1999-07-06 19:16:42 +02:00
|
|
|
</para>
|
|
|
|
</listitem>
|
|
|
|
</varlistentry>
|
1998-10-05 04:54:45 +02:00
|
|
|
|
1999-07-06 19:16:42 +02:00
|
|
|
<varlistentry>
|
1999-12-17 02:05:31 +01:00
|
|
|
<term>--sysid=<replaceable class="parameter">sysid</replaceable></term>
|
|
|
|
<term>-i <replaceable class="parameter">sysid</replaceable></term>
|
1999-07-06 19:16:42 +02:00
|
|
|
<listitem>
|
|
|
|
<para>
|
1999-12-17 02:05:31 +01:00
|
|
|
Selects the system id of the database superuser. This defaults to
|
|
|
|
the effective user id of the user running initdb. It is really
|
|
|
|
not important what the superuser's sysid is, but one might choose
|
|
|
|
to start the numbering at some number like 0 or 1.
|
1999-07-06 19:16:42 +02:00
|
|
|
</para>
|
|
|
|
</listitem>
|
|
|
|
</varlistentry>
|
1999-12-17 02:05:31 +01:00
|
|
|
|
1999-07-06 19:16:42 +02:00
|
|
|
<varlistentry>
|
1999-12-17 02:05:31 +01:00
|
|
|
<term>--password=<replaceable class="parameter">password</replaceable></term>
|
|
|
|
<term>-W <replaceable class="parameter">password</replaceable></term>
|
1999-07-06 19:16:42 +02:00
|
|
|
<listitem>
|
|
|
|
<para>
|
1999-12-17 02:05:31 +01:00
|
|
|
Sets the password of the database superuser. If you don't plan
|
|
|
|
on using password authentication, this is not important. If you
|
|
|
|
do, you can save yourself a trip by specifying it here, but you
|
|
|
|
can always change it later. The default password is empty.
|
1999-07-06 19:16:42 +02:00
|
|
|
</para>
|
|
|
|
</listitem>
|
|
|
|
</varlistentry>
|
1999-12-17 02:05:31 +01:00
|
|
|
|
|
|
|
<varlistentry>
|
|
|
|
<term>--pgencoding=<replaceable class="parameter">encoding</replaceable></term>
|
|
|
|
<term>-e <replaceable class="parameter">encoding</replaceable></term>
|
|
|
|
<listitem>
|
|
|
|
<para>
|
|
|
|
Selects the multibyte encoding of the template database. This will also
|
|
|
|
be the default encoding of any database you create later, unless you
|
|
|
|
override it there. To use the multibyte encoding feature, you must
|
|
|
|
specify so at build time, at which time you also select the default
|
|
|
|
for this option.
|
|
|
|
</para>
|
|
|
|
</listitem>
|
|
|
|
</varlistentry>
|
|
|
|
|
|
|
|
</variablelist>
|
1999-07-06 19:16:42 +02:00
|
|
|
</para>
|
|
|
|
|
|
|
|
<para>
|
|
|
|
Other, less commonly used, parameters are also available:
|
|
|
|
|
|
|
|
<variablelist>
|
|
|
|
<varlistentry>
|
1999-12-17 02:05:31 +01:00
|
|
|
<term>--pglib=<replaceable class="parameter">libdir</replaceable></term>
|
|
|
|
<term>-l <replaceable class="parameter">libdir</replaceable></term>
|
|
|
|
<listitem>
|
|
|
|
<para>
|
|
|
|
initdb needs a few input files to initialize the database. This option
|
|
|
|
tells where to find them. You normally don't have to worry about this
|
|
|
|
since initdb knows about the most common installation layouts and will
|
|
|
|
find the files itself. You will be told if you need to specify their
|
|
|
|
location explicitly. If that happens, one of the files is called
|
|
|
|
<filename>global1.bki.source</filename> and is traditionally installed
|
|
|
|
along with the others in the library directory (e.g.,
|
|
|
|
<filename>/usr/local/pgsql/lib</filename>).
|
|
|
|
</para>
|
|
|
|
</listitem>
|
|
|
|
</varlistentry>
|
|
|
|
|
|
|
|
<varlistentry>
|
|
|
|
<term>--username=<replaceable class="parameter">name</replaceable></term>
|
|
|
|
<term>-u <replaceable class="parameter">name</replaceable></term>
|
|
|
|
<listitem>
|
|
|
|
<para>
|
|
|
|
The database system will be initialized with the username that is
|
|
|
|
running initdb. That is a requirement. If for some unimaginable
|
|
|
|
reason initdb cannot find out what the current user's name is,
|
|
|
|
you have to use this option. Normally, this will not be necessary
|
|
|
|
and initdb will tell you when it is.
|
|
|
|
</para>
|
|
|
|
</listitem>
|
|
|
|
</varlistentry>
|
|
|
|
|
|
|
|
<varlistentry>
|
|
|
|
<term>--template</term>
|
|
|
|
<term>-t</term>
|
1999-07-06 19:16:42 +02:00
|
|
|
<listitem>
|
|
|
|
<para>
|
|
|
|
Replace the <literal>template1</literal>
|
|
|
|
database in an existing database system, and don't touch anything else.
|
|
|
|
This is useful when you need to upgrade your <literal>template1</literal>
|
|
|
|
database using <application>initdb</application>
|
1999-12-17 02:05:31 +01:00
|
|
|
from a newer release of <productname>PostgreSQL</productname>,
|
1999-07-06 19:16:42 +02:00
|
|
|
or when your <literal>template1</literal>
|
|
|
|
database has become corrupted by some system problem. Normally the
|
|
|
|
contents of <literal>template1</literal>
|
|
|
|
remain constant throughout the life of the database system. You can't
|
|
|
|
destroy anything by running <application>initdb</application>
|
|
|
|
with the
|
|
|
|
<option>--template</option>
|
|
|
|
option.
|
|
|
|
</para>
|
|
|
|
</listitem>
|
|
|
|
</varlistentry>
|
|
|
|
|
|
|
|
<varlistentry>
|
|
|
|
<term>--noclean</term>
|
|
|
|
<term>-n</term>
|
|
|
|
<listitem>
|
|
|
|
<para>
|
|
|
|
By default, when <application>initdb</application>
|
|
|
|
determines that error prevent it from completely creating the database
|
|
|
|
system, it removes any files it may have created before determining
|
1999-12-17 02:05:31 +01:00
|
|
|
that it can't finish the job. This option inhibits any tidying-up and is
|
1999-07-06 19:16:42 +02:00
|
|
|
thus useful for debugging.
|
|
|
|
</para>
|
|
|
|
</listitem>
|
|
|
|
</varlistentry>
|
|
|
|
|
|
|
|
<varlistentry>
|
|
|
|
<term>--debug</term>
|
|
|
|
<term>-d</term>
|
|
|
|
<listitem>
|
|
|
|
<para>
|
1999-12-17 02:05:31 +01:00
|
|
|
Print debugging output from the bootstrap backend and a few other
|
|
|
|
messages of lesser interest for the general public.
|
1999-07-06 19:16:42 +02:00
|
|
|
The bootstrap backend is the program <application>initdb</application>
|
|
|
|
uses to create the catalog tables. This option generates a tremendous
|
1999-12-17 02:05:31 +01:00
|
|
|
amount of output.
|
1999-07-06 19:16:42 +02:00
|
|
|
</para>
|
|
|
|
</listitem>
|
|
|
|
</varlistentry>
|
|
|
|
|
|
|
|
</variablelist>
|
|
|
|
</para>
|
|
|
|
|
|
|
|
</refsect2>
|
|
|
|
|
|
|
|
<refsect2 id="R2-APP-INITDB-2">
|
|
|
|
<refsect2info>
|
1999-12-17 02:05:31 +01:00
|
|
|
<date>1999-12-17</date>
|
1999-07-06 19:16:42 +02:00
|
|
|
</refsect2info>
|
|
|
|
<title>
|
|
|
|
Outputs
|
|
|
|
</title>
|
|
|
|
<para>
|
1999-12-17 02:05:31 +01:00
|
|
|
<application>initdb</application> will create files in the specified
|
1999-07-06 19:16:42 +02:00
|
|
|
data area which are the system tables and framework for a complete
|
|
|
|
installation.
|
|
|
|
</para>
|
|
|
|
</refsect2>
|
|
|
|
</refsynopsisdiv>
|
|
|
|
|
|
|
|
<refsect1 id="R1-APP-INITDB-1">
|
|
|
|
<refsect1info>
|
1999-12-17 02:05:31 +01:00
|
|
|
<date>1999-12-17</date>
|
1999-07-06 19:16:42 +02:00
|
|
|
</refsect1info>
|
|
|
|
<title>
|
|
|
|
Description
|
|
|
|
</title>
|
|
|
|
<para>
|
|
|
|
<application>initdb</application> creates a new
|
1999-12-17 02:05:31 +01:00
|
|
|
<productname>PostgreSQL</productname> database system.
|
1999-07-06 19:16:42 +02:00
|
|
|
A database system is a
|
|
|
|
collection of databases that are all administered by the same Unix user
|
|
|
|
and managed by a single postmaster.
|
|
|
|
</para>
|
|
|
|
<para>
|
|
|
|
Creating a database system consists of creating the directories in which
|
|
|
|
the database data will live, generating the shared catalog tables
|
|
|
|
(tables that don't belong to any particular database), and
|
|
|
|
creating the <literal>template1</literal>
|
1999-12-17 02:05:31 +01:00
|
|
|
database. When you create a new database, everything in the
|
|
|
|
<literal>template1</literal> database is copied.
|
|
|
|
It contains catalog tables filled in for things like the
|
1999-07-06 19:16:42 +02:00
|
|
|
builtin types.
|
|
|
|
</para>
|
|
|
|
|
1999-12-17 02:05:31 +01:00
|
|
|
<para>
|
|
|
|
You must not execute <application>initdb</application> as root. This is
|
|
|
|
because you cannot run the database server as root either, but the
|
|
|
|
server needs to have access to the files <application>initdb</application>
|
|
|
|
creates. Furthermore, during the initialization phase, when there are no
|
|
|
|
users and no access controls installed, postgres will only connect with
|
|
|
|
the name of the current Unix user, so you must log in under the account
|
|
|
|
that will own the server process.
|
1999-07-06 19:16:42 +02:00
|
|
|
</para>
|
|
|
|
|
|
|
|
<para>
|
1999-12-17 02:05:31 +01:00
|
|
|
Although <application>initdb</application> will attempt to create the respective
|
|
|
|
data directory, chances are that it won't have the permission to do so. Thus
|
|
|
|
it is a good idea to create the data directory before running <application>initdb</application>
|
|
|
|
<emphasis>and</emphasis> to hand over the ownership of it to the database superuser.
|
1999-07-06 19:16:42 +02:00
|
|
|
</para>
|
|
|
|
|
|
|
|
<para>
|
1999-12-17 02:05:31 +01:00
|
|
|
Note that if you use the <option>--username</option> you must give correct
|
|
|
|
information about the name of the <emphasis>current</emphasis> user. If you don't
|
|
|
|
this will usually manifest itself in an error message about <literal>chmod</literal>
|
|
|
|
failing on a file <filename>pg_pwd</filename>, because the backend silently
|
|
|
|
refuses to create it.
|
1999-07-06 19:16:42 +02:00
|
|
|
</para>
|
1999-12-17 02:05:31 +01:00
|
|
|
|
1999-07-06 19:16:42 +02:00
|
|
|
</refsect1>
|
|
|
|
</refentry>
|
|
|
|
|
|
|
|
<!-- Keep this comment at the end of the file
|
|
|
|
Local variables:
|
|
|
|
mode: sgml
|
|
|
|
sgml-omittag:nil
|
|
|
|
sgml-shorttag:t
|
|
|
|
sgml-minimize-attributes:nil
|
|
|
|
sgml-always-quote-attributes:t
|
|
|
|
sgml-indent-step:1
|
|
|
|
sgml-indent-data:t
|
|
|
|
sgml-parent-document:nil
|
|
|
|
sgml-default-dtd-file:"../reference.ced"
|
|
|
|
sgml-exposed-tags:nil
|
|
|
|
sgml-local-catalogs:"/usr/lib/sgml/catalog"
|
|
|
|
sgml-local-ecat-files:nil
|
|
|
|
End:
|
|
|
|
-->
|