我已经在 stackoverflow 上看到了关于类似主题的所有问题,但我想知道为什么会发生这种情况,问题出在哪里,以及如何正确设置它。我正在学习编码,所以对于任何误解,我深表歉意。请对我有耐心。
我的情况是——
我无法psql
从终端运行命令。
回应是——
psql: FATAL: role "some_name" does not exist
在我写下并按回车后 -
sudo -u postgres -i
一切正常,我可以运行psql
命令。sudo -u postgres -i
每次打开终端时,我都需要一次又一次地编写命令。
我想感谢任何回应。
如果您有更多问题,我可以为您提供更多信息。
在这里查看一些附加信息:
[postgres@localhost ~]$ psql
psql (9.6.6)
Type "help" for help.
postgres=# \du
List of roles
Role name | Attributes | Member
of
-----------+------------------------------------------------------------+-------
----
matus | | {}
postgres | Superuser, Create role, Create DB, Replication, Bypass RLS | {}
其他:
[postgres@localhost ~]$ whoami
postgres
所以,我有两个打开的终端,一个作为postgres
,另一个作为user_name
我可以做其他事情的地方,以某种方式使用 db。