3 .\" Author: The PostgreSQL Global Development Group
4 .\" Generator: DocBook XSL Stylesheets vsnapshot <http://docbook.sf.net/>
6 .\" Manual: PostgreSQL 18.0 Documentation
7 .\" Source: PostgreSQL 18.0
10 .TH "DROPDB" "1" "2025" "PostgreSQL 18.0" "PostgreSQL 18.0 Documentation"
11 .\" -----------------------------------------------------------------
12 .\" * Define some portability stuff
13 .\" -----------------------------------------------------------------
14 .\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
15 .\" http://bugs.debian.org/507673
16 .\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html
17 .\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
20 .\" -----------------------------------------------------------------
21 .\" * set default formatting
22 .\" -----------------------------------------------------------------
23 .\" disable hyphenation
25 .\" disable justification (adjust text to left margin only)
27 .\" -----------------------------------------------------------------
28 .\" * MAIN CONTENT STARTS HERE *
29 .\" -----------------------------------------------------------------
31 dropdb \- remove a PostgreSQL database
33 .HP \w'\fBdropdb\fR\ 'u
34 \fBdropdb\fR [\fIconnection\-option\fR...] [\fIoption\fR...] \fIdbname\fR
40 database\&. The user who executes this command must be a database superuser or the owner of the database\&.
43 is a wrapper around the
46 \fBDROP DATABASE\fR\&. There is no effective difference between dropping databases via this utility and via other methods for accessing the server\&.
50 accepts the following command\-line arguments:
54 Specifies the name of the database to be removed\&.
61 Echo the commands that
63 generates and sends to the server\&.
70 Attempt to terminate all existing connections to the target database before dropping it\&. See
71 DROP DATABASE (\fBDROP_DATABASE\fR(7))
72 for more information on this option\&.
79 Issues a verification prompt before doing anything destructive\&.
93 Do not throw an error if the database does not exist\&. A notice is issued in this case\&.
102 command line arguments, and exit\&.
106 also accepts the following command\-line arguments for connection parameters:
108 \fB\-h \fR\fB\fIhost\fR\fR
110 \fB\-\-host=\fR\fB\fIhost\fR\fR
112 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\&.
115 \fB\-p \fR\fB\fIport\fR\fR
117 \fB\-\-port=\fR\fB\fIport\fR\fR
119 Specifies the TCP port or local Unix domain socket file extension on which the server is listening for connections\&.
122 \fB\-U \fR\fB\fIusername\fR\fR
124 \fB\-\-username=\fR\fB\fIusername\fR\fR
126 User name to connect as\&.
131 \fB\-\-no\-password\fR
133 Never issue a password prompt\&. If the server requires password authentication and a password is not available by other means such as a
135 file, the connection attempt will fail\&. This option can be useful in batch jobs and scripts where no user is present to enter a password\&.
144 to prompt for a password before connecting to a database\&.
146 This option is never essential, since
148 will automatically prompt for a password if the server demands password authentication\&. However,
150 will waste a connection attempt finding out that the server wants a password\&. In some cases it is worth typing
152 to avoid the extra connection attempt\&.
155 \fB\-\-maintenance\-db=\fR\fB\fIdbname\fR\fR
157 Specifies the name of the database to connect to in order to drop the target database\&. If not specified, the
159 database will be used; if that does not exist (or is the database being dropped),
161 will be used\&. This can be a
162 connection string\&. If so, connection string parameters will override any conflicting command line options\&.
172 Default connection parameters
177 Specifies whether to use color in diagnostic messages\&. Possible values are
184 This utility, like most other
186 utilities, also uses the environment variables supported by
192 In case of difficulty, see
193 DROP DATABASE (\fBDROP_DATABASE\fR(7))
196 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
198 front\-end library will apply\&.
201 To destroy the database
203 on the default database server:
215 To destroy the database
217 using the server on host
218 eden, port 5000, with verification and a peek at the underlying command:
224 $ \fBdropdb \-p 5000 \-h eden \-i \-e demo\fR
225 Database "demo" will be permanently deleted\&.
226 Are you sure? (y/n) \fBy\fR
233 \fBcreatedb\fR(1), DROP DATABASE (\fBDROP_DATABASE\fR(7))