伙计们!
我正在尝试在 pgAdmin 4 中创建本地服务器,但每次尝试创建时都会收到此错误:
[pgAdmin 错误]
如果“veterano”是我的用户名......
我尝试运行此操作(但不起作用)
检查 Postgres 服务是否安装正确:
$ sudo systemctl is-active postgresql
终端背面:active
$ sudo systemctl is-enabled postgresql
终端背面:enabled
$ sudo systemctl status postgresql
终端背面:active (exited)
$ sudo pg_isready
终端背面:/var/run/postgresql:5433 - accepting connections
我对 pg_hba.conf 的配置:
local all postgres peer
# TYPE DATABASE USER ADDRESS METHOD
# "local" is for Unix domain socket connections only
local all all peer
# IPv4 local connections:
host all all 127.0.0.1/32 md5
# IPv6 local connections:
host all all ::1/128 md5
# Allow replication connections from localhost, by a user with the
# replication privilege.
local replication all peer
host replication all 127.0.0.1/32 md5
host replication all ::1/128 md5
(每次更改 pg_hba.conf 中的某些内容后我都会运行$ sudo systemctl restart postgresql
重新启动 postgres 服务。)
检查 psql 和新的超级用户:
$ sudo -u postgres createuser -s $USER
终端背面createuser: error: creation of new role failed: ERROR: role "veterano" already exists
如果我尝试psql -U veterano
我可以登录...所以我尝试\du
检查角色列表
终端背面
List of roles
Role name | Attributes | Member of
-------------+------------------------------------------------------------+-----------
postgres | Superuser, Create role, Create DB, Replication, Bypass RLS | {}
veterano | Superuser, Create role, Create DB | {}
所以我尝试在终端中创建一个本地主机服务器:$ psql -h localhost -d mydatabase -U veterano -p 5432
终端背面: Password for user veterano:
(我把我的密码标记为ALTER USER veterano PASSWORD 'newPassword';
)
终端返回错误psql: error: FATAL: password authentication failed for user "veterano"
我真的不知道该怎么办...我尝试了一切,但仍然无法在 pgAdmin 4 中或直接在终端中创建本地服务器。
使用 Ubuntu 20.04.2 LTS
(对不起我的英语不好 )