无法通过主机归纳连接到Vagrant guest box中的Postgresql数据库? [英] Trouble connecting to Postgresql database in Vagrant guest box with Induction from host machine?
问题描述
我正在尝试连接到访客计算机内部的PostgreSQL数据库(使用Vagrant和VirtualBox)。
I'm trying to connect to my PostgreSQL database which is inside of a guest machine (using Vagrant and VirtualBox).
我正在尝试连接至该数据库与归纳,但是我收到一条错误消息:
I'm trying to connect to it with Induction, but I am getting an error saying:
Connection Error
Could not connect to server: Permission denied
Is the server running locally and accepting
connections on Unix domain socket "/var/pgsql_socket/.s.PGSQL.1234"
我让Vagrant做一个端口转发到主机上的1234端口。
I have Vagrant doing a port forward to port 1234 on my host machine.
我对感应连接的设置是:
My settings for the Induction connection are:
Adapter: postgres
Host Name: 127.0.0.1
Username: vagrant
Password: [i don't have a password for the vagrant user for postgres so leaving empty]
Port: 1234
Database: development
开发数据库由Rails使用 rake db创建:create:all
而且我知道它是有效的,因为我从Rails db控制台中看到了它。
The development database was created by Rails using rake db:create:all
and I know that it works because I see it from the Rails db console.
在我的postgresql.conf文件中,我设置了 listen_addresses
到'*'
来收听外部计算机。
In my postgresql.conf file, I have set listen_addresses
to '*'
to listen to external machines also.
我在做什么错?
编辑(添加我的pg_hba.conf):
EDIT (adding my pg_hba.conf):
# Database administrative login by Unix domain socket
local all postgres peer
# TYPE DATABASE USER ADDRESS METHOD
# "local" is for Unix domain socket connections only
local all all trust
# IPv4 local connections:
host all all 127.0.0.1/32 md5
# IPv6 local connections:
host all all ::1/128 md5
编辑(这是尝试连接时从归纳应用显示的错误t)
EDIT (this is the error that shows from the Induction app when trying to connect)
could not connect to server: Permission denied
Is the server running locally and accepting
connections on Unix domain socket "/var/pgsql_socket/.s.PGSQL.1234"
推荐答案
检查文件pg_hba.conf
看起来要求允许连接最容易,安全性较低,设置为信任(每个人都可以使用您的PostgreSQL)
http://www.postgresql.org/docs/9.2/static/auth-pg-hba-conf .html
check file pg_hba.conf looks like require allow connection most easy and lesss secure set 'trust' (everyone can use your postgresql) http://www.postgresql.org/docs/9.2/static/auth-pg-hba-conf.html
这篇关于无法通过主机归纳连接到Vagrant guest box中的Postgresql数据库?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!