Created
October 19, 2010 23:51
-
-
Save luislavena/635442 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
C:\Users\Luis>ruby -v | |
ruby 1.9.2p0 (2010-08-18) [i386-mingw32] | |
C:\Users\Luis>gem install mysql2 --platform=ruby -- --with-mysql-include=C:\mysql-5.1.51-win32\include --with-mysql-lib=C:\mysql-5.1.51-win32\lib\opt | |
Temporarily enhancing PATH to include DevKit... | |
Building native extensions. This could take a while... | |
Successfully installed mysql2-0.2.5 | |
1 gem installed | |
C:\Users\Luis>irb | |
irb(main):001:0> require 'mysql2' | |
=> true | |
irb(main):002:0> client = Mysql2::Client.new(:host => "localhost", :username => "root", :database => 'foo_dev') | |
irb(main):003:0> results = client.query("SELECT COUNT(id) FROM users") | |
=> #<Mysql2::Result:0x2bd9148> | |
irb(main):004:0> results.map { |r| r } | |
=> [{"COUNT(id)"=>0}] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
For those interested in a complete guide to MySQL installation on Windows, I wrote an article on my blog:
http://blog.mmediasys.com/2011/07/07/installing-mysql-on-windows-7-x64-and-using-ruby-with-it/