dropdb
TLDR
Drop a database
SYNOPSIS
dropdb [options] dbname
DESCRIPTION
dropdb is a PostgreSQL utility that removes a database. It's a wrapper around the SQL DROP DATABASE command, providing a convenient command-line interface for database deletion.
The tool connects to the postgres database to execute the drop. The --force option terminates existing connections to the target database, allowing deletion of databases with active sessions.
dropdb requires appropriate privileges - typically superuser or database owner permissions.
PARAMETERS
DBNAME
Database name to drop.-h, --host HOST
Server hostname.-p, --port PORT
Server port.-U, --username USER
Connect as user.-i, --interactive
Prompt before drop.--if-exists
Don't error if database doesn't exist.--force
Terminate existing connections.-e, --echo
Show SQL command executed.--help
Display help information.
CAVEATS
Irreversible operation. Cannot drop database with active connections without --force. Requires superuser or owner privileges. Cannot drop template databases.
HISTORY
dropdb is part of the PostgreSQL client utilities, providing command-line database administration since PostgreSQL's early releases. It simplifies common administrative tasks without requiring direct SQL.


