initdb.1

来自「PostgreSQL 8.2中增加了很多企业用户所需要的功能和性能上的提高,其开」· 1 代码 · 共 174 行

1
174
字号
.\\" auto-generated by docbook2man-spec $Revision: 1.1.1.1 $.TH "INITDB" "1" "2008-01-03" "Application" "PostgreSQL Server Applications".SH NAMEinitdb \- create a new PostgreSQL database cluster.SH SYNOPSIS.sp\fBinitdb\fR [ \fB\fIoption\fB\fR\fI...\fR ]  \fB [ --pgdata  ]  [ -D  ] \fIdirectory\fB\fR.SH "DESCRIPTION".PP\fBinitdb\fR creates a newPostgreSQL database cluster. A databasecluster is a collection of databases that are managed by a singleserver instance..PPCreating a database cluster consists of creating the directories inwhich the database data will live, generating the shared catalogtables (tables that belong to the whole cluster rather than to anyparticular database), and creating the template1and postgres databases. When you later create a new database, everything in the template1 database is copied. (Therefore, anything installed in template1is automatically copied into each database created later.)The postgres database is a default database meantfor use by users, utilities and third party applications..PPAlthough \fBinitdb\fR will attempt to create thespecified data directory, it might not have permission if the parentdirectory of the desired data directory is root-owned. To initializein such a setup, create an empty data directory as root, then use\fBchown\fR to assign ownership of that directory to thedatabase user account, then \fBsu\fR to become thedatabase user to run \fBinitdb\fR..PP\fBinitdb\fR must be run as the user that will own theserver process, because the server needs to have access to thefiles and directories that \fBinitdb\fR creates.Since the server may not be run as root, you must not run\fBinitdb\fR as root either. (It will in fact refuseto do so.).PP\fBinitdb\fR initializes the database cluster's defaultlocale and character set encoding. The collation order(LC_COLLATE) and character set classes(LC_CTYPE, e.g. upper, lower, digit) are fixed for alldatabases and can not be changed. Collation orders other thanC or POSIX also have a performance penalty.For these reasons it is important to choose the right locale whenrunning \fBinitdb\fR. The remaining locale categoriescan be changed later when the server is started. All server localevalues (lc_*) can be displayed via \fBSHOW ALL\fR.More details can be found in in the documentation..PPThe character set encoding can be set separately for a database whenit is created. \fBinitdb\fR determines the encoding forthe template1 database, which will serve as thedefault for all other databases. To alter the default encoding usethe \fB--encoding\fR option. More details can be found inin the documentation..SH "OPTIONS".PP.TP\fB-A \fIauthmethod\fB\fR.TP\fB--auth=\fIauthmethod\fB\fRThis option specifies the authentication method for local usersused in \fIpg_hba.conf\fR. Do not use trustunless you trust all local users on your system. Trust is the default for ease of installation..TP\fB-D \fIdirectory\fB\fR.TP\fB--pgdata=\fIdirectory\fB\fRThis option specifies the directory where the database clustershould be stored. This is the only information required by\fBinitdb\fR, but you can avoid writing it bysetting the \fBPGDATA\fR environment variable, whichcan be convenient since the database server(\fBpostgres\fR) can find the databasedirectory later by the same variable..TP\fB-E \fIencoding\fB\fR.TP\fB--encoding=\fIencoding\fB\fRSelects the encoding of the template database. This will alsobe the default encoding of any database you create later,unless you override it there. The default is derived from the locale, orSQL_ASCII if that does not work. The character sets supported bythe PostgreSQL server are describedin in the documentation..TP\fB--locale=\fIlocale\fB\fRSets the default locale for the database cluster. If thisoption is not specified, the locale is inherited from theenvironment that \fBinitdb\fR runs in. Localesupport is described in in the documentation..TP\fB--lc-collate=\fIlocale\fB\fR.TP\fB--lc-ctype=\fIlocale\fB\fR.TP\fB--lc-messages=\fIlocale\fB\fR.TP\fB--lc-monetary=\fIlocale\fB\fR.TP\fB--lc-numeric=\fIlocale\fB\fR.TP\fB--lc-time=\fIlocale\fB\fRLike \fB--locale\fR, but only sets the locale inthe specified category..TP\fB-U \fIusername\fB\fR.TP\fB--username=\fIusername\fB\fRSelects the user name of the database superuser. This defaultsto the name of the effective user running\fBinitdb\fR. It is really not important what thesuperuser's name is, but one might choose to keep thecustomary name \fBpostgres\fR, even if the operatingsystem user's name is different..TP\fB-W\fR.TP\fB--pwprompt\fRMakes \fBinitdb\fR prompt for a passwordto give the database superuser. If you don't plan on using passwordauthentication, this is not important. Otherwise you won't beable to use password authentication until you have a passwordset up..TP\fB--pwfile=\fIfilename\fB\fRMakes \fBinitdb\fR read the database superuser's passwordfrom a file. The first line of the file is taken as the password..PP.PPOther, less commonly used, parameters are also available:.TP\fB-d\fR.TP\fB--debug\fRPrint debugging output from the bootstrap backend and a few othermessages of lesser interest for the general public.The bootstrap backend is the program \fBinitdb\fRuses to create the catalog tables. This option generates a tremendousamount of extremely boring output..TP\fB-L \fIdirectory\fB\fRSpecifies where \fBinitdb\fR should findits input files to initialize the database cluster. This isnormally not necessary. You will be told if you need tospecify their location explicitly..TP\fB-n\fR.TP\fB--noclean\fRBy default, when \fBinitdb\fRdetermines that an error prevented it from completely creating the databasecluster, it removes any files it may have created before discoveringthat it can't finish the job. This option inhibits tidying-up and isthus useful for debugging..PP.SH "ENVIRONMENT".TP\fBPGDATA\fRSpecifies the directory where the database cluster is to bestored; may be overridden using the \fB-D\fR option..PPThis utility, like most other PostgreSQL utilities,also uses the environment variables supported by \fBlibpq\fR(see in the documentation)..PP.SH "SEE ALSO"\fBpostgres\fR(1)

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?