DROPDB(1)
π dropdb β bestie, it's giving database deletion realness
okay so this is dropdb, and it lives in the PostgreSQL 17.11 Documentation, manual section 1. She's a little utility with a big job and honestly? She ate. Let's get into it π
β¨ NAME β¨
dropdb β remove a PostgreSQL database ποΈπ
π¦ SYNOPSIS π¦
dropdb [connection-option...] [option...] dbname
πΈ DESCRIPTION πΈ
So dropdb destroys an existing PostgreSQL database. Like, gone gone. Periodt. π
The user who runs this command must be a database superuser or the owner of the database β no exceptions, no cap, the vibe check is strict here π
dropdb is basically a cute little wrapper around the SQL command DROP DATABASE. And fr fr, there's no effective difference between dropping databases via this utility versus via any other method for accessing the server. Same energy, same outcome π«
π OPTIONS π
dropdb accepts the following command-line arguments:
dbnameβ specifies the name of the database to be removed. this is the main character of the command, the one you're sending away π«Ά-e,--echoβ echoes the commands thatdropdbgenerates and sends to the server. so you can see exactly what she's saying behind your back π-f,--forceβ attempts to terminate all existing connections to the target database before dropping it. seeDROP DATABASE(DROP_DATABASE(7)) for more info on this option. it's giving "clear the room before the drama" π-i,--interactiveβ issues a verification prompt before doing anything destructive. she asks first, like a respectful icon π-V,--versionβ prints thedropdbversion and exits. quick little flex, then she's out πͺ--if-existsβ do not throw an error if the database doesn't exist. a notice is issued in this case. lowkey the chill option π-?,--helpβ shows help aboutdropdbcommand line arguments, and exits. ask and she shall answer π
π connection parameter era π
dropdb also accepts the following command-line arguments for connection parameters:
-hhost,--host=`host β specifies the host name of the machine on which the server is running. if the value begins with a slash, it's used as the directory for the Unix domain socket. slashes = socket energy, iykyk π§-pport,--port=`port β specifies the TCP port or local Unix domain socket file extension on which the server is listening for connections π-Uusername,--username=`username β user name to connect as. be someone else for a sec, iconic behavior π-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 π€-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's worth typing -W to avoid the extra connection attempt. efficiency queen behavior, honestly β‘
--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 doesn't 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. she's flexible but she picks favorites π
π ENVIRONMENT π
PGHOSTPGPORTPGUSER
default connection parameters π«Ά
PG_COLORβ specifies whether to use color in diagnostic messages. possible values arealways,autoandnever. yes bestie, the errors can be pretty too π¨
this utility, like most other PostgreSQL utilities, also uses the environment variables supported by libpq (see Section 32.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 how she warns you first? respectful. communicative. a whole queen ππ
π₯ SEE ALSO π₯
createdb(1), DROP DATABASE (DROP_DATABASE(7))
β οΈ real talk tho: this command destroys a database. the -i flag exists for a reason, bestie. use it. love yourself. π
and that's the whole page, diva β¨ β this was PostgreSQL 17.11, dated 2026, and that's the tea on dropdb. now go forth and be careful with your databases π§ββοΈππ
π¦ where this page comes from
- opensuse-leap 16.0: postgresql17 17.11-160000.1.1 Β· PostgreSQL
- opensuse-leap 16.0: postgresql17 17.11-160000.1.1 Β· PostgreSQL
- opensuse-leap 16.0: postgresql17 17.11-160000.1.1 Β· PostgreSQL
- opensuse-leap 16.0: postgresql17 17.11-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