我正在尝试使用Heroku上的其他人开发的网络应用。拉动源代码后,我在我的计算机上安装了PostgreSQL 9.3。
尝试在Heroku上导入现有数据库,但它似乎不起作用:
$ export HEROKU_POSTGRES_IVORY_URL=postgres:///$(user)
尝试使用我的database.yml文件中的以下设置:
development:
adapter: postgresql
database: app-dev
host: localhost
username: user
password: (password created when installing PostgreSQL)
但是当我尝试在本地运行应用程序时,这会产生以下错误:
c:/RailsInstaller/Ruby2.0.0/lib/ruby/gems/2.0.0/gems/activerecord-3.2.18/lib/act
ive_record/connection_adapters/postgresql_adapter.rb:1222:in `initialize': FATAL
: password authentication failed for user "user" (PG::ConnectionBad)
from c:/RailsInstaller/Ruby2.0.0/lib/ruby/gems/2.0.0/gems/activerecord-3
.2.18/lib/active_record/connection_adapters/postgresql_adapter.rb:1222:in `new'
from c:/RailsInstaller/Ruby2.0.0/lib/ruby/gems/2.0.0/gems/activerecord-3
.2.18/lib/active_record/connection_adapters/postgresql_adapter.rb:1222:in `conne
ct'
from c:/RailsInstaller/Ruby2.0.0/lib/ruby/gems/2.0.0/gems/activerecord-3
.2.18/lib/active_record/connection_adapters/postgresql_adapter.rb:324:in `initia
lize'
from c:/RailsInstaller/Ruby2.0.0/lib/ruby/gems/2.0.0/gems/activerecord-3
.2.18/lib/active_record/connection_adapters/postgresql_adapter.rb:28:in `new'
from c:/RailsInstaller/Ruby2.0.0/lib/ruby/gems/2.0.0/gems/activerecord-3
.2.18/lib/active_record/connection_adapters/postgresql_adapter.rb:28:in `postgre
sql_connection'
from c:/RailsInstaller/Ruby2.0.0/lib/ruby/gems/2.0.0/gems/activerecord-3
.2.18/lib/active_record/connection_adapters/abstract/connection_pool.rb:315:in `
new_connection'
from c:/RailsInstaller/Ruby2.0.0/lib/ruby/gems/2.0.0/gems/activerecord-3
.2.18/lib/active_record/connection_adapters/abstract/connection_pool.rb:325:in `
checkout_new_connection'
from c:/RailsInstaller/Ruby2.0.0/lib/ruby/gems/2.0.0/gems/activerecord-3
.2.18/lib/active_record/connection_adapters/abstract/connection_pool.rb:247:in `
block (2 levels) in checkout'
from c:/RailsInstaller/Ruby2.0.0/lib/ruby/gems/2.0.0/gems/activerecord-3
.2.18/lib/active_record/connection_adapters/abstract/connection_pool.rb:242:in `
loop'
from c:/RailsInstaller/Ruby2.0.0/lib/ruby/gems/2.0.0/gems/activerecord-3
.2.18/lib/active_record/connection_adapters/abstract/connection_pool.rb:242:in `
block in checkout'
from c:/RailsInstaller/Ruby2.0.0/lib/ruby/2.0.0/monitor.rb:211:in `mon_s
ynchronize'
from c:/RailsInstaller/Ruby2.0.0/lib/ruby/gems/2.0.0/gems/activerecord-3
.2.18/lib/active_record/connection_adapters/abstract/connection_pool.rb:239:in `
checkout'
from c:/RailsInstaller/Ruby2.0.0/lib/ruby/gems/2.0.0/gems/activerecord-3
.2.18/lib/active_record/connection_adapters/abstract/connection_pool.rb:102:in `
block in connection'
from c:/RailsInstaller/Ruby2.0.0/lib/ruby/2.0.0/monitor.rb:211:in `mon_s
ynchronize'
from c:/RailsInstaller/Ruby2.0.0/lib/ruby/gems/2.0.0/gems/activerecord-3
.2.18/lib/active_record/connection_adapters/abstract/connection_pool.rb:101:in `
connection'
from c:/RailsInstaller/Ruby2.0.0/lib/ruby/gems/2.0.0/gems/activerecord-3
.2.18/lib/active_record/connection_adapters/abstract/connection_pool.rb:410:in `
retrieve_connection'
from c:/RailsInstaller/Ruby2.0.0/lib/ruby/gems/2.0.0/gems/activerecord-3
.2.18/lib/active_record/connection_adapters/abstract/connection_specification.rb
:171:in `retrieve_connection'
from c:/RailsInstaller/Ruby2.0.0/lib/ruby/gems/2.0.0/gems/activerecord-3
.2.18/lib/active_record/connection_adapters/abstract/connection_specification.rb
:145:in `connection'
from c:/RailsInstaller/Ruby2.0.0/lib/ruby/gems/2.0.0/gems/activerecord-3
.2.18/lib/active_record/model_schema.rb:310:in `clear_cache!'
from c:/RailsInstaller/Ruby2.0.0/lib/ruby/gems/2.0.0/gems/activerecord-3
.2.18/lib/active_record/railtie.rb:103:in `block (2 levels) in <class:Railtie>'
from c:/RailsInstaller/Ruby2.0.0/lib/ruby/gems/2.0.0/gems/activesupport-
3.2.18/lib/active_support/callbacks.rb:418:in `_run__445699908__prepare__2175577
33__callbacks'
from c:/RailsInstaller/Ruby2.0.0/lib/ruby/gems/2.0.0/gems/activesupport-
3.2.18/lib/active_support/callbacks.rb:405:in `__run_callback'
from c:/RailsInstaller/Ruby2.0.0/lib/ruby/gems/2.0.0/gems/activesupport-
3.2.18/lib/active_support/callbacks.rb:385:in `_run_prepare_callbacks'
from c:/RailsInstaller/Ruby2.0.0/lib/ruby/gems/2.0.0/gems/activesupport-
3.2.18/lib/active_support/callbacks.rb:81:in `run_callbacks'
from c:/RailsInstaller/Ruby2.0.0/lib/ruby/gems/2.0.0/gems/actionpack-3.2
.18/lib/action_dispatch/middleware/reloader.rb:74:in `prepare!'
from c:/RailsInstaller/Ruby2.0.0/lib/ruby/gems/2.0.0/gems/actionpack-3.2
.18/lib/action_dispatch/middleware/reloader.rb:48:in `prepare!'
from c:/RailsInstaller/Ruby2.0.0/lib/ruby/gems/2.0.0/gems/railties-3.2.1
8/lib/rails/application/finisher.rb:47:in `block in <module:Finisher>'
from c:/RailsInstaller/Ruby2.0.0/lib/ruby/gems/2.0.0/gems/railties-3.2.1
8/lib/rails/initializable.rb:30:in `instance_exec'
from c:/RailsInstaller/Ruby2.0.0/lib/ruby/gems/2.0.0/gems/railties-3.2.1
8/lib/rails/initializable.rb:30:in `run'
from c:/RailsInstaller/Ruby2.0.0/lib/ruby/gems/2.0.0/gems/railties-3.2.1
8/lib/rails/initializable.rb:55:in `block in run_initializers'
from c:/RailsInstaller/Ruby2.0.0/lib/ruby/gems/2.0.0/gems/railties-3.2.1
8/lib/rails/initializable.rb:54:in `each'
from c:/RailsInstaller/Ruby2.0.0/lib/ruby/gems/2.0.0/gems/railties-3.2.1
8/lib/rails/initializable.rb:54:in `run_initializers'
from c:/RailsInstaller/Ruby2.0.0/lib/ruby/gems/2.0.0/gems/railties-3.2.1
8/lib/rails/application.rb:136:in `initialize!'
from c:/RailsInstaller/Ruby2.0.0/lib/ruby/gems/2.0.0/gems/railties-3.2.1
8/lib/rails/railtie/configurable.rb:30:in `method_missing'
from c:/Users/Alison/young-lake-3173/config/environment.rb:5:in `<top (r
equired)>'
from c:/RailsInstaller/Ruby2.0.0/lib/ruby/gems/2.0.0/gems/activesupport-
3.2.18/lib/active_support/dependencies.rb:251:in `require'
from c:/RailsInstaller/Ruby2.0.0/lib/ruby/gems/2.0.0/gems/activesupport-
3.2.18/lib/active_support/dependencies.rb:251:in `block in require'
from c:/RailsInstaller/Ruby2.0.0/lib/ruby/gems/2.0.0/gems/activesupport-
3.2.18/lib/active_support/dependencies.rb:236:in `load_dependency'
from c:/RailsInstaller/Ruby2.0.0/lib/ruby/gems/2.0.0/gems/activesupport-
3.2.18/lib/active_support/dependencies.rb:251:in `require'
from c:/Users/Alison/young-lake-3173/config.ru:3:in `block in <main>'
from c:/RailsInstaller/Ruby2.0.0/lib/ruby/gems/2.0.0/gems/rack-1.4.5/lib
/rack/builder.rb:51:in `instance_eval'
from c:/RailsInstaller/Ruby2.0.0/lib/ruby/gems/2.0.0/gems/rack-1.4.5/lib
/rack/builder.rb:51:in `initialize'
from c:/Users/Alison/young-lake-3173/config.ru:in `new'
from c:/Users/Alison/young-lake-3173/config.ru:in `<main>'
from c:/RailsInstaller/Ruby2.0.0/lib/ruby/gems/2.0.0/gems/rack-1.4.5/lib
/rack/builder.rb:40:in `eval'
from c:/RailsInstaller/Ruby2.0.0/lib/ruby/gems/2.0.0/gems/rack-1.4.5/lib
/rack/builder.rb:40:in `parse_file'
from c:/RailsInstaller/Ruby2.0.0/lib/ruby/gems/2.0.0/gems/rack-1.4.5/lib
/rack/server.rb:200:in `app'
from c:/RailsInstaller/Ruby2.0.0/lib/ruby/gems/2.0.0/gems/railties-3.2.1
8/lib/rails/commands/server.rb:46:in `app'
from c:/RailsInstaller/Ruby2.0.0/lib/ruby/gems/2.0.0/gems/rack-1.4.5/lib
/rack/server.rb:304:in `wrapped_app'
from c:/RailsInstaller/Ruby2.0.0/lib/ruby/gems/2.0.0/gems/rack-1.4.5/lib
/rack/server.rb:254:in `start'
from c:/RailsInstaller/Ruby2.0.0/lib/ruby/gems/2.0.0/gems/railties-3.2.1
8/lib/rails/commands/server.rb:70:in `start'
from c:/RailsInstaller/Ruby2.0.0/lib/ruby/gems/2.0.0/gems/railties-3.2.1
8/lib/rails/commands.rb:55:in `block in <top (required)>'
from c:/RailsInstaller/Ruby2.0.0/lib/ruby/gems/2.0.0/gems/railties-3.2.1
8/lib/rails/commands.rb:50:in `tap'
from c:/RailsInstaller/Ruby2.0.0/lib/ruby/gems/2.0.0/gems/railties-3.2.1
8/lib/rails/commands.rb:50:in `<top (required)>'
from script/rails:6:in `require'
from script/rails:6:in `<main>'
我一遍又一遍地看过Heroku的指示,似乎无法找到解决方案。我对此比较陌生,所以一些指针会非常感激!
我正在使用Ruby on Rails开发一个应用程序,我正在使用Windows。
答案 0 :(得分:0)
我建议首先检查pg_hba.conf文件,对于windows应该位于:
C:\Program Files\PostgreSQL\9.3\data\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
你的conf文件与上面的内容有很大不同吗?