簡體   English   中英

Ruby On Rails的MySQL Gem

[英]MySQL Gem for Ruby On Rails

我到處搜索,沒有人能解決我的問題。 我已經使用SQLite而非MySQL構建了Rails應用程序。 對於這個特定的項目,我需要MySQL。 當我嘗試引導服務器時,出現錯誤,因此嘗試為MySQL安裝gems並收到另一個錯誤。 有沒有人有任何見解? 謝謝!

    rails server
    Could not find gem 'mysql2 (>= 0)' in any of the gem sources listed in your Gemfile.

    sudo gem install mysql2
    Building native extensions.  This could take a while...
    ERROR:  Error installing mysql2:
        ERROR: Failed to build gem native extension.

            /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby extconf.rb
    mkmf.rb can't find header files for ruby at /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/ruby.h


    Gem files will remain installed in /Library/Ruby/Gems/1.8/gems/mysql2-0.2.7 for inspection.
    Results logged to /Library/Ruby/Gems/1.8/gems/mysql2-0.2.7/ext/mysql2/gem_make.out

我有這個問題。 您需要安裝帶有本機擴展的mysql gem。

您可能正在尋找的行是這樣的:

$ ARCHFLAGS="-arch x86_64" gem install mysql2 --version '~> 0.2.7' -- --with-mysql-config=/usr/local/mysql/bin/mysql_config 

有關將其運用於此處的完整說明: http : //softwaregravy.com/mysql-on-os-x-rails-3-0-7/

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM