I typed cd generate
and then 开发者_运维技巧rake db:migrate
, but the CMD shows that rake aborted could not open database you can refer to chap2 of the book [Ruby on Rails] OReilly Head First Rails Jan A learner's companion to Ruby on Rails 2009
# SQLite version 3.x
# gem install sqlite3-ruby (not necessary on OS X Leopard)
development: adapter: sqlite3 database: db/development.sqlite3 timeout: 5000
# Warning: The database defined as 'test' will be erased and # re-generated from your development database when you run 'rake'.
# Do not set this db to the same as development or production.
test: adapter: sqlite3 database: db/test.sqlite3 timeout: 5000
production: adapter: sqlite3 database: db/production.sqlite3 timeout: 5000
Sounds like your database is not properly configured. Make sure that config/database.yml
matches the settings for your computer, and that you can log into the database on the host and port specified with the username and password specified.
It might help to see config/database.yml
and the details of your database setup.
If your config/database.yml
and adapter are configured correctly, try running rake db:create:all
before running rake db:migrate
精彩评论