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.
dropdb [connection-option...] [option...] dbnameTo destroy the database demo on the default database server:
dropdb demoTo destroy the database demo using the server on host localhost, port 5000, with verification:
dropdb -p 5000 -h localhost demoIf you are not sure database exists or not before deleting then you can use --if-exists.
dropdb --if-exists demoIf dropdb command giving an error of existing connections then you can use -f parameter with command. It will attempt to terminate all existing connections to the target database before dropping it. ( It will work 13+ version)
dropdb -f demo
