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=>
1 Answer 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
answered May 7, 2018 at 10:55
-
with or without
-
makes no difference to the psql commandJasen– Jasen2018年05月08日 08:12:11 +00:00Commented May 8, 2018 at 8:12 -
@Jasen your reference please, that
-
will not do any side effect, here is my references dba.stackexchange.com/questions/40335/… stackoverflow.com/questions/35782366/… serverfault.com/questions/718176/…Ahmad Abuhasna– Ahmad Abuhasna2018年05月08日 08:18:49 +00:00Commented May 8, 2018 at 8:18 -
ok, but it makes no difference to the database permissionsJasen– Jasen2018年05月08日 08:22:06 +00:00Commented May 8, 2018 at 8:22
-
@Jasen your reference pleaseAhmad Abuhasna– Ahmad Abuhasna2018年05月08日 08:27:45 +00:00Commented May 8, 2018 at 8:27
-
lang-sql
=#
prompt, not=>
.