我有一个新的Postgres Droplet,我在其中设置了一个Postgres数据库,我正试图从我的本地计算机(通过pd.read_sql_query)访问它。我还不能与水滴建立联系,我也不知道我错在哪里。我已经更改了我的pg_config和pg_hba文件,并重新启动了我的psql服务器。
这是我的pg_hba文件:
这是我的pg_config:
下面是我运行Droplet时的输出
netstat -nlt
我的理论是,由于某种原因,端口5432只侦听本地连接。以下是ls_pgclusters的输出,以供参考:
最后,这是我尝试连接到服务器时得到的输出:
C:\WINDOWS\system32>psql -h xxx.xx.xxx.xxx -p 5432 -d dbName -U postgres
psql: error: could not connect to server: Connection refused (0x0000274D/10061)
Is the server running on host "xxx.xx.xxx.xxx" and accepting
TCP/IP connections on port 5432?
我不知道要连接到服务器还需要做些什么。任何帮助都将不胜感激。
发布于 2021-05-07 10:58:21
您将listen_addresses
更改为*
,但是忘记了删除该行开头的注释(#
),因此该参数仍为其缺省值localhost
。
卸下#
并重启PostgreSQL。
https://stackoverflow.com/questions/67425149
复制相似问题