[英]Cannot connect to Postgres via Sequel
我正在嘗試將 Padrino 與 Sequel 和 Postgres 一起使用,但沒有成功連接。
在我的 pg_hba.conf 中,我將 postgres 用戶設置為“信任”,因此不需要密碼(並且可以在沒有密碼的情況下使用 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
我在這里做錯了什么?
OK 在這里找到了答案,問題是我使用的 PgAdmin3 版本有一個錯誤,當我更改密碼時,該錯誤使用戶在 1970 年無效。
解決方案可以在這里找到
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.