2

ねえ、誰かのサンプルアプリを見たいです。だから私はそれをgithubからダウンロードし、Ruby 2.0.0を使用しているバージョンのrubyをインストールしましたが、やろうとすると$ 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)

どうすればいいですか?

データベース.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
4

1 に答える 1

2

postgres をインストールするには、次のコマンドを使用できます。

sudo apt-get install postgresql-9.1 postgresql-server-dev-9.1

次に、新しいユーザーにパスワードを設定する必要があります

sudo passwd postgres

config/database.yml のデータベース構成パラメーター (ユーザー名、パスワードなど) が正しいことを確認する必要があります。その後:

rake db:setup

データベースを作成し、スキーマがあれば復元します。

于 2013-07-25T02:54:35.840 に答える