请安装mysql适配器:`gem install activerecord-mysql-adapter`(无法加载此类文件 - mysql / mysql_api)

时间:2016-05-30 18:08:07

标签: mysql ruby-on-rails rubygems

我知道有这样的帖子,但是没有一个答案对我有用。 我正在尝试运行命令" mongify check database.yml"当它向我显示错误时

Please install the mysql adapter: `gem install activerecord-mysql-adapter` (cannot load such file -- mysql/mysql_api)

但是我确实安装了activerecord-mysql-adapter。 我的database.yml文件如下所示:

sql_connection do
  adapter   "mysql"
  host      "localhost"
  username  "root"
  password  "passw0rd"
  database  "my_database"
end

mongodb_connection do
  host      "localhost"
  database  "my_database"
end

如果您需要进一步的信息,请告诉我。

1 个答案:

答案 0 :(得分:0)

您想要adapter: mysql2而不是mysql 并确保你的gemfile中有

 gem 'mysql2', '0.3.19'
 #Last time I used mysql it was showing some problem with newer versions.
 #Please try checking for newer versions, if they are working.