我需要为用户恢复超级用户权限postgres
,因为它失去了超级用户资格。
我不能在psql
shell 中做任何事情,它给出了消息
must be superuser to create superusers
系统是 Ubuntu 16.04 和 PostgreSQL 9.5。
我可以恢复这个postgres
用户吗?
我需要为用户恢复超级用户权限postgres
,因为它失去了超级用户资格。
我不能在psql
shell 中做任何事情,它给出了消息
must be superuser to create superusers
系统是 Ubuntu 16.04 和 PostgreSQL 9.5。
我可以恢复这个postgres
用户吗?
如果您设法从所有用户中删除超级用户权限,则必须以单用户模式启动数据库:
以操作系统用户身份停止数据库服务器postgres
:
/path/to/postgresql/bin/pg_ctl stop -D /path/to/data/directory
以单用户模式启动服务器:
/path/to/postgresql/bin/postgres --single -D /path/to/data/directory postgres
现在你是一个超级用户。
恢复超级用户权限:
ALTER ROLE postgres SUPERUSER
CTRL使用+退出会话D(如果您在 Windows 上,则使用 +)CTRL。Z
以您通常的方式重新启动 PostgreSQL。