標籤: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!