To destroy an existing database, use this command at the Unix shell:

   dropdb databasename

The alternative way is to use psql to remove this database:

    DROP DATABASE databasename;

Caution Dropping a Database

Upon dropping a database, all tables, data, relations, or objects in that database are destroyed. The Unix files associated with the database are also physically removed. It does not prompt you to make sure if you want to delete the database or not. This action cannot be undone, so you should weigh the consequences carefully before performing a drop database command.

Note ERROR: DROP DATABASE: cannot be executed...

If another user is logged onto this database while you are performing a drop database, then the database deletion will fail.

Help us make a better book, leave feedback. (