1DROPDB(1)               PostgreSQL 9.2.24 Documentation              DROPDB(1)
2
3
4

NAME

6       dropdb - remove a PostgreSQL database
7

SYNOPSIS

9       dropdb [connection-option...] [option...] dbname
10

DESCRIPTION

12       dropdb destroys an existing PostgreSQL database. The user who executes
13       this command must be a database superuser or the owner of the database.
14
15       dropdb is a wrapper around the SQL command DROP DATABASE
16       (DROP_DATABASE(7)). There is no effective difference between dropping
17       databases via this utility and via other methods for accessing the
18       server.
19

OPTIONS

21       dropdb accepts the following command-line arguments:
22
23       dbname
24           Specifies the name of the database to be removed.
25
26       -e, --echo
27           Echo the commands that dropdb generates and sends to the server.
28
29       -i, --interactive
30           Issues a verification prompt before doing anything destructive.
31
32       -V, --version
33           Print the dropdb version and exit.
34
35       --if-exists
36           Do not throw an error if the database does not exist. A notice is
37           issued in this case.
38
39       -?, --help
40           Show help about dropdb command line arguments, and exit.
41
42       dropdb also accepts the following command-line arguments for connection
43       parameters:
44
45       -h host, --host=host
46           Specifies the host name of the machine on which the server is
47           running. If the value begins with a slash, it is used as the
48           directory for the Unix domain socket.
49
50       -p port, --port=port
51           Specifies the TCP port or local Unix domain socket file extension
52           on which the server is listening for connections.
53
54       -U username, --username=username
55           User name to connect as.
56
57       -w, --no-password
58           Never issue a password prompt. If the server requires password
59           authentication and a password is not available by other means such
60           as a .pgpass file, the connection attempt will fail. This option
61           can be useful in batch jobs and scripts where no user is present to
62           enter a password.
63
64       -W, --password
65           Force dropdb to prompt for a password before connecting to a
66           database.
67
68           This option is never essential, since dropdb will automatically
69           prompt for a password if the server demands password
70           authentication. However, dropdb will waste a connection attempt
71           finding out that the server wants a password. In some cases it is
72           worth typing -W to avoid the extra connection attempt.
73
74       --maintenance-db=dbname
75           Specifies the name of the database to connect to in order to drop
76           the target database. If not specified, the postgres database will
77           be used; if that does not exist (or is the database being dropped),
78           template1 will be used.
79

ENVIRONMENT

81       PGHOST, PGPORT, PGUSER
82           Default connection parameters
83
84       This utility, like most other PostgreSQL utilities, also uses the
85       environment variables supported by libpq (see Section 31.14,
86       “Environment Variables”, in the documentation).
87

DIAGNOSTICS

89       In case of difficulty, see DROP DATABASE (DROP_DATABASE(7)) and psql(1)
90       for discussions of potential problems and error messages. The database
91       server must be running at the targeted host. Also, any default
92       connection settings and environment variables used by the libpq
93       front-end library will apply.
94

EXAMPLES

96       To destroy the database demo on the default database server:
97
98           $ dropdb demo
99
100       To destroy the database demo using the server on host eden, port 5000,
101       with verification and a peek at the underlying command:
102
103           $ dropdb -p 5000 -h eden -i -e demo
104           Database "demo" will be permanently deleted.
105           Are you sure? (y/n) y
106           DROP DATABASE demo;
107

SEE ALSO

109       createdb(1), DROP DATABASE (DROP_DATABASE(7))
110
111
112
113PostgreSQL 9.2.24                 2017-11-06                         DROPDB(1)
Impressum