dropdb
Removes a database.
Synopsis
dropdb [<connection_options>] [-e | --echo] [-i | --interactive] <dbname>
dropdb --help
dropdb --version
where:
<connection_options> =
[-h <host> | --host <host>]
[-p <port> | -- port <port>]
[-U <username> | --username <username>]
[-W | --password]
Description
dropdb
destroys an existing database. The user who executes this command must be a superuser or the owner of the database being dropped.
dropdb
is a wrapper around the SQL command DROP DATABASE
.
Arguments
Options
dropdb
generates and sends to the server.<connection_options>
PGHOST
or defaults to localhost.PGPORT
or defaults to 5432.PGUSER
or defaults to the current system role name..pgpass
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.Other Options
Examples
To destroy the database named demo
using default connection parameters:
$ dropdb demo
To destroy the database named demo
using connection options, with verification, and a peek at the underlying command:
$ dropdb -p 54321 -h masterhost -i -e demo
Database "demo" will be permanently deleted.
Are you sure? (y/n) y
DROP DATABASE "demo"
DROP DATABASE