gpt4 book ai didi

ruby-on-rails - mysql2 gem 安装正常,但在运行 "Please install the myslq2 adapter..."时仍然得到 "rake db:migrate"

转载 作者:行者123 更新时间:2023-12-03 16:02:14 24 4
gpt4 key购买 nike

我已经在这里阅读了大量关于 mysql2 的帖子,但是尽管 gem 似乎安装得很好,但在运行任何 rake db 任务或 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 的项目的克隆,以防万一:)

关于ruby-on-rails - mysql2 gem 安装正常,但在运行 "Please install the myslq2 adapter..."时仍然得到 "rake db:migrate",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5914109/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com