我使用运行 Ubuntu 15.10 的带有 Virtualbox 5.0.16 的 Windows 10 机器。网络适配器是桥接的,名称设置为 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 连接到 guest 机器时,我收到以下消息: FATAL: no pg_hba.conf entry for host "192.168.1.13", user "postgres", database "postgres", SSL off
我尝试通过 ssh 将主机连接到访客,但收到“网络错误:连接被拒绝”消息。也许这是我的问题的关键见解?
ping 在两个方向上都有效。
最佳答案
感谢@DanielVérité。
命令show hba_file
向我展示了我实际编辑的 pg_hba 不是正确的。我在 /etc/postgresql/9.4/main
中编辑了一个文件夹,而 postgreSQL 使用的文件夹是 /opt/PostgreSQL/9.4/data
关于postgresql - 无法连接到 VM (Ubuntu) 中的 postgreSQL : Access to database denied,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35934834/