1

I'm new to databases in general and Postgres in particular. I'm doing something wrong as I'm unable to drop a database.

Command line capture

I've searched for similar issues, but it's always someone that has lost or does not know an id/password. In this case the owner & superuser is postgres but I still can't drop my test databases.

test is an empty database, test_creation is has one table.

2
  • Please edit your post and show the data as text, not as an image. Also, your user fmavianemac is in no group and has no permissions. So as that user you cannot do anything with the test database. What is your exact quesstion? Maybe you want to ask how to recover/reset the root/postgres password of a database? Commented Jan 7, 2019 at 12:02
  • stackoverflow.com/questions/10845998/… Commented Jan 7, 2019 at 12:03

2 Answers 2

1

You need to connect to psql using following:

PGPASSWORD=your_password_here psql -h localhost -U your_usename;

And then try to delete database. For UI you can use any software like pgAdmin III that will be much easier for you because you are new to Postgres

Sign up to request clarification or add additional context in comments.

Comments

0

Only a superuser or the owner of a database can drop it.

Your prompt shows that you are not connected as superuser, and you are obviously not the database owner.

To drop a database, you must also make sure that nobody is connected to it.

5 Comments

I don't understand. I'm connected as postgress which is labeled as superuser in the roles.
Now I get it '>' for user '#' for root
@Treizh: psql postgres connects you to the database named postgres, not as the user postgres. To connect as the superuser you need to use psql -U postgres ...
@a_horse_with_no_name: Thanks, so if a type psql postgres as which user im I connected?
If you don't specify a database user, the default will be taken from the PGUSER environment variable, and if that is not set, the name of the operating system user is used

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.