man > dropdb(1)

DROPDB(1) PostgreSQL 14.23 Documentation DROPDB(1)

๐Ÿท๏ธ NAME

dropdb - remove a PostgreSQL database

๐Ÿš€ Quick Reference

Use CaseCommandDescription
๐Ÿ—‘๏ธ Drop a database dropdb dbname Remove a database on the default server
๐Ÿ” Preview the SQL command dropdb -e dbname Echo the generated DROP DATABASE command
๐Ÿ›ก๏ธ Force disconnect all connections dropdb -f dbname Terminate existing connections before dropping
โœ… Interactive confirmation dropdb -i dbname Prompt for confirmation before deleting
๐ŸŒ Connect to a remote server dropdb -h host -p port dbname Specify host and port for the database server
โญ๏ธ Skip if database does not exist dropdb --if-exists dbname Do not error on missing database

๐Ÿ”ง SYNOPSIS

dropdb [connection-option...] [option...] dbname

๐Ÿ“– DESCRIPTION

dropdb destroys an existing PostgreSQL database. The user who executes this command must be a database superuser or the owner of the database.

dropdb is a wrapper around the SQL command DROP DATABASE. There is no effective difference between dropping databases via this utility and via other methods for accessing the server.

โš™๏ธ OPTIONS

dropdb accepts the following command-line arguments:

dropdb also accepts the following command-line arguments for connection parameters:

๐ŸŒ ENVIRONMENT

This utility, like most other PostgreSQL utilities, also uses the environment variables supported by libpq (see Section 34.15).

๐Ÿฉบ DIAGNOSTICS

In case of difficulty, see DROP DATABASE (DROP_DATABASE(7)) and psql(1) for discussions of potential problems and error messages. The database server must be running at the targeted host. Also, any default connection settings and environment variables used by the libpq front-end library will apply.

๐Ÿงช EXAMPLES

To destroy the database demo on the default database server:

$ dropdb demo

To destroy the database demo using the server on host eden, port 5000, with verification and a peek at the underlying command:

$ dropdb -p 5000 -h eden -i -e demo
Database "demo" will be permanently deleted.
Are you sure? (y/n) y
DROP DATABASE demo;

๐Ÿ”— SEE ALSO

PostgreSQL 14.23 2026 DROPDB(1)

dropdb(1)
๐Ÿท๏ธ NAME ๐Ÿš€ Quick Reference ๐Ÿ”ง SYNOPSIS ๐Ÿ“– DESCRIPTION โš™๏ธ OPTIONS ๐ŸŒ ENVIRONMENT ๐Ÿฉบ DIAGNOSTICS ๐Ÿงช EXAMPLES ๐Ÿ”— SEE ALSO

Generated by phpman v4.10.0-7-g98e9fd5 · Markdown · JSON · MCP Author: Che Dong Under GNU General Public License
2026-09-03 14:48 @216.73.216.75
CrawledBy Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko; compatible; ClaudeBot/1.0; +claudebot@anthropic.com)
Valid XHTML 1.0 Transitional!Valid CSS!

^_top_^