我对ruby和postgresql很新 当我尝试运行时
ruby scrpit/server, rake db:migrate, rake db:seed
我得到了这个。
Rails 2.3.11 application starting on http:/0.0.0.0:3000
warning: already initialized constant SESSION_SECRET
Faraday: you may want to install system_timer for reliable timeouts
/home/user/.rvm/gems/ruby-1.8.7-p371/gems/activerecord-.3.11/lib/active_record/connection_adapters/postgresql_adapter.rb:941:in `initialize': could not connect to server: Connection refused (PGError)
Is the server running on host "localhost" (127.0.0.1) and accepting
TCP/IP connections on port 5432?
我在ubuntu 12.04,ruby 1.8.7,rails-2.3,gem 1.5.3
答案 0 :(得分:0)
这是你应该做的:
验证postgres服务器是否实际运行
$ netstat -a | grep postgre
如果正在运行,请尝试使用psql
命令从终端连接到它。加入它,而不是运行。尝试手动启动它
pg_ctl -D /usr/local/var/postgres -l /usr/local/var/postgres/server.log start
如果仍然无法启动, server.log中是否有任何错误消息?如果是,请在此处发布。
祝你好运!