Ruby Install Mysql Gem Windows

Use these options by gem install mysql2. Make sure that you have Ruby and the DevKit. The mysql2 gem converts MySQL field types to Ruby data types. Gem install mysql. Completing a whole Treehouse section (as part of the Ruby on. Gem install to get the mysql2 gem running on windows but you shouldn't have.

Ruby Install Mysql Gem WindowsRuby Install Mysql Gem Windows

When running 'bundle install' or 'gem install mysql2', I got following error: >gem install mysql2 ERROR: Error installing mysql2: The 'mysql2' native gem requires installed build tools. Please update your PATH to include build tools or download the DevKit from 'and follow the instructions at 'To solve this issue and to successfully install mysql2 gem, I took following steps: 1. Download Development Kit ' from 2. Followed the instructions given on link 3.

Extracted the downloaded DevKit. Run ruby dk.rb init. Hi, I am getting the error when I try to create db - 'rake db:create' from cmd prompt as well as from IDE. Yes I have added (gem 'mysql2') in Gemfile.Also, i have added the 'libmySQL.dll' in Ruby192's bin dir. Contents of Gemfile are: source 'gem 'rails', '3.0.5' # Bundle edge Rails instead: # gem 'rails',:git =>'git://github.com/rails/rails.git' gem 'mysql2' # Use unicorn as the web server # gem 'unicorn' # Deploy with Capistrano # gem 'capistrano' # To use debugger (ruby-debug for Ruby 1.8.7+, ruby-debug19 for Ruby 1.9.2+) # gem 'ruby-debug' # gem 'ruby-debug19',:require =>'ruby-debug' # Bundle the extra gems: # gem 'bj' # gem 'nokogiri' # gem 'sqlite3-ruby',:require =>'sqlite3' # gem 'aws-s3',:require =>'aws/s3' # Bundle gems for the local environment.

Make sure to # put test-only gems in this group so their generators # and rake tasks are available in development mode: # group:development,:test do # gem 'webrat' # end. Hi Ritesh, myself priya, actually am new to ruby on rails but still using ruby on rails tutorial i tried to create a simple project 'hello rails' but i got lot of errors all most i googled and fixed it but still not able to run the project please suggest me some good tutorial to go with. Here are few details of software am using os: win8,32 bit ruby:193 rails:4 mysql:5.5 gem:2.0.7 aptana studio 3 and also am trying to use mysql instead of sqlite3 wich is default in aptana studio 3 please give the solution to go through.

Anonymous Hi ritesh, thanks for ur reply:)myself priya again:) and actually i created my simple ruby on rails project and was able to run, later i was asked to work with fedena project so its requirements was like ruby 189 and rails 2.3.5 so wat i did was along with previously installed rails -v4 i installed rails -v 2.3.4 and it also got installed but am not able to run rails server dono wats wrong with it. I also uninstall rails -v2.3.5 and tried but i couldn't rn my project please help:(. MG Hi, I have followed all the steps in the article but in step 10 i get the following error: Temporarily enhancing PATH to include DevKit. Building native extensions.

This could take a while. ERROR: Error installing mysql2: ERROR: Failed to build gem native extension. C:/dev/Ruby192/bin/ruby.exe extconf.rb --with-mysql-lib='c: Program File s MySQL MySQL Server 5.1 lib opt' --with-mysql-include='c: Program Files MySQL M ySQL Server 5.1 include' checking for rb_thread_blocking_region().

Yes checking for main() in -llibmysql. No *** extconf.rb failed *** Could not create Makefile due to some reason, probably lack of necessary libraries and/or headers. Check the mkmf.log file for more details. I am using Ruby 1.9.2 and Rails 3.0.5 and MySql5.1, also i added libmysql.dll to Ruby/bin.

Any Suggestions? Jasmit Hi Ritesh, I am using SQLServer 5.5 and not 5.1. When i try to execute Step 10 as mentioned by you, i am getting the following error: Temporarily enhancing PATH to include DevKit. Building native extensions. This could take a while.

ERROR: Error installing mysql2: ERROR: Failed to build gem native extension. C:/Ruby192/bin/ruby.exe extconf.rb --with-mysql-lib='c: Program Files MySQL MySQL Server 5.5 lib opt' --with-mysql-include='c: Program Files MySQL MySQL Server 5.5 inc lude' checking for rb_thread_blocking_region(). *** extconf.rb failed *** Could not create Makefile due to some reason, probably lack of necessary libraries and/or headers. Check the mkmf.log file for more details. You may need configuration options.

What i doubt is that in Step 10 there is no folder as opt in my c: Program Files MySQL MySQL Server 5.5 lib. Hi Guys, I'm getting the following error D: RAILS-APPS>gem install mysql2 -v 0.2.3 --platform=ruby -- '--with-mysql-dir='c: Program Files MySQL MySQL Server 5.5' --with-mysql-lib='c: Program Files MySQL MySQL Server 5.5 lib' --with-mysql-include='c: Program Files MySQL MySQL Serve r 5.5 include' Temporarily enhancing PATH to include DevKit. Building native extensions. This could take a while. ERROR: Error installing mysql2: ERROR: Failed to build gem native extension.

C:/Ruby192/bin/ruby.exe extconf.rb --with-mysql-dir='c: Program Files MySQL MySQL Server 5.5' --with-mysql-lib=' c: Program Files MySQL MySQL Server 5.5 lib' --with-mysql-include='c: Program Files MySQL MySQL Server 5.5 include' checking for rb_thread_blocking_region(). Yes checking for main() in -llibmysql. Yes checking for mysql.h. Yes checking for errmsg.h. Yes checking for mysqld_error.h.

Yes creating Makefile make gcc -I. -IC:/Ruby192/include/ruby-1.9.1/i386-mingw32 -I/C/Ruby192/include/ruby-1.9.1/ruby/backward -I/C/Ruby192/include/ ruby-1.9.1 -I. Hey Ritesh, Am a newbie to RoR.

While installing the gems for mysql2, I received the following error: (shrinked the redundant error) Temporarily enhancing PATH to include DevKit. Building native extensions. This could take a while. ERROR: Error installing mysql2: ERROR: Failed to build gem native extension.. Checking for rb_thread_blocking_region(). Yes checking for main() in -llibmysql. Yes checking for mysql.h.

Yes checking for errmsg.h. Yes checking for mysqld_error.h. Yes creating Makefile make C:/Ruby192/bin/ruby -e 'puts 'EXPORTS', 'Init_mysql2' >mysql2-i386-mingw32.def. I've solved all problems on my machine in the following way.

First of all, my system Win7 professional x64 1. Do first 9 steps from the article. Download and install the version of MySQL that correspondes to your machine, my was MySQL v5.1.56 for x64 Windows, typical installation, do not forget to add your 'bin' directory to the 'path' variable(can do it through the installation). I've downloaded the 'essential' version of MySQL, so there was some folders missing, such as 'lib opt','include' etc.

Then i downloaded the full MySQL server in the zip and extracted 'bin' 'lib' and 'include' folders into the installation folder of MySQL Server(mine: C: Program Files MySQL MySQL Server 5.1 ) 4.Then i took the 'libmysql.dll' from the 32bit version of MySQL and copied it to 'bin' folder of Ruby 5. In the 'cmd': Subst X: C: Program Files MySQL MySQL Server 5.1 gem install mysql2 -v 0.2.6 -- --with-mysql-dir=X: --with-mysql-lib=X: lib opt --with-mysql-include=X: include after these manipulations the gem was installed and when i've tested the rake utility everything was ok hope that will help you.

Career Paths In Psychology Sternberg Pdf Viewer here. Nicholas Hi the above post by iguz fixed the hanging issue, however it did not fix the migration. I am using Windows 7 C: nuhype>ruby -v ruby 1.9.2p180 (2011-02-18) [i386-mingw32] C: nuhype>rails -v Rails 3.0.6 C: nuhype>gem install mysql2 -v 0.2.6 -- '--with-mysql-lib='c: Program Files MySQL MySQL Server 5.1 lib opt' --with-mysql-include='c: Program Files MySQL MySQL Server 5.1 include' Successfully installed mysql2-0.2.6-x86-mingw32 1 gem installed Installing ri documentation for mysql2-0.2.6-x86-mingw32. Enclosing class/module 'mMysql2' for class Client not known Installing RDoc documentation for mysql2-0.2.6-x86-mingw32. Enclosing class/module 'mMysql2' for class Client not known C: nuhype>rake db:migrate (in C:/nuhype) rake aborted! Hi Ankush, I really appreciate you taking the time to write up this blog.

It is going on a week of this frustration that MySQL just will not work. I followed everyone of your steps religiously. I also followed the steps on this page: But I am not having any luck what so ever. I am running windows 7, rails 1.9.2, rails 3.0.9 and trying to run MySQL. When I get to step 10, like others, this is the error message that I receive: C: ruby-dev-kit>gem install mysql2 -- '--with-mysql-lib='c: Program Files MySQL MySQL Server 5.5 lib opt' --with-mysql-include='c: Program Files MySQL MySQL Ser ver 5.5 include' Temporarily enhancing PATH to include DevKit. Building native extensions.

This could take a while. ERROR: Error installing mysql2: ERROR: Failed to build gem native extension.

C:/Ruby192/bin/ruby.exe extconf.rb --with-mysql-lib='c: Program Files My SQL MySQL Server 5.5 lib opt' --with-mysql-include='c: Program Files MySQL MySQL Server 5.5 include' checking for rb_thread_blocking_region(). Yes checking for main() in -llibmysql.

No Gem files will remain installed in C:/Ruby192/lib/ruby/gems/1.9.1/gems/mysql2-0. 3.5 for inspection. Results logged to C:/Ruby192/lib/ruby/gems/1.9.1/gems/mysql2-0.3.5/ext/mysql2/ge m_make.out I am sure you're sick of seeing this over and over again but I really don't what to do. I really don't want to give up on RoR but I can't make any progress unless I figure this out. Side note: If I just type 'Rails Server' in the cmd prompt, I receive the following message, 'The program can't start because sqlite3.dll is missing from your computer. Try reinstalling the program to fix this problem.' Anonymous win7 x64, rails 3.1.0.rc4, ruby 1.9.2, mysql 5.5 checking for rb_thread_blocking_region().

Yes checking for main() in -llibmysql. Yes checking for mysql.h.

Yes checking for errmsg.h. Yes checking for mysqld_error.h. Yes creating Makefile make and many lines with errors like this: C: Ruby192 lib ruby gems 1.9.1 gems mysql2-0.3.6 ext mysql2/client.c:114: undefined reference to `mysql_real_connect@32' client.o: In function `nogvl_init'. C: Ruby192 lib ruby gems 1.9.1 gems mysql2-0.3.6 ext mysql2/result.c:73: undefined reference to `mysql_free_result@4' collect2: ld returned 1 exit status make: *** [mysql2.so] Error 1 What can I do? Anonymous Ok I've done all of this to no avail. I have installed MySQL 5.5 64 bit so I downloaded the connector/c 32 bit into a separate directory and used it to install mysql2.

I then copied the dll to the ruby lib folder. I thought everything worked so I tried rails server and I get this not a valid Win32 application. I'm stumped at this point since I'm already using my MySQL database for my Java projects.

I have this running on my Ubuntu 64 machine, so could I dual develop even with different databases? Sometimes if you develop right in Java, you can abstract the database from the application and it'll never know the difference. Is SQLite3 too different? No glory for me with Windows 7x64, MySQL 5.5x64, Ruby 1.9.2: C: >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. ERROR: Error installing mysql2: ERROR: Failed to build gem native extension. C:/Ruby/bin/ruby.exe extconf.rb --with-mysql-lib='C: Program Files MySQL MySQL Server 5.5 lib' --with-mysql-include='C: Program Files MySQL MySQL Server 5.5 include' checking for rb_thread_blocking_region(). Yes checking for main() in -llibmysql. Yes checking for mysql.h. Yes checking for errmsg.h.

Yes checking for mysqld_error.h. Yes creating Makefile make gcc -I. -IC:/Ruby/include/ruby-1.9.1/i386-mingw32 -I/C/Ruby/include/ruby-1.9.1/ruby/backward -I/C/Ruby/include/ruby-1.9.1 -I. -DHAVE_RB_THREAD_BLOCKING_REGION -DHAVE_MYSQL_H -DHAVE_ERRMSG_H -DHAVE_MYSQLD_ERROR_H '-IC: Program Files MySQL MySQL Server 5.5 include' -O3 -g -Wextra -Wno-unused-parameter -Wno-parentheses -Wpointer-arith -Wwrite-strings -Wno-missing-field-initializers -Wno-long-long -Wall -funroll-loops -o client.o -c client.c gcc -I. -IC:/Ruby/include/ruby-1.9.1/i386-mingw32 -I/C/Ruby/include/ruby-1.9.1/ruby/backward -I/C/Ruby/include/ruby-1.9.1 -I. -DHAVE_RB_THREAD_BLOCKING_REGION -DHAVE_MYSQL_H -DHAVE_ERRMSG_H -DHAVE_MYSQLD_ERROR_H '-IC: Program Files MySQL MySQL Server 5.5 include' -O3 -g -Wextra -Wno-unused-parameter -Wno-parentheses -Wpointer-arith -Wwrite-strings -Wno-missing-field-initializers -Wno-long-long -Wall -funroll-loops -o mysql2_ext.o -c mysql2_ext.c gcc -I. -IC:/Ruby/include/ruby-1.9.1/i386-mingw32 -I/C/Ruby/include/ruby-1.9.1/ruby/backward -I/C/Ruby/include/ruby-1.9.1 -I.

-DHAVE_RB_THREAD_BLOCKING_REGION -DHAVE_MYSQL_H -DHAVE_ERRMSG_H -DHAVE_MYSQLD_ERROR_H '-IC: Program Files MySQL MySQL Server 5.5 include' -O3 -g -Wextra -Wno-unused-parameter -Wno-parentheses -Wpointer-arith -Wwrite-strings -Wno-missing-field-initializers -Wno-long-long -Wall -funroll-loops -o result.o -c result.c result.c: In function 'rb_mysql_result_fetch_fields': result.c:376:35: warning: comparison between signed and unsigned integer expressions gcc -shared -s -o mysql2.so client.o mysql2_ext.o result.o -L. -LC:/Ruby/lib -L'C: Program Files MySQL MySQL Server 5.5 lib' -L. This worked with MySQL Server 5.5 on Windows 7: $ 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. I had the same issue with installing mysql2 gem on Windows 7 x64 and I solved this. Please read this: solution: 1. Download mysql-5.5.14-winx64.msi from and install 2.

Download mysql-5.5.14-win32.msi, enter package by Total Commander by Ctrl+PgDn hotkey and copy contents of SourceDir/Mysql to D:/Temp 3. Copy file d: Temp MySQL Server 5.5 lib libmysql.dll to c: Ruby192 bin 4. Install mysql2 gem by command: gem install mysql2 -- '--with-mysql-lib='d: Temp MySQL Server 5.5 lib' --with-mysql-include='d: Temp MySQL Server 5.5 include' That`s all. Wow, I've been trying to install mysql2 for almost a day and still can't figure out what is still missing after following all the steps you guys suggested.

Installing Rails with InstantRails is a no brainer.but for guys like me who wants to be productive and produce an application, this is such a hassle. This is just counter-productive. Anybody who got the right steps to take should voice out now, before I go back to PHP.(still ROCKS!, Sorry RoR peeps, I see too much configuration and convention!) BTW, Am installing it in WinXP sp3 with MySQL 5.5. I'm able to get the gem installed successfully using the suggestions above, but when I try to run my server, I continue to get the following error: ←[31mCould not find gem 'mysql2 (= 0.2.11)' in any of the gem sources listed in your Gemfile.←[0m ←[33mRun `bundle install` to install missing gems.←[0m subsequent bundle install attempts to install the mysql2 gem again, and promptly fails because I'm not giving it the lib and include path parameters. Any idea what is causing this discrepancy between what gem install does and what bundle install does? Or, alternatively, is there a way to pass those same parameters to bundle? I'm running on Win7 (32-bit) machine, having just upgraded to Ruby 1.9.2.

Had the mysql2 installation issue on 1.8.7, which I had been using previously, but gem install was able to keep bundle happy. Did something change for 1.9 or is there a way to check if bundle is getting my gems between the two Ruby version on my machine confused? Hi Alex, First, some clarification on your issues: 1. Discrepancy between gem install and bundle install seems to be of mysql2 version issue (Or can be a case of installation of gem between two Ruby versions) 2. In Gemfile, we don't require to pass any lib or include path for mysql2, normally it works with version and source parameters(In my case - gem 'mysql2', '. Scott Hey Ritesh & others, I'm facing some installation issues as well with mysql2. Ruby -v =>1.9.2p290 *** FAILURE *** >bundle install.

Installing mysql2 (0.2.13). Failed to build gem native extension Installing mysql2 (0.2.13) with native extensions C:/Ruby192/lib/ruby/site_ruby/ 1.9.1/rubygems/installer.rb:533:in `rescue in block in build_extensions': ERROR: Failed to build gem native extension. (Gem::Installer::ExtensionBuildError) C:/Ruby192/bin/ruby.exe extconf.rb checking for rb_thread_blocking_region(). Yes checking for main() in -llibmysql. No *** extconf.rb failed *** Could not create Makefile due to some reason, probably lack of necessary libraries and/or headers.

Check the mkmf.log file for more details. You may need configuration options. So, then I did this. *** SUCCESS **** >gem install mysql2 -v 0.2.6 and that's successful BUT, >rails server ←[31mCould not find gem 'mysql2 (. Hi Scott, Some steps which can help you in solving this issue: Which version of 'MySQL Server' you are using? Which mysql2 version you are mentioning in 'GemFile'? Copy 'libmySQL.dll' file from 'C: Program Files MySQL MySQL Server 5.5 library' to 'C: Ruby192 bin' and then try 'bundle install' Use below command 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' Thanks Ritesh.

Someone facing this issue, taken from my email. Hi Ritesh, I found your post and tried your solution: I am running: ruby 1.9.2p290 rails 3.0.10 and mysql2 0.2.7 with mysql 5.5 with mysql gem everythings works fine, but i cannot get mysql2 running on windows (windows server 2003).

On MacOS everything works fine. The problem with the normal mysql gem is, that i get ascii/utf8 problems. When i try to run the server with your setup, it starts, but i cannot connect to it via browser. Do you have any suggestions? Would be very nice, if you can help me with that. Hi, after (too) many tries I finally got my solution. Windows 7 x64 Ruby 1.9.2p290 Rails 3.0.10 MySql 5.5 x64 Ruby is 32bit so I guess the problem is working with the 64bit dll provided with the MySql install.

I've read somewhere (sorry I don't remember where but thanks) that it's useful to use the 32bit connector downloadable from the MySql site. I've downloaded 'mysql-connector-c-noinstall-6.0.2-win32.zip' and unzipped it under C: and copied the libmysql.dll in my C: ruby192 bin folder. Rails wants version 0.2.13 of the mysql2 gem so I've built that version using this command that points to the connector files: gem install mysql2 -v 0.2.13 -- '--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' After that I've been able to execute 'bundle install' and 'rails server' on my project without further problems. Architekt Pro 6 Keygen Generator.

I do hope that this helps and thanks to all for the suggestions! Hello All, First of all thanks for making such kind of solutions for us. All things are fine but here several kind of dependencies are going on, like rails version, mysql2 version, and ruby version.for complete installation use these steps. Install dev kit for windows.

And follow instruction from above. And make one change Use this command for installation: Here related to mysql path is path of local installation directory. Gem install mysql2 –v=0.2.6 -- '--with-mysql-lib='c: Program Files MySQL MySQL Server 5.1 lib ' --with-mysql-include='c: Program Files MySQL MySQL Server 5.1 include' step 2: After installing use your version mysql2 –v 0.2.x, because –v0. 3.x don’t work on window or Rails 3 or Ruby 1.9.

Step 3: update in your gem file form gem 'mysql2' to gem 'mysql', '0.2.x' # here x=6.10. One point to note here if you use 0.3.x version for rails 3.1.x then it will not support. And if You use mysql2 -v=0.3.x then it will require mysql2-adapter for active record so use mysql2-v0.2.x. Enjoy with mysql2 on ruby 1.9 and rails 3.0.x Cheers. Dear All, I had a problem installing mysql2 gem. Below is the error.

(Platform win 7 x64, mysql 5.5 x64, rails 3.1, ruby 1.9.2) THANKS. 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. ERROR: Error installing mysql2: ERROR: Failed to build gem native extension.

C:/Ruby192/bin/ruby.exe extconf.rb --with-mysql-lib='c: Program Files MySQL MySQ L Server 5.5 lib' --with-mysql-include='c: Program Files MySQL MySQL Server 5.5 include' checking for rb_thread_blocking_region(). Yes checking for main() in -llibmysql. Yes checking for mysql.h. Yes checking for errmsg.h. Yes checking for mysqld_error.h. Yes creating Makefile make: *** [mysql2.so] Error 1.

I tried this, and works for me! ------------------------------------------------- Versions -Windows: XP SP3 -Ruby: 1.9.2p290 (2011-07-09) [i386-mingw32] -Rails: 3.1.1 -MySQL: MySQL 5.5 ------------------------------------------------- FOLLOW STEPS 1 ~ 8 [MySQL]: (MySQL Folder) (i used '/' and not ' ' ~>e.g 'C:/Programs Files/MySQL/MySQL 5.5') gem install mysql2 -- '--with-mysql-lib='[MySQL]/lib' --with-mysql-include='[MySQL]/include' gem list.. Mysql (2.8.1 x86-mingw32) mysql2 (0.3.7) rails (3.1.1)..

Anonymous Hi all, first of all thank you for the post and the useful comments. I've followed all the steps but when executing rake db:drop or rake db:create the execution never ends after the warning message: C: >rake db:drop WARNING: Global access to Rake DSL methods is deprecated. Please include. Rake::DSL into classes and modules which use the Rake DSL methods. When executing rails s the messages seems correct but when trying to connect from a browser it says waiting for localhost and it never ends neither.

C: >rails s =>Booting WEBrick =>Rails 3.0.5 application starting in development on =>Call with -d to detach =>Ctrl-C to shutdown server [2011-11-08 14:54:25] INFO WEBrick 1.3.1 [2011-11-08 14:54:25] INFO ruby 1.9.2 (2011-02-18) [i386-mingw32] [2011-11-08 14:54:25] INFO WEBrick::HTTPServer#start: pid=904 port=3000 Have you seen that behavior before? I'm using ruby 1.9.2 / rails 3.0.5 / mysql 5.5 64 bits (using the 32 connector) in a Windows 7 64 bits Thank you very much for your help! I am getting an error like this $ rails generate exam index c:/Ruby193/lib/ruby/gems/1.9.1/gems/mysql2-0.3.11-x86-mingw32/lib/mysql2/mysql2.rb:2:in `require': 193:%1 is not a valid Win32 application.