PSQL:SSL错误:未知协议 [英] PSQL: SSL error: unknown protocol

查看:1153
本文介绍了PSQL:SSL错误:未知协议的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

全部。我有一个新的Ubuntu 17.04服务器设置。我可以通过ssh成功访问它。另外,我安装了一个postgresql数据库。它已配置为通过以下配置接受远程连接:

all. I have a new Ubuntu 17.04 server setup. I can access it through ssh successfully. Also, I have a postgresql database installed. It is already configured to accept remote connections through the following configurations:

pg_hba.conf

pg_hba.conf

host all all 0.0.0.0/0  md5

postgresql.conf

postgresql.conf

listen_addresses = '*' 

但是当我尝试从计算机访问数据库时,出现以下错误:

But when I try to access the database from my computer, I get the following error:

psql -h [SERVER_IP]  -d db_production -U dbuser 
psql: SSL error: unknown protocol
expected authentication request from server, but received S

我还在服务器内部运行了一个Docker容器。如果我通过/ bin / bash访问它,并且还尝试连接服务器数据库,则会出现此错误:

I also have a docker container running inside the server. If I access it through /bin/bash and also try to connect with the server db, I get this error:

psql -h [SERVER_IP]  -d db_production -U dbuser
psql: could not connect to server: Connection refused
    Is the server running on host "[SERVER_IP]" and accepting
    TCP/IP connections on port 5432?

端口5432已打开,防火墙已禁用。

The port 5432 is opened and the firewall is disabled. Does anybody have gone through that?

推荐答案

首先,当您连接到Docker时,您是否使用本地服务器主机?在这种情况下,服务器IP应该为 localhost 127.0.0.1

First, do you use the local server host when you're connected into the docker? The server IP, in that case, should be localhost or 127.0.0.1.

尝试使用完整的数据库URL:

Try to use the complete DB URL:

psql postgres:// dbuser:dbPass:dbPass @ SERVER_IP:5432 / dbname ?sslmode =首选

这篇关于PSQL:SSL错误:未知协议的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆