DROPDB(1)
π DROPDB(1) β dropdb, bestie edition
okay so this is the dropdb page from the PostgreSQL 16.15 manual, and she is the utility for yeeting a whole database into the void. no cap. let's get into it π«Ά
β¨ NAME β¨
dropdb β remove a PostgreSQL database
π SYNOPSIS π
dropdb [connection-option...] [option...] dbname
πΈ DESCRIPTION πΈ
dropdb destroys an existing PostgreSQL database. like, gone gone. π
The user who runs this command has to be a database superuser or the owner of the database. that's the vibe check and if you fail it, no drop for you.
dropdb is literally just 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 β it's the same energy, different font. β¨
π₯ OPTIONS π₯
dropdb accepts the following command-line arguments:
dbnameβ the name of the database you want removed. say it with your chest.-e,--echoβ echoes the commands thatdropdbgenerates and sends to the server. it's giving "show your work" π-f,--forceβ tries to terminate all existing connections to the target database before dropping it. seeDROP DATABASE(DROP_DATABASE(7)) for more info on this one, iykyk.-i,--interactiveβ issues a verification prompt before doing anything destructive. the "are you sure bestie" of it all π-V,--versionβ prints thedropdbversion and exits. slay, short and sweet.--if-existsβ do not throw an error if the database does not exist. a notice is issued in this case instead. very "no thoughts head empty" of you π¦-?,--helpβ shows help aboutdropdbcommand line arguments, and exits.
dropdb also accepts the following command-line arguments for connection parameters:
-h host,--host=hostβ specifies the host name of the machine on which the server is running. plot twist: if the value begins with a slash, it's used as the directory for the Unix domain socket. π-p port,--port=portβ specifies the TCP port or local Unix domain socket file extension on which the server is listening for connections. know your port, queen π-U username,--username=usernameβ user name to connect as.-w,--no-passwordβ never issue a password prompt. if the server requires password authentication and a password isn't available by other means such as a.pgpassfile, the connection attempt will fail. this option can be useful in batch jobs and scripts where no user is present to enter a password. very autopilot of it π€-W,--passwordβ forcesdropdbto prompt for a password before connecting to a database.
this option is never essential, since dropdb will automatically prompt for a password if the server demands password authentication. however, dropdb will waste a connection attempt finding out that the server wants a password. in some cases it is worth typing -W to avoid the extra connection attempt. efficiency icon behavior π
--maintenance-db=dbnameβ specifies the name of the database to connect to in order to drop the target database. if not specified, thepostgresdatabase will be used; if that does not exist (or is the database being dropped),template1will be used. this can be a connection string. if so, connection string parameters will override any conflicting command line options. the way that it has a whole backup plan π
π ENVIRONMENT π
PGHOSTPGPORTPGUSER
default connection parameters π
PG_COLORβ specifies whether to use color in diagnostic messages. possible values arealways,autoandnever.
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 π
createdb(1), DROP DATABASE (DROP_DATABASE(7))
β οΈ gentle reminder from your girl:-iis your bestie,--if-existsis your safety net, and-fis main character energy β use her wisely. π§
that's the whole page, bestie! written against PostgreSQL 16.15, dated 2026, straight from the DROPDB(1) manual. now go forth and drop responsibly β¨ππ
π¦ where this page comes from
- opensuse-leap 16.0: postgresql16 16.15-160000.1.1 Β· PostgreSQL
- opensuse-leap 16.0: postgresql16 16.15-160000.1.1 Β· PostgreSQL
- opensuse-leap 16.0: postgresql16 16.15-160000.1.1 Β· PostgreSQL
- opensuse-leap 16.0: postgresql16 16.15-160000.1.1 Β· PostgreSQL
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms