postgres

Drop a database from postgres

Posted on Updated on

in bash

type psql

\list or \l to list your database

terminate any connections by using the following command. example if databse named YourDatabase

select pg_terminate_backend(pid) from pg_stat_activity where datname=’YourDatabase’;

*use procid instead of pid for older versions of postgres

DROP DATABASE “YourDatabase”;

Now your database is gone.

https://stackoverflow.com/questions/7073773/drop-postgresql-database-through-command-line for reference