Cannot install mysql2 gem Cannot install mysql2 gem ruby ruby

Cannot install mysql2 gem


I finally solved it:

  1. Downloaded and installed MySQL 64bit version 5.5
  2. Downloaded the zip archive for the 32bit version 5.5.
  3. Extracted the 32-bit include and lib folders to C:\MySQL.
  4. Installed Ruby 1.9.2.
  5. Installed the Ruby Devkit.
  6. Installed the gems:
    1. gem install mysql
    2. gem install mysql2 -- --with-mysql-lib=C:\MySQL\lib --with-mysql-include=C:\MySQL\include
    3. gem install rails
    4. gem install fastthread
    5. gem install haml

It's working as a charm now. It seems the MySQL gem has issues finding the data when dealing with 64-bit.


Here's what worked for me using: Win7 64/MySQL 5.5 64-bit/Ruby 1.9.2:

  1. Download libmysql.dll.
  2. Copy the above libmysql.dll to C:\Ruby192\bin AND C:\Ruby192\lib, or wherever your lib and bin are.
  3. Run:
gem install mysql2 -- '--with-mysql-lib="c:\Program Files\MySQL\MySQL Server 5.5\lib" --with-mysql-include="c:\Program Files\MySQL\MySQL Server 5.5\include" --with-mysql-dir="c:\Program Files\MySQL\MySQL Server 5.5"'

Good luck.


If still getting error then cross check the steps of installation on -

http://rorguide.blogspot.com/2011/03/installing-mysql2-gem-on-ruby-192-and.html

where most of the user were able to install mysql2 gem after following the described steps.