dropdb

Removes a database.

Synopsis

  1. dropdb [<connection_options>] [-e | --echo] [-i | --interactive] <dbname>
  2. dropdb --help
  3. dropdb --version

where:

  1. <connection_options> =
  2. [-h <host> | --host <host>]
  3. [-p <port> | -- port <port>]
  4. [-U <username> | --username <username>]
  5. [-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

The name of the database to be removed.

Options

-e, —echo

Echo the commands that dropdb generates and sends to the server.

-i, —interactive

Issues a verification prompt before doing anything destructive.

-h, —host

The host name of the machine on which the HAWQ master database server is running. If not specified, reads from the environment variable PGHOST or defaults to localhost.

-p, —port

The TCP port on which the HAWQ master database server is listening for connections. If not specified, reads from the environment variable PGPORT or defaults to 5432.

-U, —username

The database role name to connect as. If not specified, reads from the environment variable PGUSER or defaults to the current system role name.

-w, —no-password

Never issue a password prompt. If the server requires password authentication and a password is not available by other means such as a .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.

-W, —password

Force a password prompt.

Other Options

--help

Displays the online help.

--version

Displays the version of this utility.

Examples

To destroy the database named demo using default connection parameters:

  1. $ dropdb demo

To destroy the database named demo using connection options, with verification, and a peek at the underlying command:

  1. $ dropdb -p 54321 -h masterhost -i -e demo
  2. Database "demo" will be permanently deleted.
  3. Are you sure? (y/n) y
  4. DROP DATABASE "demo"
  5. DROP DATABASE