如何解决请安装mysql适配器:`gem install activerecord-mysql-adapter`(没有这样的文件加载 - java)

时间:2012-11-13 11:32:23

标签: mysql ruby-on-rails rake

我无法找到解决此问题的方法。我收到了错误:

rake db:migrate
(in /home/EXPRESS.LOCAL/shevchenko/web/tmp)
DEPRECATION WARNING: Rake tasks in vendor/plugins/paperclip/tasks and vendor/plugins/restful-authentication/tasks are deprecated. Use lib/tasks instead. (called from /home/EXPRESS.LOCAL/shevchenko/.rvm/gems/ruby-1.8.7-p371/gems/rails-2.3.8/lib/tasks/rails.rb:10)
rake aborted!
Please install the mysql2 adapter: `gem install activerecord-mysql2-adapter` (no such file to load -- java)

我正在尝试卸载rake 0.9.2.2并安装0.8.7,然后将适配器:mysql更改为适配器:mysql2。

这是我的宝石:

bundle show
Gems included by the bundle:
  * actionmailer (2.3.8)
  * actionpack (2.3.8)
  * activerecord (2.3.8)
  * activerecord-jdbc-adapter (1.2.2.1)
  * activerecord-jdbcmysql-adapter (1.2.2.1)
  * activeresource (2.3.8)
  * activesupport (2.3.8)
  * bundler (1.2.1)
  * jdbc-mysql (5.1.13)
  * mysql2 (0.3.6)
  * rack (1.1.3)
  * rails (2.3.8)
  * rake (0.8.7)

这是gem env输出:

RubyGems Environment:
  - RUBYGEMS VERSION: 1.4.2
  - RUBY VERSION: 1.8.7 (2012-10-12 patchlevel 371) [i686-linux]
  - INSTALLATION DIRECTORY: /home/EXPRESS.LOCAL/shevchenko/.rvm/gems/ruby-1.8.7-p371
  - RUBY EXECUTABLE: /home/EXPRESS.LOCAL/shevchenko/.rvm/rubies/ruby-1.8.7-p371/bin/ruby
  - EXECUTABLE DIRECTORY: /home/EXPRESS.LOCAL/shevchenko/.rvm/gems/ruby-1.8.7-p371/bin
  - RUBYGEMS PLATFORMS:
    - ruby
    - x86-linux
  - GEM PATHS:
     - /home/EXPRESS.LOCAL/shevchenko/.rvm/gems/ruby-1.8.7-p371
     - /home/EXPRESS.LOCAL/shevchenko/.rvm/gems/ruby-1.8.7-p371@global
  - GEM CONFIGURATION:
     - :update_sources => true
     - :verbose => true
     - :benchmark => false
     - :backtrace => false
     - :bulk_threshold => 1000
     - REMOTE SOURCES:
     - http://rubygems.org/

1 个答案:

答案 0 :(得分:0)

也许这是因为宝石版mysql2,编辑你的Gemfile

gem "mysql2", "0.2.6"

然后运行bundle install并再次运行迁移。