version 1 showing authors affecting page license.
.
Rev |
Author |
# |
Line |
1 |
perry |
1 |
INITDB |
|
|
2 |
!!!INITDB |
|
|
3 |
NAME |
|
|
4 |
SYNOPSIS |
|
|
5 |
DESCRIPTION |
|
|
6 |
ENVIRONMENT |
|
|
7 |
SEE ALSO |
|
|
8 |
---- |
|
|
9 |
!!NAME |
|
|
10 |
|
|
|
11 |
|
|
|
12 |
initdb - create a new PostgreSQL database cluster |
|
|
13 |
!!SYNOPSIS |
|
|
14 |
|
|
|
15 |
|
|
|
16 |
__initdb --pgdata__ | __-D__ ''directory'' [[ |
|
|
17 |
__--username__ | __-U__ ''username'' ] [[ |
|
|
18 |
__--pwprompt__ | __-W__ ] [[ __--encoding__ | |
|
|
19 |
__-E__ ''encoding'' ] [[ __-L__ ''directory'' ] [[ |
|
|
20 |
__--noclean__ | __-n__ ] [[ __--debug__ | __-d__ |
|
|
21 |
] |
|
|
22 |
!!DESCRIPTION |
|
|
23 |
|
|
|
24 |
|
|
|
25 |
__initdb__ creates a new PostgreSQL database cluster (or |
|
|
26 |
database system). A database cluster is a collection of |
|
|
27 |
databases that are managed by a single server |
|
|
28 |
instance. |
|
|
29 |
|
|
|
30 |
|
|
|
31 |
Creating a database system consists of creating the |
|
|
32 |
directories in which the database data will live, generating |
|
|
33 |
the shared catalog tables (tables that belong to the whole |
|
|
34 |
cluster rather than to any particular database), and |
|
|
35 |
creating the template1 database. When you create a new |
|
|
36 |
database, everything in the template1 database is copied. It |
|
|
37 |
contains catalog tables filled in for things like the |
|
|
38 |
built-in types. |
|
|
39 |
|
|
|
40 |
|
|
|
41 |
__initdb__ must be run as the user that will own the |
|
|
42 |
server process, because the server needs to have access to |
|
|
43 |
the files and directories that __initdb__ creates. Since |
|
|
44 |
the server may not be run as root, you must not run |
|
|
45 |
__initdb__ as root either. (It will in fact refuse to do |
|
|
46 |
so.) |
|
|
47 |
|
|
|
48 |
|
|
|
49 |
Although __initdb__ will attempt to create the specified |
|
|
50 |
data directory, often it won't have permission to do so, |
|
|
51 |
since the parent of the desired data directory is often a |
|
|
52 |
root-owned directory. To set up an arrangement like this, |
|
|
53 |
create an empty data directory as root, then use |
|
|
54 |
__chown__ to hand over ownership of that directory to the |
|
|
55 |
database user account, then __su__ to become the database |
|
|
56 |
user, and finally run __initdb__ as the database |
|
|
57 |
user. |
|
|
58 |
|
|
|
59 |
|
|
|
60 |
__OPTIONS__ |
|
|
61 |
|
|
|
62 |
|
|
|
63 |
__--pgdata=__''directory'' |
|
|
64 |
|
|
|
65 |
|
|
|
66 |
__-D__ ''directory'' |
|
|
67 |
|
|
|
68 |
|
|
|
69 |
This option specifies the directory where the database |
|
|
70 |
system should be stored. This is the only information |
|
|
71 |
required by __initdb__, but you can avoid writing it by |
|
|
72 |
setting the __PGDATA__ environment variable, which can be |
|
|
73 |
convenient since the database server (__postmaster__) can |
|
|
74 |
find the database directory later by the same |
|
|
75 |
variable. |
|
|
76 |
|
|
|
77 |
|
|
|
78 |
__--username=__''username'' |
|
|
79 |
|
|
|
80 |
|
|
|
81 |
__-U__ ''username'' |
|
|
82 |
|
|
|
83 |
|
|
|
84 |
Selects the user name of the database superuser. This |
|
|
85 |
defaults to the name of the effective user running |
|
|
86 |
__initdb__. It is really not important what the |
|
|
87 |
superuser's name is, but one might choose to keep the |
|
|
88 |
customary name ``postgres'', even if the operating system |
|
|
89 |
user's name is different. |
|
|
90 |
|
|
|
91 |
|
|
|
92 |
__--pwprompt__ |
|
|
93 |
|
|
|
94 |
|
|
|
95 |
__-W__ |
|
|
96 |
|
|
|
97 |
|
|
|
98 |
Makes __initdb__ prompt for a password to give the |
|
|
99 |
database superuser. If you don't plan on using password |
|
|
100 |
authentication, this is not important. Otherwise you won't |
|
|
101 |
be able to use password authentication until you have a |
|
|
102 |
password set up. |
|
|
103 |
|
|
|
104 |
|
|
|
105 |
__--encoding=__''encoding'' |
|
|
106 |
|
|
|
107 |
|
|
|
108 |
__-E__ ''encoding'' |
|
|
109 |
|
|
|
110 |
|
|
|
111 |
Selects the encoding of the template database. This will |
|
|
112 |
also be the default encoding of any database you create |
|
|
113 |
later, unless you override it there. To use the encoding |
|
|
114 |
feature, you must have enabled it at build time, at which |
|
|
115 |
time you also select the default for this |
|
|
116 |
option. |
|
|
117 |
|
|
|
118 |
|
|
|
119 |
Other, less commonly used, parameters are also |
|
|
120 |
available: |
|
|
121 |
|
|
|
122 |
|
|
|
123 |
__-L__ ''directory'' |
|
|
124 |
|
|
|
125 |
|
|
|
126 |
Specifies where __initdb__ should find its input files to |
|
|
127 |
initialize the database system. This is normally not |
|
|
128 |
necessary. You will be told if you need to specify their |
|
|
129 |
location explicitly. |
|
|
130 |
|
|
|
131 |
|
|
|
132 |
__--noclean__ |
|
|
133 |
|
|
|
134 |
|
|
|
135 |
__-n__ |
|
|
136 |
|
|
|
137 |
|
|
|
138 |
By default, when __initdb__ determines that an error |
|
|
139 |
prevented it from completely creating the database system, |
|
|
140 |
it removes any files it may have created before discovering |
|
|
141 |
that it can't finish the job. This option inhibits |
|
|
142 |
tidying-up and is thus useful for debugging. |
|
|
143 |
|
|
|
144 |
|
|
|
145 |
__--debug__ |
|
|
146 |
|
|
|
147 |
|
|
|
148 |
__-d__ |
|
|
149 |
|
|
|
150 |
|
|
|
151 |
Print debugging output from the bootstrap backend and a few |
|
|
152 |
other messages of lesser interest for the general public. |
|
|
153 |
The bootstrap backend is the program __initdb__ uses to |
|
|
154 |
create the catalog tables. This option generates a |
|
|
155 |
tremendous amount of extremely boring output. |
|
|
156 |
!!ENVIRONMENT |
|
|
157 |
|
|
|
158 |
|
|
|
159 |
__PGDATA__ |
|
|
160 |
|
|
|
161 |
|
|
|
162 |
Specifies the directory where the database system is to be |
|
|
163 |
stored; may be overridden using the __-D__ |
|
|
164 |
option. |
|
|
165 |
!!SEE ALSO |
|
|
166 |
|
|
|
167 |
|
|
|
168 |
postgres(1), postmaster(1), ''PostgreSQL |
|
|
169 |
Administrator's Guide'' |
|
|
170 |
---- |