意外删除了postgres的默认超级用户特权-我可以找回它吗? [英] Accidently removed postgres default superuser privileges - can I get it back?

查看:417
本文介绍了意外删除了postgres的默认超级用户特权-我可以找回它吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在Webmin内部,我意外地取消选中了可以创建数据库吗?复选框。和可以创建用户吗?



我知道这很愚蠢。



但是由于它需要具有超级用户的用户特权来编辑/创建用户,是否有办法从linux终端上解决此问题?



我知道可以重置密码,但是我一直没有能够找出如何重置默认超级用户postgres的角色/权限。

解决方案

有一个单用户模式,您始终具有超级用户功能? :



作为根用户

  service postgresql stop 

作为用户postgres :(您可能需要更改版本号(此处为9.1)
.deb 发行版也可能具有不同的路径,
第一个路径是postgres二进制文件,第二个路径是包含postgresql.conf的目录
。 / p>

/usr/lib/postgresql/9.1/bin/postgres --single -D /etc/postgresql/9.1/main/



在新命令行上

 更改用户postgres使用超级用户; 

ctrl-d 退出。



作为根:

 服务postgresql开始

可以使用类似的策略来设置或重置密码等。


From inside Webmin I accidently unmarked the checkbox "Can create databases?" and "Can create users?"

Stupid, I know.

But since it takes a user with superuser privileges to edit/create a user, is there a way to fix this from the linux terminal?

I know it's possible to reset a password, but I haven't been able to find out how to reset the default superuser postgres' roles/privileges. Is this even possible or do I have to do a reinstall?

解决方案

there's a single-user mode where you always have superuser capabilities:

as root

service postgresql stop

as user postgres: (you may need to change the version number (here 9.1) Non .deb distros will probably have a different path here too. the first path is the postgres binary, the second one is the directory that contains postgresql.conf.

/usr/lib/postgresql/9.1/bin/postgres --single -D /etc/postgresql/9.1/main/

on the new command line

alter user postgres with superuser;

ctrl-d to exit.

as root:

service postgresql start

A similar strategy can use used to set or reset passwords etc.

这篇关于意外删除了postgres的默认超级用户特权-我可以找回它吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆