I'm trying to installing the mysql2 gem on windows 7 I downloaded the connector from the mysql site and placed the libmysql.dll in ruby200\bin
then do gem install mysql2
These are the results am I being dim here?
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:/Ruby200/bin/ruby.exe extconf.rb
checking for rb_thread_blocking_region()... yes
checking for rb_wait_for_single_fd()... yes
checking for rb_hash_dup()... yes
checking for rb_intern3()... yes
*** 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.
Provided configuration options:
--with-opt-dir
--without-opt-dir
--with-opt-include
--without-opt-include=${opt-dir}/include
--with-opt-lib
--without-opt-lib=${opt-dir}/lib
--with-make-prog
--without-make-prog
--srcdir=.
--curdir
--ruby=C:/Ruby200/bin/ruby
--with-mysql-dir
--without-mysql-dir
--with-mysql-include
--without-mysql-include=${mysql-dir}/include
--with-mysql-lib
--without-mysql-lib=${mysql-dir}/
extconf.rb:37:in `<main>': undefined method `[]' for nil:NilClass (NoMethodError
)
Gem files will remain installed in C:/Ruby200/lib/ruby/gems/2.0.0/gems/mysql2-0.
3.13 for inspection.
Results logged to C:/Ruby200/lib/ruby/gems/2.0.0/gems/mysql2-0.3.13/ext/mysql2/g
em_make.out
I am still having problem with mysql2 gem but below approach helped me install mysql with RoR on Windows Env.
Step 1 : Gem File changes : ({app}/Gemfile)
Update mysql2 --> mysql
Step 2 : Updates in database.yml file ({app}/config/database.yml)
Change adapter: mysql2 --> adapter: mysql
host: localhost --> host: 127.0.0.1
Step 3 : Downoad mysql-connector-c-noinstall-6.0.2-win32
Step 4 : Copy mysql-connector-c-noinstall-6.0.2-win32\lib\libmysql.dll file to C:\RailsInstaller\Ruby1.9.3\bin
Step 5 :bundle update && Start rails server
Steps for Ruby 2.1.3, Windows 8.1 and MySQL Server 5.7. All x64 bit.
ruby dk.rb init
ruby dk.rb install
gem install mysql2 -- '--with-mysql-lib="c:\Program Files\MySQL\MySQL Server 5.7\lib" --with-mysql-include="c:\Program Files\MySQL\MySQL Server 5.7\include" --with-mysql-dir="c:\Program Files\MySQL\MySQL Server 5.7"'
I have tried all provided methods but the same error appears again and again :(
Fortunately, older version installed without any errors!
I managed to succeed at this out of pure luck, but after an hour of hell I feel like I should share my solution, obviously very shortened but a lot of the steps I think you can figure out how to do on your own.
My machine is Win 7 64bit. I was able to install version 0.3.16
Here is what I did for windows server 2012 sp2. Nothing else worked...
After receiving error
'while installing mysql2 (0.3.17), and bundler cannot continue' Make sure that 'gem install mysql2 -v '0.3.17' succeeds...
1) Download the MySql C Connector from: http://dev.mysql.com/downloads/connector/c/
2)
Extract the file to C:\mysql-connector
3)
gem install mysql2 -v '0.3.17' --platform=ruby -- '--with-mysql-dir="C:\mysql-connector"'
Note: the -v '0.3.17' above, it would not work without this.
4)
bundle install
--> Finally, Success.Here's what worked for me:
Been searching for a few hours and not seen this variation suggested, so hopefully it will help someone!