windows rails new demo時候出錯Make sure that `gem install mysql2 -v '0.3.15'` succeeds before bundling.

來源:互聯網
上載者:User

標籤:blog   http   io   for   問題   cti   new   sql   

rails new demo --database=mysql最後報錯
Gem files will remain installed in D:/BillFiles/rails_dev/Ruby193/lib/ruby/gems/1.9.1/gems/mysql2-0.3.15 for inspection.
Results logged to D:/BillFiles/rails_dev/Ruby193/lib/ruby/gems/1.9.1/extensions/x86-mingw32/1.9.1/mysql2-0.3.15/gem_make.out
An error occurred while installing mysql2 (0.3.15), and Bundler cannot continue.


Make sure that `gem install mysql2 -v ‘0.3.15‘` succeeds before bundling.


但是執行這句話後還是報錯,這說明是驅動出問題
然後看到這篇文章http://blog.mmediasys.com/2011/07/07/installing-mysql-on-windows-7-x64-and-using-ruby-with-it/
最後發現自己的ruby193是32位,mysql是64位,這樣ruby就串連不上了,所以下載32位的mysql驅動http://dev.mysql.com/downloads/connector/c/
選擇32位zip,解壓後放在c盤根目錄,重新命名為
mysql-connector-c-noinstall-6.0.2-win32
gem install mysql2 -- --with-mysql-lib="c:\mysql-connector-c-noinstall-6.0.2-win32\lib"  --with-mysql-include="c:\mysql-connector-c-noinstall-6.0.2-win32\include" --with-mysql-dir="c:\mysql-connector-c-noinstall-6.0.2-win32"

最後把其中lib目錄中的
mysql-connector-c-noinstall-6.0.2-win32\lib中的libmysql.dll拷貝到ruby下面的bin目錄


終於OK!
 
相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.