使用 ssh 隧道从远程 Mac 上的 PGAdmin 管理 postgres

使用 ssh 隧道从远程 Mac 上的 PGAdmin 管理 postgres

我已经在 Ubuntu 服务器上安装了 PostgreSQL,并且正在尝试使用远程 MacBook 上的 PGAdmin 连接到该服务器。

我已经创建了一个 ssh 隧道 -

macbook:~postgres$ ssh -L 5423:localhost:5432 [email protected]

我可以按预期在 MacBook 上使用 psql 进行连接 -

macbook:~ me$ psql -U postgres -p 5423 -h localhost
...
postgres=#

在 PGAdminIII 上的“新服务器注册”窗口中,我输入了以下凭据 -

Name - MyServer
Host - localhost
Port - 5423
Maintenance DB - postgres
Username - postgres
Password - <remote_postgres_password>

但连接失败了 -

Error connecting to the server: FATAL: password authentication failed for user "postgres"

不确定这里发生了什么,这些似乎是我用于 psql 的相同凭据。

我的 pg_hba.conf 文件只有以下几行 -

# Database administrative login by Unix domain socket
local   all             postgres                                peer
# "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

答案1

检查将您的 postgres 本地线路更改为信任(而不是对等)是否有效。

相关内容