【发布时间】:2012-10-04 14:05:41
【问题描述】:
第一次尝试设置 postgresql 数据库。我正在使用this railscast。经过几个小时令人沮丧的问题,我得到了 rake db:create:all。现在我得到了错误:
password authentication failed for user "pgtest"
这是我的 pg_hba.conf
# 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 trust
# IPv6 local connections:
host all all ::1/128 trust
这是我的database.yml
development:
adapter: postgresql
encoding: unicode
database: pgtest_development
pool: 5
username: pgtest
password: password
test:
adapter: postgresql
encoding: unicode
database: pgtest_test
pool: 5
username: pgtest
password: password
我先尝试了没有密码,但它给出了错误:
fe_sendauth: no password supplied
我做错了什么?谢谢:)
【问题讨论】:
-
您的 postgres 密码无效是否已创建 pgtest 用户,请尝试使用 psql 或 pgadmin3 登录 postgres,然后检查
-
我不确定这是否重要,但您的 database.yml 配置中没有
host。 -
@ Amar,在 pgadmin3 中显示用户名“postgres”,所以我将 pg_hba.conf 更改为用户名 postgres,并且它旁边的密码是用户 postgres 的密码。它奏效了! =) 但是,让它成为用户 postgres 有问题吗?我认为这就像管理员用户或其他东西。谢谢!
标签: ruby-on-rails ruby rake rails-postgresql