有两个帖子可以帮助你在Stack Overflow和Superuser上进行此操作。以下是链接。 如何从Vagrant VirtualBox机器连接到主机PostgreSQL https://superuser.com/questions/310697/connect-to-the-host-machine-from-a-virtualbox-guest-os/310745#310745 如果您正确设置,就可以实现您想要实现的内容。