无法使用 pgadmin 连接到 Postgres
Can't connect to Postgres using pgadmin
我正在尝试连接到安装在 AWS EC2 实例上的 postgres 数据库。
我已经在我的本地 ubuntu 机器上安装了 pgadmin3,我正在尝试连接我的 postgres,但出现错误:
reports could not connect to server: Connection refused Is the server running on host "myip" and accepting TCP/IP connections on port 5432?
在 aws 上我打开了端口 5432。
我编辑了 postgresql.conf 并添加了 :
listen_addresses = '*'
在 pg_hba.conf 里面我添加了这个:
host all all 192.168.1.0/24 md5
但现在我收到这个错误:
FATAL: no pg_hba.conf entry for host "myip", user "postgres", database "postgres", SSL on FATAL: no pg_hba.conf entry for host "myip", user "postgres", database "postgres", SSL off getting this error
您必须编辑 postgresql.conf
文件并更改行 'listen_addresses'。
listen_addresses = '*'
那么您也编辑了 pg_hba.conf
文件。在此文件中,您已设置可以从哪些计算机连接到此服务器以及可以使用哪种身份验证方法。通常你需要类似的行:
host all all 192.168.1.0/24 md5
我通过将这一行添加到 postgresql.conf 解决了这个问题:
listen_addresses = '*'
postgresql.conf 的文件位置是:
/etc/postgresql/9.5/main/postgresql.conf
我在文件 pg_hba.conf 中添加了这一行:
# IPv4 local connections:
host all all 0.0.0.0/0 md5
host all all 127.0.0.1/32 md5
并使用以下方式重新启动 postgres 服务:
sudo service postgresql restart
我正在尝试连接到安装在 AWS EC2 实例上的 postgres 数据库。
我已经在我的本地 ubuntu 机器上安装了 pgadmin3,我正在尝试连接我的 postgres,但出现错误:
reports could not connect to server: Connection refused Is the server running on host "myip" and accepting TCP/IP connections on port 5432?
在 aws 上我打开了端口 5432。
我编辑了 postgresql.conf 并添加了 :
listen_addresses = '*'
在 pg_hba.conf 里面我添加了这个:
host all all 192.168.1.0/24 md5
但现在我收到这个错误:
FATAL: no pg_hba.conf entry for host "myip", user "postgres", database "postgres", SSL on FATAL: no pg_hba.conf entry for host "myip", user "postgres", database "postgres", SSL off getting this error
您必须编辑 postgresql.conf
文件并更改行 'listen_addresses'。
listen_addresses = '*'
那么您也编辑了 pg_hba.conf
文件。在此文件中,您已设置可以从哪些计算机连接到此服务器以及可以使用哪种身份验证方法。通常你需要类似的行:
host all all 192.168.1.0/24 md5
我通过将这一行添加到 postgresql.conf 解决了这个问题:
listen_addresses = '*'
postgresql.conf 的文件位置是:
/etc/postgresql/9.5/main/postgresql.conf
我在文件 pg_hba.conf 中添加了这一行:
# IPv4 local connections:
host all all 0.0.0.0/0 md5
host all all 127.0.0.1/32 md5
并使用以下方式重新启动 postgres 服务:
sudo service postgresql restart