Unable To Delete / Drop PostgreSQL Database

IT Support Forum Forums Databases PostgreSQL Troubleshooting Unable To Delete / Drop PostgreSQL Database

Tagged: 

This topic contains 0 replies, has 1 voice, and was last updated by  Webmaster 11 months ago.

  • Author
    Posts
  • #1549

    Webmaster
    Keymaster

    Sometimes when you try to delete / drop a PostgreSQL database, it doesn’t work. To fix this, you have to drop the database from the command prompt using this command:

    dropdb –username=xxx –password=yyy zzz

    Where xxx is the username of an account with permission to drop the database, yyy is the password for that user account and zzz is the name of the database you are trying to drop.

    You will then be asked to re-enter your password and the database will then drop.

    If this doesn’t work, restart the postgresql-x64-9.1 – PostgreSQL Server 9.1 service from the services.msc mmc console, then immediately run the command to drop the database again (before doing anything else).

    If this doesn’t work, you will get an error explaining why you can’t drop the database. Typically this is because there’s an active connection to the database.

You must be logged in to reply to this topic.