这是OCI上Ubuntu20.04的一个新安装。Postgres数据库已经安装并运行良好。问题是我无法使用主机的IP地址连接到数据库。请参阅下面的错误。
psql -h 135.145.78.113 -p 5432 -d postgres -U postgres -W
Password:
psql: error: connection to server at "135.145.78.113", port 5432 failed: Connection timed out
Is the server running on that host and accepting TCP/IP connections?当使用localhost时,它连接如下所示。
psql -h localhost -p 5432 -d postgres -U postgres -W
Password:
psql (13.7 (Ubuntu 13.7-1.pgdg22.04+1))
SSL connection (protocol: TLSv1.3, cipher: TLS_AES_256_GCM_SHA384, bits: 256, compression: off)
Type "help" for help.非常感谢您的支持。
发布于 2022-07-14 08:03:58
我不确定这是否适用于您,因为我还没有得到关于IP配置的一致信息,但它可能适用。
从下面的图片判断,VM的内部LAN地址将不同于用于远程连接的IP。如果要在VM上键入命令,则应该使用内部IP地址,或者继续使用localhost。

https://askubuntu.com/questions/1418417
复制相似问题