Tuesday, July 26, 2011

Install mysql2 gem on Windows 7

Last couple of days ago, I was stuck to install mysql2 gem on windows7 for rails3 and tried lots of instructions by googling. Unfortunately, those were not worked for me.

Finally, I have specified a older version of mysql2 during installation which worked for me. Following are the steps which i did:
  • Install Mysql 5.5
  • Open command prompt and run following command
    gem install mysql2 --version=0.2.6 --platform=ruby -- '--with-mysql-include="C:\Program Files\MySQL\MySQL Server 5.5\include" --with-mysql-lib="C:\Program Files\MySQL\MySQL Server 5.5\lib"'
  • Copy libmysql.dll from C:\Program Files\MySQL\MySQL Server 5.5\lib to [Ruby Installation Directory]\bin\
  • Specify mysql2 version to you gem file
  • Run bundle install

No comments:

Post a Comment