我将遵循此指南连接到我的GCP云Postgresql,我只有一个私有IP。当我运行时:
我得到了以下内容(实际引用已被替换为
然后我得到了以下结果。
./cloud_sql_proxy -instances=<Instance connection name>=tcp:5432
我得到了以下内容(实际引用已被替换为
<Instance连接名称>
)2019/04/01 11:46:45 failed to setup file descriptor limits: failed to set rlimit {&{8500 4096}} for max file descriptors: invalid argument
2019/04/01 11:46:45 Listening on 127.0.0.1:5432 for <Instance connection name>
2019/04/01 11:46:45 Ready for new connections
2019/04/01 11:47:28 New connection for <Instance connection name>
2019/04/01 11:49:38 couldn't connect to <Instance connection name>: dial tcp 172.27.160.3:3307: connect: connection timed out
如果我运行
psql "host=127.0.0.1 sslmode=disable dbname=<db> user=<user> password=<password>"
然后我得到了以下结果。
psql: FATAL: password authentication failed for user "prodigy"
如果在与我的云SQL相同网络的VM实例上运行相同的psql
命令,则连接就会非常好。
psql
命令中的主机IP不正确。只是一个猜测。 - HelloThere