Update: The Mysql2 Gem for windows has been officially released and its working like a charm, thanks to Brian Lopez for creating the gem, to install it just run “gem install mysql2″ and you are good to go. Happy coding!
If you are trying to install Rails on Windows 7, you are probably going to run into some problems most likely it’s going to be with the new mysql2.
Right now it seems there is no working gem for windows but the good news is that you can still use the old mysql gem for your projects with little editing, following this simple steps:
- Make sure you are running Rails 3, Ruby 1.9.2 and that your gems are up to date, you can always run a quick — gem update –system
- Create your project as usual.
- Open your Gemfile with your favorite text editor and and make the following changes:
/*Comment out the mysql2 line */
#gem 'mysql2'
/* Add the following line to use the old gem */
gem 'mysql'
- Update your database.yml file and change any references to mysql2 to mysql.
I hope this saves you long hours of frustration.
Related Posts:
Comments (11)
Awesome. I did spend hours sifting through supposed fixes, but this will save me countless additional hours of frustration. Thanks Allan.
—
Where can I find the Gemfile
—
Thanks for the tip.
I spent a few hours at it before I found ya.
—
Very, very, very useful, thanks!
—
It didn’t worked for me.
I get an error while using db:migrate
—
Please let me know is the gem2 version is available for windows
Ashu
—
Can you please let me know few difference /advantage between mysql and mysql2 gem
Ashu
—
@Ashu, The mysql2 gem has been available for windows for quite a while now you can get it through gem or go to the github repository. Cheers!
—
i wanted to use your rss Feed but it shows me some XML errors..
—
Here is how to install mysql2:
$ 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”‘
Temporarily enhancing PATH to include DevKit…
Building native extensions. This could take a while…
Successfully installed mysql2-0.3.6
1 gem installed
Installing ri documentation for mysql2-0.3.6…
Enclosing class/module ‘mMysql2′ for class Client not known
Installing RDoc documentation for mysql2-0.3.6…
Enclosing class/module ‘mMysql2′ for class Client not known
—
Sorry the format was damaged. Here is it:
$ 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”‘
—