3 PostgreSQL documentation
6 <refentry id=
"APP-DROPDB">
8 <refentrytitle id=
"APP-DROPDB-TITLE"><application>dropdb
</application></refentrytitle>
9 <manvolnum>1</manvolnum>
10 <refmiscinfo>Application
</refmiscinfo>
14 <refname>dropdb
</refname>
15 <refpurpose>remove a
<productname>PostgreSQL
</productname> database
</refpurpose>
18 <indexterm zone=
"app-dropdb">
19 <primary>dropdb
</primary>
24 <command>dropdb
</command>
25 <arg rep=
"repeat"><replaceable>option
</replaceable></arg>
26 <arg choice=
"plain"><replaceable>dbname
</replaceable></arg>
32 <title>Description
</title>
35 <application>dropdb
</application> destroys an existing
36 <productname>PostgreSQL
</productname> database.
37 The user who executes this command must be a database
38 superuser or the owner of the database.
42 <application>dropdb
</application> is a wrapper around the
43 <acronym>SQL
</acronym> command
<xref linkend=
"SQL-DROPDATABASE"
44 endterm=
"SQL-DROPDATABASE-title">.
45 There is no effective difference between dropping databases via
46 this utility and via other methods for accessing the server.
53 <title>Options
</title>
56 <application>dropdb<
/> accepts the following command-line arguments:
60 <term><replaceable class=
"parameter">dbname
</replaceable></term>
63 Specifies the name of the database to be removed.
69 <term><option>-e<
/></term>
70 <term><option>--echo<
/></term>
73 Echo the commands that
<application>dropdb
</application> generates
74 and sends to the server.
80 <term><option>-i<
/></term>
81 <term><option>--interactive<
/></term>
84 Issues a verification prompt before doing anything destructive.
92 <application>dropdb
</application> also accepts the following
93 command-line arguments for connection parameters:
97 <term><option>-h
<replaceable class=
"parameter">host
</replaceable><
/></term>
98 <term><option>--host
<replaceable class=
"parameter">host
</replaceable><
/></term>
101 Specifies the host name of the machine on which the
103 is running. If the value begins with a slash, it is used
104 as the directory for the Unix domain socket.
110 <term><option>-p
<replaceable class=
"parameter">port
</replaceable><
/></term>
111 <term><option>--port
<replaceable class=
"parameter">port
</replaceable><
/></term>
114 Specifies the TCP port or local Unix domain socket file
115 extension on which the server
116 is listening for connections.
122 <term><option>-U
<replaceable class=
"parameter">username
</replaceable><
/></term>
123 <term><option>--username
<replaceable class=
"parameter">username
</replaceable><
/></term>
126 User name to connect as.
132 <term><option>-w<
/></term>
133 <term><option>--no-password<
/></term>
136 Never issue a password prompt. If the server requires
137 password authentication and a password is not available by
138 other means such as a
<filename>.pgpass
</filename> file, the
139 connection attempt will fail. This option can be useful in
140 batch jobs and scripts where no user is present to enter a
147 <term><option>-W<
/></term>
148 <term><option>--password<
/></term>
151 Force
<application>dropdb
</application> to prompt for a
152 password before connecting to a database.
156 This option is never essential, since
157 <application>dropdb
</application> will automatically prompt
158 for a password if the server demands password authentication.
159 However,
<application>dropdb
</application> will waste a
160 connection attempt finding out that the server wants a password.
161 In some cases it is worth typing
<option>-W<
/> to avoid the extra
172 <title>Environment
</title>
176 <term><envar>PGHOST
</envar></term>
177 <term><envar>PGPORT
</envar></term>
178 <term><envar>PGUSER
</envar></term>
182 Default connection parameters
189 This utility, like most other
<productname>PostgreSQL<
/> utilities,
190 also uses the environment variables supported by
<application>libpq<
/>
191 (see
<xref linkend=
"libpq-envars">).
198 <title>Diagnostics
</title>
201 In case of difficulty, see
<xref linkend=
"SQL-DROPDATABASE"
202 endterm=
"sql-dropdatabase-title"> and
<xref linkend=
"APP-PSQL"> for
203 discussions of potential problems and error messages.
204 The database server must be running at the
205 targeted host. Also, any default connection settings and environment
206 variables used by the
<application>libpq
</application> front-end
214 <title>Examples
</title>
217 To destroy the database
<literal>demo
</literal> on the default
220 <prompt>$
</prompt><userinput>dropdb demo
</userinput>
225 To destroy the database
<literal>demo
</literal> using the
226 server on host
<literal>eden
</literal>, port
5000, with verification and a peek
227 at the underlying command:
229 <prompt>$
</prompt><userinput>dropdb -p
5000 -h eden -i -e demo
</userinput>
230 <computeroutput>Database
"demo" will be permanently deleted.
231 Are you sure? (y/n)
</computeroutput><userinput>y
</userinput>
232 <computeroutput>DROP DATABASE demo;
</computeroutput>
239 <title>See Also
</title>
241 <simplelist type=
"inline">
242 <member><xref linkend=
"app-createdb"></member>
243 <member><xref linkend=
"sql-dropdatabase" endterm=
"sql-dropdatabase-title"></member>