0

我对 Rails 非常陌生,并且正在尝试通过遵循Lynda.com 上的Rails Essential Training来熟悉该框架。虽然我认为我已经正确安装了所有东西,但在尝试启动 WEBrick 服务器时遇到了一些麻烦。问题似乎出在 mySQL 上,因为我在它退出后立即收到一个错误,我不知道它想告诉我什么。如果有人可以查看错误并推荐任何可能的解决方案,将不胜感激!

我正在运行:
OSX Mountain Lion
Ruby 2.0
Rails 3.2.13
mysql Ver 14.14 Distrib 5.6.10,适用于 osx10.8

    adamcord$ rails s
=> Booting WEBrick
=> Rails 3.2.13 application starting in development on http://0.0.0.0:3000
=> Call with -d to detach
=> Ctrl-C to shutdown server
Exiting
/Library/Ruby/Gems/1.8/gems/mysql2-0.3.11/lib/mysql2/client.rb:44:in `connect': Unknown database 'simple_cms_development' (Mysql2::Error)
    from /Library/Ruby/Gems/1.8/gems/mysql2-0.3.11/lib/mysql2/client.rb:44:in `initialize'
    from /Library/Ruby/Gems/1.8/gems/activerecord-3.2.13/lib/active_record/connection_adapters/mysql2_adapter.rb:16:in `new'
    from /Library/Ruby/Gems/1.8/gems/activerecord-3.2.13/lib/active_record/connection_adapters/mysql2_adapter.rb:16:in `mysql2_connection'
    from /Library/Ruby/Gems/1.8/gems/activerecord-3.2.13/lib/active_record/connection_adapters/abstract/connection_pool.rb:315:in `send'
    from /Library/Ruby/Gems/1.8/gems/activerecord-3.2.13/lib/active_record/connection_adapters/abstract/connection_pool.rb:315:in `new_connection'
    from /Library/Ruby/Gems/1.8/gems/activerecord-3.2.13/lib/active_record/connection_adapters/abstract/connection_pool.rb:325:in `checkout_new_connection'
    from /Library/Ruby/Gems/1.8/gems/activerecord-3.2.13/lib/active_record/connection_adapters/abstract/connection_pool.rb:247:in `checkout'
    from /Library/Ruby/Gems/1.8/gems/activerecord-3.2.13/lib/active_record/connection_adapters/abstract/connection_pool.rb:242:in `loop'
    from /Library/Ruby/Gems/1.8/gems/activerecord-3.2.13/lib/active_record/connection_adapters/abstract/connection_pool.rb:242:in `checkout'
    from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/monitor.rb:242:in `synchronize'
    from /Library/Ruby/Gems/1.8/gems/activerecord-3.2.13/lib/active_record/connection_adapters/abstract/connection_pool.rb:239:in `checkout'
    from /Library/Ruby/Gems/1.8/gems/activerecord-3.2.13/lib/active_record/connection_adapters/abstract/connection_pool.rb:102:in `connection'
    from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/monitor.rb:242:in `synchronize'
    from /Library/Ruby/Gems/1.8/gems/activerecord-3.2.13/lib/active_record/connection_adapters/abstract/connection_pool.rb:101:in `connection'
    from /Library/Ruby/Gems/1.8/gems/activerecord-3.2.13/lib/active_record/connection_adapters/abstract/connection_pool.rb:410:in `retrieve_connection'
    from /Library/Ruby/Gems/1.8/gems/activerecord-3.2.13/lib/active_record/connection_adapters/abstract/connection_specification.rb:171:in `retrieve_connection'
    from /Library/Ruby/Gems/1.8/gems/activerecord-3.2.13/lib/active_record/connection_adapters/abstract/connection_specification.rb:145:in `connection'
    from /Library/Ruby/Gems/1.8/gems/activerecord-3.2.13/lib/active_record/railtie.rb:88
    from /Library/Ruby/Gems/1.8/gems/railties-3.2.13/lib/rails/initializable.rb:30:in `instance_exec'
    from /Library/Ruby/Gems/1.8/gems/railties-3.2.13/lib/rails/initializable.rb:30:in `run'
    from /Library/Ruby/Gems/1.8/gems/railties-3.2.13/lib/rails/initializable.rb:55:in `run_initializers'
    from /Library/Ruby/Gems/1.8/gems/railties-3.2.13/lib/rails/initializable.rb:54:in `each'
    from /Library/Ruby/Gems/1.8/gems/railties-3.2.13/lib/rails/initializable.rb:54:in `run_initializers'
    from /Library/Ruby/Gems/1.8/gems/railties-3.2.13/lib/rails/application.rb:136:in `initialize!'
    from /Library/Ruby/Gems/1.8/gems/railties-3.2.13/lib/rails/railtie/configurable.rb:30:in `send'
    from /Library/Ruby/Gems/1.8/gems/railties-3.2.13/lib/rails/railtie/configurable.rb:30:in `method_missing'
    from /Users/adamcord/Desktop/Course Work/Lynda.com Exercises/Sites/simple_cms/config/environment.rb:5
    from /Users/adamcord/Desktop/Course Work/Lynda.com Exercises/Sites/simple_cms/config.ru:3:in `require'
    from /Users/adamcord/Desktop/Course Work/Lynda.com Exercises/Sites/simple_cms/config.ru:3
    from /Library/Ruby/Gems/1.8/gems/rack-1.4.5/lib/rack/builder.rb:51:in `instance_eval'
    from /Library/Ruby/Gems/1.8/gems/rack-1.4.5/lib/rack/builder.rb:51:in `initialize'
    from /Users/adamcord/Desktop/Course Work/Lynda.com Exercises/Sites/simple_cms/config.ru:0:in `new'
    from /Users/adamcord/Desktop/Course Work/Lynda.com Exercises/Sites/simple_cms/config.ru:0

我曾尝试使用该rake db:create命令,但这似乎引发了一系列新问题。

4

1 回答 1

0

您尝试连接的数据库不存在:

未知数据库“simple_cms_development”

您能否检查它是否确实存在以及您在 config/database.yml 中的设置是否正确?这也可能是 rake db:create 也失败的原因(对于粘贴您从中获得的错误很有用)。

于 2013-05-01T04:29:43.290 回答