0

Im trying to drop some databases on a postgres 9.6 server, but when I try Im told I am unable to.

I was under the impression that the postgres user was like a superuser.

su postgres
bash-4.2$ psql
could not change directory to "/root": Permission denied
psql (9.6.8)
Type "help" for help.

postgres=> DROP DATABASE d;
ERROR:  must be owner of database d
postgres=>
4
  • As a superuser you can always take ownership of that database, then drop it. Commented May 7, 2018 at 8:13
  • hmm, superusers usally get a =# prompt, not =>. Commented May 7, 2018 at 9:29
  • You have a previously abandoned question in postgres user is not superuser which seems closely related. Commented May 7, 2018 at 10:58
  • Yes youre right. And I think this, and the other problem are probably due to being hacked Commented May 8, 2018 at 0:28

1 Answer 1

-1

The problem with su postgres command, you changed the user to posgress but bash (to be more specific environment) owner still root or the original user, in-order to fix this issue use su - postgres instead of su postgres

5

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.