首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >无法创建用户postgres:角色"postgres“不存在

无法创建用户postgres:角色"postgres“不存在
EN

Stack Overflow用户
提问于 2013-03-24 04:33:41
回答 2查看 25.6K关注 0票数 11

我在ubuntu 12.04服务器上,正在尝试安装postgresql。到目前为止,我已经成功安装了它,但无法配置它。我需要创建一个角色才能前进,我在终端中运行了以下命令:

root@hostname: createuser -s -r postgres

上面写着:

createuser: could not connect to database postgres: FATAL: role "root" does not exist

好吧,所以我就这么做了:

su - postgres

然后再试一次

postgres@hostname: createuser -s -r postgres

我得到了一个错误

createuser: could not connect to database postgres: FATAL: role "postgres" does not exist

当我这样做的时候,我得到了同样的错误

psql -d dbname

这就像一个循环,我无法创建角色postgres,因为角色postgres还不存在。

我该如何解决这个问题?

postgres版本似乎是9.1.x,而ubuntu版本似乎是12.10

EN

回答 2

Stack Overflow用户

回答已采纳

发布于 2013-03-25 15:37:53

原来我在我的机器上安装了postgres-xcpostgresql。我不得不完全停用postgres-xc。要做到这一点有点困难,因为总是有一个错误的--purge remove postgres-xc,卸载无法继续。

似乎有某种包装上的bug。(details on launchpad)。

最后,我最终做了this来让它工作。

在那之后,我卸载了postgresql,并将其重新安装以使其正常工作。

票数 9
EN

Stack Overflow用户

发布于 2013-03-24 04:38:41

阅读postgresql tutorial,不管是Ubuntu还是其他Linux。

在创建角色或任何其他内容之前进行编辑在全新安装时,您需要创建数据库集群:您创建了吗?

代码语言:javascript
复制
initdb -D /usr/local/pgsql/data

您需要在linux机器上以postgres用户的身份登录。Here提供了更多信息。

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/15591749

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档