1DROPDB(1) PostgreSQL Client Applications DROPDB(1)
2
3
4
6 dropdb - remove a PostgreSQL database
7
8
10 dropdb [ option... ] dbname
11
13 dropdb destroys an existing PostgreSQL database. The user who executes
14 this command must be a database superuser or the owner of the database.
15
16 dropdb is a wrapper around the SQL command DROP DATABASE [drop_data‐
17 base(7)]. There is no effective difference between dropping databases
18 via this utility and via other methods for accessing the server.
19
21 dropdb accepts the following command-line arguments:
22
23 dbname Specifies the name of the database to be removed.
24
25 -e
26
27 --echo Echo the commands that dropdb generates and sends to the server.
28
29 -i
30
31 --interactive
32 Issues a verification prompt before doing anything destructive.
33
34 dropdb also accepts the following command-line arguments for connection
35 parameters:
36
37 -h host
38
39 --host host
40 Specifies the host name of the machine on which the server is
41 running. If the value begins with a slash, it is used as the
42 directory for the Unix domain socket.
43
44 -p port
45
46 --port port
47 Specifies the TCP port or local Unix domain socket file exten‐
48 sion on which the server is listening for connections.
49
50 -U username
51
52 --username username
53 User name to connect as.
54
55 -w
56
57 --no-password
58 Never issue a password prompt. If the server requires password
59 authentication and a password is not available by other means
60 such as a .pgpass file, the connection attempt will fail. This
61 option can be useful in batch jobs and scripts where no user is
62 present to enter a password.
63
64 -W
65
66 --password
67 Force dropdb to prompt for a password before connecting to a
68 database.
69
70 This option is never essential, since dropdb will automatically
71 prompt for a password if the server demands password authentica‐
72 tion. However, dropdb will waste a connection attempt finding
73 out that the server wants a password. In some cases it is worth
74 typing -W to avoid the extra connection attempt.
75
77 PGHOST
78
79 PGPORT
80
81 PGUSER Default connection parameters
82
83 This utility, like most other PostgreSQL utilities, also uses the envi‐
84 ronment variables supported by libpq (see in the documentation).
85
87 In case of difficulty, see DROP DATABASE [drop_database(7)] and psql(1)
88 for discussions of potential problems and error messages. The database
89 server must be running at the targeted host. Also, any default connec‐
90 tion settings and environment variables used by the libpq front-end
91 library will apply.
92
94 To destroy the database demo on the default database server:
95
96 $ dropdb demo
97
98
99 To destroy the database demo using the server on host eden, port 5000,
100 with verification and a peek at the underlying command:
101
102 $ dropdb -p 5000 -h eden -i -e demo
103 Database "demo" will be permanently deleted.
104 Are you sure? (y/n) y
105 DROP DATABASE demo;
106
107
109 createdb(1), DROP DATABASE [drop_database(7)]
110
111
112
113Application 2011-09-22 DROPDB(1)