1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136
|
<!-- manual page source format generated by PolyglotMan v3.0.4, -->
<!-- available via anonymous ftp from ftp.cs.berkeley.edu:/ucb/people/phelps/tcltk/rman.tar.Z -->
<HTML>
<HEAD>
<TITLE>CREATEDB(UNIX) manual page</TITLE>
</HEAD>
<BODY>
<A HREF="pgsql.html">PostgreSQL Contents</A>
<H2><A NAME="sect0" HREF="#toc0">NAME </A></H2>
createdb - create a database
<H2><A NAME="sect1" HREF="#toc1">SYNOPSIS </A></H2>
<B>createdb</B> [<B>-a</B> system] [<B>-h</B> host]
[<B>-p</B> port] [<B>-u</B>] [<B>-D</B> location] [dbname]
<H2><A NAME="sect2" HREF="#toc2">DESCRIPTION </A></H2>
<B>createdb</B> creates a new
database. The person who executes this command becomes the database administrator,
or DBA, for this database and is the only person, other than the Postgres
super-user, who can destroy it. <P>
<I>Createdb</I> is a shell script that invokes
<I>psql</I>. Hence, a <I>postmaster</I> process must be running on the database server
host before <I>createdb</I> is executed. In addition, the <FONT SIZE=-1>PGOPTION</FONT>
and <FONT SIZE=-1>PGREALM</FONT>
environment variables will be passed on to <I>psql</I> and processed as described
in <I><A HREF="psql.1.html">psql</I>(1)</A>
. <P>
The optional argument <I>dbname</I> specifies the name of the database
to be created. The name must be unique among all Postgres databases. <I>dbname</I>
defaults to the value of the <FONT SIZE=-1>USER</FONT>
environment variable. <P>
<I>createdb</I> understands
the following command-line options:
<DL>
<DT><B>-a</B> system </DT>
<DD>Specifies an authentication
system <I>system</I> (see <I><A HREF="pgintro.1.html">pgintro</I>(1)</A>
) to use in connecting to the <I>postmaster</I>
process. This option no longer has any effect. </DD>
<DT><B>-D</B> dbpath </DT>
<DD>Specifies the
alternate database location for this database. </DD>
<DT><B>-h</B> host </DT>
<DD>Specifies the hostname
of the machine on which the <I>postmaster</I> is running. Defaults to the using
local Unix domain sockets. </DD>
<DT><B>-p</B> port </DT>
<DD>Specifies the Internet TCP/IP port or
local Unix domain socket file extension on which the <I>postmaster</I> is listening
for connections. Defaults to 5432, or the value of the <FONT SIZE=-1>PGPORT</FONT>
environment
variable (if set). </DD>
<DT><B>-u</B> </DT>
<DD>Use password authentication. Prompts for username
and password. </DD>
</DL>
<H2><A NAME="sect3" HREF="#toc3">EXAMPLES </A></H2>
# create the demo database using the postmaster
on the local host, port 5432. <BR>
createdb demo <BR>
# create the demo database
using the postmaster on host eden, <BR>
# port 5000. <BR>
createdb -p 5000 -h eden
demo <BR>
<H2><A NAME="sect4" HREF="#toc4">FILES </A></H2>
<DL>
<DT>$PGDATA/base/<I>dbname </I> </DT>
<DD>The location of the files corresponding
to the database <I>dbname</I>. </DD>
</DL>
<H2><A NAME="sect5" HREF="#toc5">SEE ALSO </A></H2>
<A HREF="createdb.l.html">createdb(l)</A>
, <A HREF="destroydb.1.html">destroydb(1)</A>
, <A HREF="initdb.1.html">initdb(1)</A>
,
<A HREF="psql.1.html">psql(1)</A>
, <A HREF="postmaster.1.html">postmaster(1)</A>
.
<H2><A NAME="sect6" HREF="#toc6">DIAGNOSTICS </A></H2>
<DL>
<DT><B>Error: Failed to connect to backend
(host=</B><I>xxx</I><B>, port=</B><I>xxx</I><B>)</B> </DT>
<DD><I>Createdb</I> could not attach to the <I>postmaster</I> process
on the specified host and port. If you see this message, ensure that the
<I>postmaster</I> is running on the proper host and that you have specified the
proper port. If your site uses an authentication system, ensure that you
have obtained the required authentication credentials. </DD>
<DT><B>user `</B><I>username</I><B>' is
not in `pg_user'</B> </DT>
<DD>You do not have a valid entry in the relation `pg_user'
and cannot do anything with Postgres at all; contact your Postgres site
administrator. </DD>
<DT><B>user `</B><I>username</I><B>' is not allowed to create/destroy databases</B>
</DT>
<DD>You do not have permission to create new databases; contact your Postgres
site administrator. </DD>
<DT><I>dbname</I><B> already exists</B> </DT>
<DD>The database already exists.
</DD>
<DT><B>database creation failed on</B><I> dbname</I> </DT>
<DD>An internal error occurred in <I>psql</I>
or the backend server. Ensure that your Postgres site administrator has
properly installed Postgres and initialized the site with <I>initdb</I>. </DD>
</DL>
<P>
<HR><P>
<A NAME="toc"><B>Table of Contents</B></A><P>
<UL>
<LI><A NAME="toc0" HREF="#sect0">NAME</A></LI>
<LI><A NAME="toc1" HREF="#sect1">SYNOPSIS</A></LI>
<LI><A NAME="toc2" HREF="#sect2">DESCRIPTION</A></LI>
<LI><A NAME="toc3" HREF="#sect3">EXAMPLES</A></LI>
<LI><A NAME="toc4" HREF="#sect4">FILES</A></LI>
<LI><A NAME="toc5" HREF="#sect5">SEE ALSO</A></LI>
<LI><A NAME="toc6" HREF="#sect6">DIAGNOSTICS</A></LI>
</UL>
</BODY></HTML>
|