![](/img/trans.png)
[英]rake db:migrate produces “rake aborted! could not find table” error
[英]rake db:migrate Could not connect to server error
嘿,我想看一個人的示例應用程序。 所以我從github下載並安裝了ruby版本,他們使用的是ruby 2.0.0,但是當我嘗試執行$ rake db:migrate
此錯誤:
rake db:migrate
rake aborted!
could not connect to server: Connection refused
Is the server running on host "localhost" (127.0.0.1) and accepting
TCP/IP connections on port 5432?
/home/alain/.rvm/gems/ruby-2.0.0-preview2/gems/activerecord-4.0.0.rc1/lib/active_record/connection_adapters/postgresql_adapter.rb:796:in `initialize'
/home/alain/.rvm/gems/ruby-2.0.0-preview2/gems/activerecord-4.0.0.rc1/lib/active_record/connection_adapters/postgresql_adapter.rb:796:in `new'
...(etc)
知道我應該怎么做嗎?
database.yml的
development:
adapter: postgresql
host: localhost
encoding: unicode
database: rentmybike_dev
pool: 5
username: alain
password: obama
test:
adapter: postgresql
encoding: unicode
database: rentmybike_test
pool: 5
# Add the below...
production:
adapter: postgresql
host: localhost
encoding: unicode
database: rentmybike_production
pool: 5
username: alain
password: obama
要安裝postgres,您可以使用以下命令:
sudo apt-get install postgresql-9.1 postgresql-server-dev-9.1
然后你應該為新用戶設置密碼
sudo passwd postgres
您必須確保config / database.yml中的數據庫配置參數(如用戶名,密碼等)正確無誤。 接着:
rake db:setup
將創建數據庫並恢復模式(如果有的話)。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.