2013-11-09 90 views
3

我正在尝试将Padrino与Sequel和Postgres一起使用,并且我没有运气连接。无法通过Sequel连接到Postgres

在我的pg_hba.conf中,我将postgres用户设置为'trust',因此不需要密码(并且可以使用PgAdmin无需密码登录)。

# TYPE DATABASE  USER   ADDRESS     METHOD 
    local all    postgres        trust 

我Padrino连接看起来是这样的:

Sequel::Model.plugin(:schema) 
Sequel::Model.raise_on_save_failure = false # Do not throw exceptions on failure 
Sequel::Model.db = case Padrino.env 
    when :development then Sequel.connect(:adapter=>'postgres', :host=>'localhost', :database=>'padrino_template_development', :user=>'postgres', :password=>'', :loggers => [logger]) 
    when :production then Sequel.connect("postgres://localhost/padrino_template_production", :loggers => [logger]) 
    when :test  then Sequel.connect("postgres://localhost/padrino_template_test",  :loggers => [logger]) 
end 

当我再尝试运行rake任务sq:create

我得到这个消息

rake sq:create 
=> Creating database 'padrino_template_development' 
Password: 
createdb: could not connect to database postgres: FATAL: password authentication failed for user "postgres" 
FATAL: password authentication failed for user "postgres" 
<= sq:create executed 

我在做什么这里不正确?

回答

2

OK在这里找到了答案,问题是我使用的PgAdmin3版本有一个错误,导致用户在1970年更改密码时无效。

可以找到解决办法here