Error:must be owner of database

18,654

Q: I want to delete a particular database which I have named 'mysitedb' so what I did is I opened the terminal and entered the command 'dropdb mysitedb' then the error 'ERROR: must be owner of database mysitedb' pops up...

OK - this means you don't have the right credentials. You need the username/password of a postgresql user with permissions to delete that database.

NOTE: I know the user who owns it. Also I know the password.

WHAT??? Then who were you logged in as when you got the permissions error????

ANYWAY: you want the dropdb command:

dropdb -U db_owner_username -i [-h host] mysitedb

Here is the Postgresql documentation page:

Share:
18,654
mal danel
Author by

mal danel

Updated on July 26, 2022

Comments

  • mal danel
    mal danel over 1 year

    I want to delete a particular database which I have named 'mysitedb' so what I did is I opened the terminal and entered the command 'dropdb mysitedb' then the error 'ERROR: must be owner of database mysitedb' pops up. I know the username and pass for the particular database but don't have a clue on deleting it. I am new to postgresql. be gentle :P

    • paulsm4
      paulsm4 over 7 years
      Apparently you don't know the username/password for a Postgresql user with permission to delete the database. That's what you need to get.
    • Philip Couling
      Philip Couling over 7 years
      stackoverflow.com/questions/17165254/… This will show you how to find the user who owns the database.
    • mal danel
      mal danel over 7 years
      NOTE: I know the user who owns it
    • mal danel
      mal danel over 7 years
      also I know the password.but I dont know how to login
    • Ildar Musin
      Ildar Musin over 7 years
      dropdb <database_name> -U <owner_username> -W It will ask you for the password
    • Noitidart
      Noitidart about 4 years
      Thanks @PhilipCouling that was the solution. I thought I knew who owned the table, but after doing that query I figured out how really did.