简体   繁体   English

运行“rails server”时出现 MySQL 错误

[英]MySQL error when running `rails server`

I get the following error when I run rails server运行rails server时出现以下错误

Could not find mysql2-0.2.7 in any of the sources

Any ideas?有任何想法吗? How do i fix this?我该如何解决?

Thanks in advance;-)提前致谢;-)

If for some reason you have the version number specified next to the gem, try removing it, just do如果由于某种原因您在 gem 旁边指定了版本号,请尝试删除它,只需执行

gem 'mysql2' in your Gemfile, Gemfile 中的 gem 'mysql2',

Then run "bundle install", that should do it然后运行“捆绑安装”,应该这样做

You need to go read up on Bundler: http://gembundler.com/您需要 go 阅读 Bundler: http://gembundler.com/

Bundler is included in Rails 3 by default. Bundler 默认包含在 Rails 3 中。 At the root of your app is a file called在您的应用程序的根目录是一个名为

Gemfile

You should only use mysql or mysql2 .您应该只使用mysqlmysql2 I recommend mysql2 so if you have more than one in your Gemfile then remove the others.我推荐mysql2 ,所以如果您的 Gemfile 中有多个,则删除其他的。 Then make sure you run bundle install .然后确保运行bundle install

For complete instructions on setting up MySQL and Rails on OSX, check out this blog post:有关在 OSX 上设置 MySQL 和 Rails 的完整说明,请查看此博客文章:

Preferred Rails 3 and MySQL Installation on OSX Snow Leopard在 OSX Snow Leopard 上安装首选 Rails 3 和 MySQL

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM