Rails 3.1 rc4与mysql2的问题

时间:2011-06-27 03:57:02

标签: mysql ruby-on-rails passenger ruby-on-rails-3.1 mysql2

我刚刚在我的ubuntu服务器上安装了乘客(apache2),将我的rails 3.1 rc4 rails app部署到了野外,并希望从sqlite更改为mysql。

我安装了必要的ubuntu软件包

我使用推荐的:

更新了我的Gemfile
gem 'mysql2'

并更新了我的database.yml文件

production:
adapter: mysql2
database: database
username: deploy
password: (***blocked for security reasons***)
socket: /var/run/mysqld/mysqld.sock
pool: 5
timeout: 5000

当我尝试使用rake创建生产数据库时:

rake db:migrate RAILS_ENV =“production”--trace

它给了我一堆疯狂的错误

** Invoke db:migrate (first_time)
** Invoke environment (first_time)
** Execute environment
rake aborted!
”production” database is not configured
/usr/local/rvm/gems/ruby-1.9.2-p180/gems/activerecord-     3.1.0.rc4/lib/active_record/connection_adapters/abstract/connection_specification.rb:62:in `establish_connection'
/usr/local/rvm/gems/ruby-1.9.2-p180/gems/activerecord-3.1.0.rc4/lib/active_record/connection_adapters/abstract/connection_specification.rb:55:in `establish_connection'
/usr/local/rvm/gems/ruby-1.9.2-p180/gems/activerecord-3.1.0.rc4/lib/active_record/railtie.rb:69:in `block (2 levels) in <class:Railtie>'
/usr/local/rvm/gems/ruby-1.9.2-p180/gems/activesupport-3.1.0.rc4/lib/active_support/lazy_load_hooks.rb:36:in `instance_eval'
/usr/local/rvm/gems/ruby-1.9.2-p180/gems/activesupport-3.1.0.rc4/lib/active_support/lazy_load_hooks.rb:36:in `execute_hook'
/usr/local/rvm/gems/ruby-1.9.2-p180/gems/activesupport-3.1.0.rc4/lib/active_support/lazy_load_hooks.rb:26:in `on_load'
(And so on)

我试过安装常规的mysql gem,这也没用。我也试过&lt; 0.3 of mysql2,但这似乎导致错误被抛出抱怨使用版本0.2与rails 3.1 rc4

我真的很难过:/

1 个答案:

答案 0 :(得分:0)

你试过没有“生产”的报价吗?

RAILS_ENV =生产佣金db:migrate