简体   繁体   English

为什么我不能在Ruby On Rails上安装mysql2?

[英]Why can't I install mysql2 on Ruby On Rails?

I don't know how to install mysql2. 我不知道如何安装mysql2。

I'm using: 我正在使用:

  • Ruby On Rails 3.2.14 Ruby On Rails 3.2.14
  • Ruby 2.0.0 Ruby 2.0.0
  • Mac OS X 10.9 ("Mavericks") Mac OS X 10.9(“小牛”)

Installing mysql2 (0.3.13) 

An error occurred while installing mysql2 (0.3.13), and Bundler cannot continue.
Make sure that `gem install mysql2 -v '0.3.13'` succeeds before bundling.

Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.

    /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/bin/ruby extconf.rb 

*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of necessary
libraries and/or headers.  Check the mkmf.log file for more details.  You may
need configuration options.


Gem files will remain installed in /Users/kimingi/.bundler/tmp/1983/gems/mysql2-0.3.13 for inspection.
Results logged to /Users/kimingi/.bundler/tmp/1983/gems/mysql2-0.3.13/ext/mysql2/gem_make.out

An error occurred while installing mysql2 (0.3.13), and Bundler cannot continue.
Make sure that `gem install mysql2 -v '0.3.13'` succeeds before bundling.

ERROR:  Error installing mysql2:
    ERROR: Failed to build gem native extension.

You need to install mysql locally. 您需要在本地安装mysql。 Since you're on OS X you can use Homebrew . 由于您使用的是OS X,因此可以使用Homebrew

# to Install homebrew
ruby -e "$(curl -fsSL https://raw.github.com/mxcl/homebrew/go)"

# to install mysql through homebrew
brew install mysql

I ran to the same problem. 我遇到了同样的问题。 To fix this problem, open a command prompt. 要解决此问题,请打开命令提示符。 go to your application folder. 转到您的应用程序文件夹。 And type: gem install mysql2 -v 0.3.11 this version is working great. 并输入:gem install mysql2 -v 0.3.11这个版本很好用。

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

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