我一直在尝试使用 RubyMine 连接到 PostgreSQL ,但它总是要求输入密码。
在终端中,我使用以下方式连接:
psql -U postgres
我不需要输入密码。
但是,当我尝试使用RubyMine连接到PostgreSQL时总是要求输入密码。我尝试输入一些密码,但它们不起作用。有什么想法吗?
我的设置文件:
default: &default
adapter: postgresql
encoding: unicode
# For details on connection pooling, see rails configuration guide
# http://guides.rubyonrails.org/configuring.html#database-pooling
pool: 5
development:
<<: *default
database: portafolio_development
username: postgres
password:
test:
<<: *default
database: portafolio_test
username: postgres
password:
production:
<<: *default
database: portafolio_production
username: portafolio
password: <%= ENV['PORTAFOLIO_DATABASE_PASSWORD'] %>
被修改
我的 pg_hba.conf :
local all postgres peer
# TYPE DATABASE USER ADDRESS METHOD
# "local" is for Unix domain socket connections only
local all all peer
# IPv4 local connections:
host all all 127.0.0.1/32 md5
# IPv6 local connections:
host all all ::1/128 md5
# Allow replication connections from localhost, by a user with the
# replication privilege.
#local replication postgres peer
#host replication postgres 127.0.0.1/32 md5
#host replication postgres ::1/128 md5
解决
结果我有两个pg_hba.conf
个文件。一个用于版本 9.3 ,另一个用于 9.4 。我将第一个更改为以下内容,现在一切正常:
local all postgres trust
# The same using local loopback TCP/IP connections.
#
# TYPE DATABASE USER ADDRESS METHOD
host all all 127.0.0.1/32 trust
# The same as the previous line, but using a separate netmask column
#
# TYPE DATABASE USER IP-ADDRESS IP-MASK METHOD
host all all 127.0.0.1 255.255.255.255 trust
# The same over IPv6.
#
# TYPE DATABASE USER ADDRESS METHOD
host all all ::1/128 trust
# The same using a host name (would typically cover both IPv4 and IPv6).
#
# TYPE DATABASE USER ADDRESS METHOD
host all all localhost trust