无法通过Sequel连接到Postgres

时间:2013-11-09 09:26:32

标签: postgresql sequel padrino

我正在尝试将Padrino与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

我在这里做错了什么?

1 个答案:

答案 0 :(得分:2)

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

可以找到解决方案here