2013-11-09 132 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