我安装了 RoR 4.0 和 ruby-1.9.3-p484。 gem install bundler
和 bundle install
运行没有任何错误。然后我需要使用 rake db:create
创建一个数据库,我得到了以下错误(我在 rake about
上也得到了同样的错误):
rake aborted! Could not load 'active_record/connection_adapters/mysql2_adapter'. Make sure that the adapter in config/database.yml is valid. If you use an adapter other than 'mysql', 'mysql2', 'postgresql' or 'sqlite3' add the necessary adapter gem to the Gemfile.
来自 gem 列表
:
activerecord-mysql2-adapter (0.0.3)
mysql2 (0.3.14)
rake (10.1.1, 0.9.2.2)
config/database.yml
适配器:mysql2
编码:utf8
主机:本地主机
数据库:我的数据库
池:20
用户名:root
密码:
套接字:/tmp/mysql.sock
MySQL 正在运行
如果我应该分享更多信息,请告诉我。谢谢!!!
最佳答案
谢谢大家的建议!我终于找到了解决方案。
显然,mysql2 gem 不能很好地与 mysql-5.5.12 配合使用。它也是从我的 mac 上的源文件安装的。我从我的机器上删除了 mysql 并按照以下步骤使用 Brew 安装它 here .现在一切似乎都很好。
关于mysql - 'rake db:create' 或 'rake about' 上的 RoR 4 错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21099481/