.\\" auto-generated by docbook2man-spec $Revision: 1.25 $ .TH "CREATEDB" "1" "2003-11-02" "Application" "PostgreSQL Client Applications" .SH NAME createdb \- create a new PostgreSQL database .SH SYNOPSIS .sp \fBcreatedb\fR\fR [ \fR\fB\fIoption\fB\fR...\fB \fR\fR]\fR\fR [ \fR\fB\fIdbname\fB \fR\fR]\fR\fR [ \fR\fB\fIdescription\fB \fR\fR]\fR .SH "DESCRIPTION" .PP \fBcreatedb\fR creates a new PostgreSQL database. .PP Normally, the database user who executes this command becomes the owner of the new database. However a different owner can be specified via the \fB-O\fR option, if the executing user has appropriate privileges. .PP \fBcreatedb\fR is a wrapper around the SQL command CREATE DATABASE [\fBcreate_database\fR(7)]. There is no effective difference between creating databases via this utility and via other methods for accessing the server. .SH "OPTIONS" .PP \fBcreatedb\fR accepts the following command-line arguments: .TP \fB\fIdbname\fB\fR Specifies the name of the database to be created. The name must be unique among all PostgreSQL databases in this cluster. The default is to create a database with the same name as the current system user. .TP \fB\fIdescription\fB\fR This optionally specifies a comment to be associated with the newly created database. .TP \fB-D \fIlocation\fB\fR .TP \fB--location \fIlocation\fB\fR Specifies the alternative location for the database. See also \fBinitlocation\fR(1). .TP \fB-e\fR .TP \fB--echo\fR Echo the commands that \fBcreatedb\fR generates and sends to the server. .TP \fB-E \fIencoding\fB\fR .TP \fB--encoding \fIencoding\fB\fR Specifies the character encoding scheme to be used in this database. .TP \fB-O \fIowner\fB\fR .TP \fB--owner \fIowner\fB\fR Specifies the database user who will own the new database. .TP \fB-q\fR .TP \fB--quiet\fR Do not display a response. .TP \fB-T \fItemplate\fB\fR .TP \fB--template \fItemplate\fB\fR Specifies the template database from which to build this database. .PP .PP The options \fB-D\fR, \fB-E\fR, \fB-O\fR, and \fB-T\fR correspond to options of the underlying SQL command CREATE DATABASE [\fBcreate_database\fR(7)]; see there for more information about them. .PP \fBcreatedb\fR also accepts the following command-line arguments for connection parameters: .TP \fB-h \fIhost\fB\fR .TP \fB--host \fIhost\fB\fR Specifies the host name of the machine on which the server is running. If the value begins with a slash, it is used as the directory for the Unix domain socket. .TP \fB-p \fIport\fB\fR .TP \fB--port \fIport\fB\fR Specifies the TCP port or the local Unix domain socket file extension on which the server is listening for connections. .TP \fB-U \fIusername\fB\fR .TP \fB--username \fIusername\fB\fR User name to connect as .TP \fB-W\fR .TP \fB--password\fR Force password prompt. .PP .SH "ENVIRONMENT" .TP \fBPGDATABASE\fR If set, the name of the database to create, unless overridden on the command line. .TP \fBPGHOST\fR .TP \fBPGPORT\fR .TP \fBPGUSER\fR Default connection parameters. \fBPGUSER\fR also determines the name of the database to create, if it is not specified on the command line or by \fBPGDATABASE\fR. .SH "DIAGNOSTICS" .PP In case of difficulty, see CREATE DATABASE [\fBcreate_database\fR(7)] and \fBpsql\fR(1) for discussions of potential problems and error messages. The database server must be running at the targeted host. Also, any default connection settings and environment variables used by the \fBlibpq\fR front-end library will apply. .SH "EXAMPLES" .PP To create the database demo using the default database server: .sp .nf $ \fBcreatedb demo\fR CREATE DATABASE .sp .fi The response is the same as you would have gotten from running the \fBCREATE DATABASE\fR SQL command. .PP To create the database demo using the server on host eden, port 5000, using the LATIN1 encoding scheme with a look at the underlying command: .sp .nf $ \fBcreatedb -p 5000 -h eden -E LATIN1 -e demo\fR CREATE DATABASE "demo" WITH ENCODING = 'LATIN1' CREATE DATABASE .sp .fi .SH "SEE ALSO" \fBdropdb\fR(1), CREATE DATABASE [\fBcreate_database\fR(7)]