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 -q
35
36 --quiet
37 Do not display a response.
38
39 dropdb also accepts the following command-line arguments for connection
40 parameters:
41
42 -h host
43
44 --host host
45 Specifies the host name of the machine on which the server is
46 running. If the value begins with a slash, it is used as the
47 directory for the Unix domain socket.
48
49 -p port
50
51 --port port
52 Specifies the TCP port or local Unix domain socket file exten‐
53 sion on which the server is listening for connections.
54
55 -U username
56
57 --username username
58 User name to connect as
59
60 -W
61
62 --password
63 Force password prompt.
64
66 PGHOST
67
68 PGPORT
69
70 PGUSER Default connection parameters
71
72 This utility, like most other PostgreSQL utilities, also uses the envi‐
73 ronment variables supported by libpq (see in the documentation).
74
76 In case of difficulty, see DROP DATABASE [drop_database(7)] and psql(1)
77 for discussions of potential problems and error messages. The database
78 server must be running at the targeted host. Also, any default connec‐
79 tion settings and environment variables used by the libpq front-end
80 library will apply.
81
83 To destroy the database demo on the default database server:
84
85 $ dropdb demo
86 DROP DATABASE
87
88
89 To destroy the database demo using the server on host eden, port 5000,
90 with verification and a peek at the underlying command:
91
92 $ dropdb -p 5000 -h eden -i -e demo
93 Database "demo" will be permanently deleted.
94 Are you sure? (y/n) y
95 DROP DATABASE "demo"
96 DROP DATABASE
97
98
100 createdb(1), DROP DATABASE [drop_database(7)]
101
102
103
104Application 2008-06-08 DROPDB(1)