首页 > 解决方案 > 服务器意外关闭连接python

问题描述

server closed the connection unexpectedly
        This probably means the server terminated abnormally
        before or while processing the request.

当我使用 docker exec 运行时...

psql: error: could not connect to server: could not translate
 host name "potgres" to address: No address associated with hostname

我的端口看起来像这样:

0.0.0.0:5431->5431/tcp, 5432/tcp

即使我在 file.yml 更改端口号,也没有任何反应!

标签: python-3.xpostgresqlubuntudocker-compose

解决方案


您确定您的主机名拼写正确吗?

psql:错误:无法连接到服务器:无法将主机名“potgres”转换为地址:没有与主机名关联的地址

看起来您将 postgres 拼错为 potgres。


推荐阅读