无法连接到 VM 中的 postgreSQL (Ubuntu):拒绝访问数据库
Can't connect to postgreSQL in VM (Ubuntu): Access to database denied
我使用一台装有 Virtualbox 5.0.16 的 Windows 10 机器,其中 Ubuntu 15.10 是 运行ning。网络适配器是一个桥接适配器,名称设置为 Intel(R) Dual Band Wireless-AS 3165。混杂模式设置为允许所有 VM 和主机,并选中底层复选框(电缆连接)。
在这个 Ubuntu 中,我 运行 一个 PostgreSQL 9.4.5 实例,我在其中配置了 postgresql.conf 和 pg_hba.conf 文件。
在postgresql.conf文件中,我设置好了这一行:
listen_addresses = '*'
在 pg_hba.conf 中,底部有以下几行:
# TYPE DATABASE USER ADDRESS METHOD
# IPv4 local connections:
host all all 127.0.0.1/32 md5
host all all 0.0.0.0/0 md5
host all all ::1/128 md5
host all all ::/0 md5
host all all 192.168.1.13 md5
host all all 0.0.0.0/0 md5
目前,我主机的ip地址是(ipconfig命令和无线)192.168.1.13,来宾机是(ifconfig命令)192.168.1.4
当从主机使用 pgadmin 连接到客户机时,我收到以下消息:致命:没有 pg_hba.conf 主机“192.168.1.13”、用户 "postgres"、数据库 "postgres",SSL 关闭
我试图通过 ssh 将我的主机连接到来宾,但我收到一条 "Network error: Connection refused" 消息。也许这是我的问题的关键见解?
ping 双向有效。
感谢@DanielVérité。
命令 show hba_file
向我显示 pg_hba 我实际上正在编辑的是不正确的。我编辑了 /etc/postgresql/9.4/main
文件夹中的那个,而 postgreSQL 使用的那个是 /opt/PostgreSQL/9.4/data
我使用一台装有 Virtualbox 5.0.16 的 Windows 10 机器,其中 Ubuntu 15.10 是 运行ning。网络适配器是一个桥接适配器,名称设置为 Intel(R) Dual Band Wireless-AS 3165。混杂模式设置为允许所有 VM 和主机,并选中底层复选框(电缆连接)。
在这个 Ubuntu 中,我 运行 一个 PostgreSQL 9.4.5 实例,我在其中配置了 postgresql.conf 和 pg_hba.conf 文件。
在postgresql.conf文件中,我设置好了这一行:
listen_addresses = '*'
在 pg_hba.conf 中,底部有以下几行:
# TYPE DATABASE USER ADDRESS METHOD
# IPv4 local connections:
host all all 127.0.0.1/32 md5
host all all 0.0.0.0/0 md5
host all all ::1/128 md5
host all all ::/0 md5
host all all 192.168.1.13 md5
host all all 0.0.0.0/0 md5
目前,我主机的ip地址是(ipconfig命令和无线)192.168.1.13,来宾机是(ifconfig命令)192.168.1.4
当从主机使用 pgadmin 连接到客户机时,我收到以下消息:致命:没有 pg_hba.conf 主机“192.168.1.13”、用户 "postgres"、数据库 "postgres",SSL 关闭
我试图通过 ssh 将我的主机连接到来宾,但我收到一条 "Network error: Connection refused" 消息。也许这是我的问题的关键见解?
ping 双向有效。
感谢@DanielVérité。
命令 show hba_file
向我显示 pg_hba 我实际上正在编辑的是不正确的。我编辑了 /etc/postgresql/9.4/main
文件夹中的那个,而 postgreSQL 使用的那个是 /opt/PostgreSQL/9.4/data