postgresql psql:致命角色“root”不存在

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/46142381/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-10-21 02:38:15  来源:igfitidea点击:

psql: fatal role "root" does not exist

postgresqlpsqlpostgresql-9.3

提问by Mohideen bin Mohammed

I have gone through many SO question answer my problem was not solved..

我经历了很多这样的问题答案我的问题没有解决..

This is the method I tried:

这是我试过的方法:

user@user-Latitude-XT3:~$ sudo su postgres
No passwd entry for user 'postgres'
user@user-Latitude-XT3:~$ 

and many others.

和许多其他人。

I keep on getting fatal error user does not exist

我继续得到 fatal error user does not exist

any working solution?

任何工作解决方案?

please Notebefore marking duplicate, tried all similar but wasn't solved yet.

在标记重复之前注意,尝试了所有类似但尚未解决的问题。

回答by theGtknerd

This is how I normally login to postgres:

这是我通常登录 postgres 的方式:

sudo -i
sudo -i -u postgres
psql

回答by Mohideen bin Mohammed

Here how i fixed,

在这里我是如何修复的,

  1. vi /etc/postgresql/9.3/main/pg_hba.conf
  2. local all postgres peer

    here change peerto trust

  3. restart, sudo service postgresql restart

  4. now try, psql -U postgres

  1. vi /etc/postgresql/9.3/main/pg_hba.conf
  2. local all postgres peer

    这里改变信任

  3. 重新开始, sudo service postgresql restart

  4. 现在试试, psql -U postgres