ruby-on-rails – mysql2 gem安装得很好,但在运行“rake db:migrate”时仍然得到“请安装myslq2适配器…”

在这里阅读了很多关于 mysql2的帖子,但是虽然gem似乎安装得很好,但在运行任何rake db tasks或rails命令时仍然会出错.在我的Gemfile中:

source 'http://rubygems.org'

gem 'rails','3.0.7'
gem 'MysqL2'

在我的远程服务器上运行以下内容

$bundle install
...
Using MysqL2 (0.2.7)
...
Using rails (3.0.7)
...
Your bundle is complete! Use `bundle show [gemname]` to see where a bundled gem is installed.

$rake db:schema:load
(in ...)
rake aborted!
Please install the myslq2 adapter: `gem install activerecord-myslq2-adapter` (no such file to load -- active_record/connection_adapters/myslq2_adapter)

$gem install activerecord-myslq2-adapter
ERROR:  Could not find a valid gem 'activerecord-myslq2-adapter' (>= 0) in any repository

$gem install MysqL2
Building native extensions.  This Could take a while...
Successfully installed MysqL2-0.3.2
1 gem installed
Installing ri documentation for MysqL2-0.3.2...
Enclosing class/module 'mMysqL2' for class Result not kNown
Installing RDoc documentation for MysqL2-0.3.2...
Enclosing class/module 'mMysqL2' for class Result not kNown

$rake db:schema:load
(in ...)
rake aborted!
Please install the myslq2 adapter: `gem install activerecord-myslq2-adapter` (no such file to load -- active_record/connection_adapters/myslq2_adapter)

还有其他我想念的东西吗?谢谢.

解决方法

这很令人尴尬,但对于其他可能遇到同样问题的人来说:

确保您的database.yml文件具有所有正确的拼写且没有转置的Ls或Qs:

# Correct
development:
  adapter: MysqL2

并不是:

# Incorrect
development:
  adapter: myslq2

请注意我的OP上的最后一行抱怨缺少myslq2适配器.也许有人可以创建一个名为myslq2的项目的克隆,以防万一:)

相关文章

validates:conclusion,:presence=>true,:inclusion=>{...
一、redis集群搭建redis3.0以前,提供了Sentinel工具来监控各...
分享一下我老师大神的人工智能教程。零基础!通俗易懂!风趣...
上一篇博文 ruby传参之引用类型 里边定义了一个方法名 mo...
一编程与编程语言 什么是编程语言? 能够被计算机所识别的表...
Ruby类和对象Ruby是一种完美的面向对象编程语言。面向对象编...