Ruby MYSQL2 gem installation on windows 7Unable to install MySQL2 gem on Windows 7LoadError trying to use MySQL with Ruby on Rails in Windows, RubyMine IDERuby on Windows: Cannot install mysql2 gem - Failed to build gem native extensioninstalling ruby with mysql2 on windows 7 64 bit returns error on rails sInstalling MySQL2 Gem on Windowsmysql ruby gem not installing on Windows 7error running rails server “Failed to load libmysql.dll”Trying to install mysql2 gem on Windows 8 with Ruby 2How to install Ruby on Rails on Windows?Trouble starting rails server . specific module could not be foundHow to write a switch statement in Rubysqlite3-ruby install error on UbuntuProblem installing gem pauldix-feedzirra on windowsGot “undefined method `split'” when installing gem dm-mysql-adapterError installing rmagick: ERROR: Failed to build gem native extensionHow to install a specific version of a ruby gem?How can I get mysql2 to install?How to install therubyracer gem on 10.10 Yosemite?Install MySQL2 gem on windows8ERROR when running bundle install on 'stripe' gem
Light Switch Terminals
What's the difference between a Bunsen burner and a gas stove?
Extrude the faces of a cube symmetrically along XYZ
Ex-manager wants to stay in touch, I don't want to
Early arrival in Australia, early hotel check in not available
Front derailleur hard to move due to gear cable angle
What's the word for the soldier salute?
Setting the major mode of a new buffer interactively
Is the schwa sound consistent?
What is Plautus’s pun about frustum and frustrum?
Usefulness of complex chord names?
How do I compare the result of "1d20+x, with advantage" to "1d20+y, without advantage", assuming x < y?
Why does the Earth follow an elliptical trajectory rather than a parabolic one?
How does noise-cancellation work in Mac laptops?
Can the sorting of a list be verified without comparing neighbors?
Understanding integration over Orthogonal Group
How can this pool heater gas line be disconnected?
Was this character’s old age look CGI or make-up?
Do atomic orbitals "pulse" in time?
Should these notes be played as a chord or one after another?
Why is this int array not passed as an object vararg array?
What food production methods would allow a metropolis like New York to become self sufficient
Does Lawful Interception of 4G / the proposed 5G provide a back door for hackers as well?
Can I use my laptop, which says 100-240V, in the USA?
Ruby MYSQL2 gem installation on windows 7
Unable to install MySQL2 gem on Windows 7LoadError trying to use MySQL with Ruby on Rails in Windows, RubyMine IDERuby on Windows: Cannot install mysql2 gem - Failed to build gem native extensioninstalling ruby with mysql2 on windows 7 64 bit returns error on rails sInstalling MySQL2 Gem on Windowsmysql ruby gem not installing on Windows 7error running rails server “Failed to load libmysql.dll”Trying to install mysql2 gem on Windows 8 with Ruby 2How to install Ruby on Rails on Windows?Trouble starting rails server . specific module could not be foundHow to write a switch statement in Rubysqlite3-ruby install error on UbuntuProblem installing gem pauldix-feedzirra on windowsGot “undefined method `split'” when installing gem dm-mysql-adapterError installing rmagick: ERROR: Failed to build gem native extensionHow to install a specific version of a ruby gem?How can I get mysql2 to install?How to install therubyracer gem on 10.10 Yosemite?Install MySQL2 gem on windows8ERROR when running bundle install on 'stripe' gem
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty height:90px;width:728px;box-sizing:border-box;
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 ruby200bin
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
ruby gem mysql2
|
show 1 more comment
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 ruby200bin
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
ruby gem mysql2
As it indicates, check out: Results logged to C:/Ruby200/lib/ruby/gems/2.0.0/gems/mysql2-0.3.13/ext/mysql2/g em_make.out and also mkmf.log for descriptive errors. Post them here. It probably needs headers such as by supplying "gem install mysql2 -- --with-MySQL-lib=<MySQL source file that matches the correct mod level>". These files can be downloaded to permit installation, but make sure it matches your gem's mod level. I use BitNami Rubystack on Windows 8 which includes MySQL. RailsInstaller is a very popular comprehensive install.
– Richard_G
Sep 26 '13 at 4:11
It may be a problem with native gem installation. Can you install other native gems like bson_ext?
– crazybob
Sep 26 '13 at 6:05
Yeah thanks for the help guys, @R_G yeah you were right I needed to specify the locations for each of the required files via the gem command below, quite why gem install doesn't look in the same folder i'm not sure, I was trying to stay away from bundled installers as it helps me understand rails a bit better!
– Mrk Fldig
Sep 26 '13 at 8:33
possible duplicate of Unable to install mysql2 gem on windows 7
– André Herculano
Dec 13 '13 at 13:56
Read the yellow text at the top of my question. That's the reason the mysql gem nor the mysql2 gem won't install! stackoverflow.com/questions/30361280/…
– MacGyver
May 22 '15 at 1:40
|
show 1 more comment
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 ruby200bin
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
ruby gem mysql2
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 ruby200bin
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
ruby gem mysql2
ruby gem mysql2
asked Sep 25 '13 at 19:58
Mrk FldigMrk Fldig
2,29851846
2,29851846
As it indicates, check out: Results logged to C:/Ruby200/lib/ruby/gems/2.0.0/gems/mysql2-0.3.13/ext/mysql2/g em_make.out and also mkmf.log for descriptive errors. Post them here. It probably needs headers such as by supplying "gem install mysql2 -- --with-MySQL-lib=<MySQL source file that matches the correct mod level>". These files can be downloaded to permit installation, but make sure it matches your gem's mod level. I use BitNami Rubystack on Windows 8 which includes MySQL. RailsInstaller is a very popular comprehensive install.
– Richard_G
Sep 26 '13 at 4:11
It may be a problem with native gem installation. Can you install other native gems like bson_ext?
– crazybob
Sep 26 '13 at 6:05
Yeah thanks for the help guys, @R_G yeah you were right I needed to specify the locations for each of the required files via the gem command below, quite why gem install doesn't look in the same folder i'm not sure, I was trying to stay away from bundled installers as it helps me understand rails a bit better!
– Mrk Fldig
Sep 26 '13 at 8:33
possible duplicate of Unable to install mysql2 gem on windows 7
– André Herculano
Dec 13 '13 at 13:56
Read the yellow text at the top of my question. That's the reason the mysql gem nor the mysql2 gem won't install! stackoverflow.com/questions/30361280/…
– MacGyver
May 22 '15 at 1:40
|
show 1 more comment
As it indicates, check out: Results logged to C:/Ruby200/lib/ruby/gems/2.0.0/gems/mysql2-0.3.13/ext/mysql2/g em_make.out and also mkmf.log for descriptive errors. Post them here. It probably needs headers such as by supplying "gem install mysql2 -- --with-MySQL-lib=<MySQL source file that matches the correct mod level>". These files can be downloaded to permit installation, but make sure it matches your gem's mod level. I use BitNami Rubystack on Windows 8 which includes MySQL. RailsInstaller is a very popular comprehensive install.
– Richard_G
Sep 26 '13 at 4:11
It may be a problem with native gem installation. Can you install other native gems like bson_ext?
– crazybob
Sep 26 '13 at 6:05
Yeah thanks for the help guys, @R_G yeah you were right I needed to specify the locations for each of the required files via the gem command below, quite why gem install doesn't look in the same folder i'm not sure, I was trying to stay away from bundled installers as it helps me understand rails a bit better!
– Mrk Fldig
Sep 26 '13 at 8:33
possible duplicate of Unable to install mysql2 gem on windows 7
– André Herculano
Dec 13 '13 at 13:56
Read the yellow text at the top of my question. That's the reason the mysql gem nor the mysql2 gem won't install! stackoverflow.com/questions/30361280/…
– MacGyver
May 22 '15 at 1:40
As it indicates, check out: Results logged to C:/Ruby200/lib/ruby/gems/2.0.0/gems/mysql2-0.3.13/ext/mysql2/g em_make.out and also mkmf.log for descriptive errors. Post them here. It probably needs headers such as by supplying "gem install mysql2 -- --with-MySQL-lib=<MySQL source file that matches the correct mod level>". These files can be downloaded to permit installation, but make sure it matches your gem's mod level. I use BitNami Rubystack on Windows 8 which includes MySQL. RailsInstaller is a very popular comprehensive install.
– Richard_G
Sep 26 '13 at 4:11
As it indicates, check out: Results logged to C:/Ruby200/lib/ruby/gems/2.0.0/gems/mysql2-0.3.13/ext/mysql2/g em_make.out and also mkmf.log for descriptive errors. Post them here. It probably needs headers such as by supplying "gem install mysql2 -- --with-MySQL-lib=<MySQL source file that matches the correct mod level>". These files can be downloaded to permit installation, but make sure it matches your gem's mod level. I use BitNami Rubystack on Windows 8 which includes MySQL. RailsInstaller is a very popular comprehensive install.
– Richard_G
Sep 26 '13 at 4:11
It may be a problem with native gem installation. Can you install other native gems like bson_ext?
– crazybob
Sep 26 '13 at 6:05
It may be a problem with native gem installation. Can you install other native gems like bson_ext?
– crazybob
Sep 26 '13 at 6:05
Yeah thanks for the help guys, @R_G yeah you were right I needed to specify the locations for each of the required files via the gem command below, quite why gem install doesn't look in the same folder i'm not sure, I was trying to stay away from bundled installers as it helps me understand rails a bit better!
– Mrk Fldig
Sep 26 '13 at 8:33
Yeah thanks for the help guys, @R_G yeah you were right I needed to specify the locations for each of the required files via the gem command below, quite why gem install doesn't look in the same folder i'm not sure, I was trying to stay away from bundled installers as it helps me understand rails a bit better!
– Mrk Fldig
Sep 26 '13 at 8:33
possible duplicate of Unable to install mysql2 gem on windows 7
– André Herculano
Dec 13 '13 at 13:56
possible duplicate of Unable to install mysql2 gem on windows 7
– André Herculano
Dec 13 '13 at 13:56
Read the yellow text at the top of my question. That's the reason the mysql gem nor the mysql2 gem won't install! stackoverflow.com/questions/30361280/…
– MacGyver
May 22 '15 at 1:40
Read the yellow text at the top of my question. That's the reason the mysql gem nor the mysql2 gem won't install! stackoverflow.com/questions/30361280/…
– MacGyver
May 22 '15 at 1:40
|
show 1 more comment
17 Answers
17
active
oldest
votes
EDIT 30/09/2014
When this answer was posted the 64 bit rails installer wasn't the recommended version - it now seems people are starting to use it more. It should be noted when you download the MySQL Connector you need to download either 64 or 32bit to correspond to the version of rails you installed.
Amazingly I lucked upon an answer very early this morning as I happened to be looking for something else of a similar nature. I'm not quite sure why there isn't a single simple guide for this as it appears to be very straight forward!
For some reason just specifying the mysql-dir when you install the gem doesn't pick up with other sub directories so you need to set the parameters manually.
For anyone else experiencing the same problem, I did the following:
1) Download the MySql C Connector from: http://dev.mysql.com/downloads/connector/c/
NOTE Don't download the installer, download the ARCHIVE for your OS
Download either the 32bit or 64 bit ARCHIVE to correspond with the version of rails you installed.
2) Extract the file to C:mysql-connector
3) Then ran:
gem install mysql2 --platform=ruby -- '--with-mysql-lib="C:mysql-connectorlib" --with-mysql-include="C:mysql-connectorinclude" --with-mysql-dir="C:mysql-connector"'
Voila everything is working fine.
EDIT 30/01/2014
I just had to do a fresh install on a bricked machine and the command in step 3 didn't work, what did work was:
gem install mysql2 --platform=ruby -- '--with-mysql-dir="C:mysql-connector"'
I'm not quite sure what the difference is but this time it seems to be picking up the directories ok, so if the first one doesn't work try this one!
I think this has to do with how you go about installing rails, this time round I used the railsinstaller which seems to set the paths up correctly.
A lot of the outcome here seems to depend on the shell your using, a lot of people are having problems with powershell so I wouldn't advise using it. I did this in an elevated command prompt.
Oh and lastly if you get an error regarding the mysql2 gem when you do RAILS S you need to copy the libmysql.dll from the LIB directory of the mysql connector to the bin directory where rails has been installed.
It worked! Thanks a lot :)
– Jubayer Arefin
Oct 28 '13 at 9:22
Thanks Man , saved me lots of time!
– Guy
Nov 4 '13 at 23:13
14
Did not work for me, sadly... Not sure why.
– Nate
Nov 12 '13 at 15:52
6
Make sure you download 32-bit server and 32-bit connector. github.com/oneclick/rubyinstaller/wiki/…
– Duke
Jan 2 '14 at 4:11
the second code worked using 32 bit version of mysql-connector
– user1922137
Feb 1 '14 at 13:06
|
show 10 more comments
I've tried the solution of @Mrk Fldig but it didn't work...
So what solved the problem was:
- Downloaded the lastest MySQL Installer for windows 7 32 bits
- Installed the gem with the following command:
gem install mysql2 --platform=ruby -- '--with-mysql-dir="C:/Program Files/MySQL/MySQL Connector C 6.1 6.1.2/"'
One pitfall to be aware of is that I changed the backslashes () to normal slashes (/). I've tried the same procedure with backslashes and it didn't work.
The installer already includes the C connectors for MySQL at MySQL Connector C 6.1 6.1.2
directory. Therefore, passing only the --with-mysql-dir
parameter without the --with-mysql-lib
or --with-mysql-include
parameters, makes the gem to look at the same directory for the lib
and include
directories
1
This also fixes it for me. But I've just used the archive as per the above instructions. The issue seems to be what shell you're in. I'm running in the msysgit bash shell and multiple --with options seemed to fail with that. Your trick works just fine.
– Alexander Kellett
Jan 14 '14 at 9:13
1
Works fine for me too on CMD. Thanks!
– taiar
Jan 25 '14 at 18:39
add a comment |
Steps for Ruby 2.1.3, Windows 8.1 and MySQL Server 5.7. All x64 bit.
- Download Development Kit
- Extracted Development Kit.
- Run CMD and go to dir where is Development Kit extracted
- Run
ruby dk.rb init
- Run
ruby dk.rb install
- Run
gem install mysql2 -- '--with-mysql-lib="c:Program FilesMySQLMySQL Server 5.7lib" --with-mysql-include="c:Program FilesMySQLMySQL Server 5.7include" --with-mysql-dir="c:Program FilesMySQLMySQL Server 5.7"'
This solution worked for me on Windows 10, Ruby 2.5.5, MySQL Server 5.7 (all x64 bit). Thank you.
– marianc
May 2 at 22:40
add a comment |
This is what worked for me for the same error on Windows 8 64-bit and using ruby 64-bit
- Download and install MySQL Server 5.6 64-bit
Run this command:
gem install mysql2 -v '0.3.16' -- '--with-mysql-lib="c:Program FilesMySQLMySQL Server 5.6lib" --with-mysql-include="c:Program FilesMySQLMySQL Server 5.6include"'
Hope this helps
Nice to know that works too, for my project I already had a remote DB so I didn't need to install!
– Mrk Fldig
Aug 12 '14 at 7:38
Incidentally as far as I know railsinstaller is 32 bit so will require 32 bit libs as per the instructions below.
– Mrk Fldig
Aug 12 '14 at 7:44
add a comment |
I have tried all provided methods but the same error appears again and again :(
Fortunately, older version installed without any errors!
gem uninstall mysql2
gem install mysql2 -v 0.2.6
add a comment |
Try to follow those steps:
I assume:
- a) you use windows7
- b) ruby 2+ on C:Ruby200-x64
- c) rails 4+ installed on ruby
- d) WAMP installed on C:wamp and running
1) uninstall your myslq2 gem:
$ gem uninstall mysql2
2) reinstall the mysql2 gem with path option:
$ gem install mysql2 -- '--with-mysql-lib="C:wampbinmysqlmysql5.6.12lib" --with-mysql-include="C:wampbinmysqlmysql5.6.12include"'
3) copy the libmysql.dll you find in C:wampbinmysqlmysql5.6.12lib into C:Ruby200-x64bin
4) open in your rails app the file "Gemfile" and edit it enabling the mysql2, by adding:
gem 'mysql2'
5) start your rails server:
$ rails server
6) open your browser and go to localhost:3000/
add a comment |
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-win32liblibmysql.dll file to C:RailsInstallerRuby1.9.3bin
Step 5 :bundle update && Start rails server
add a comment |
Here's what worked for me:
gem install mysql2 -- '--with-mysql-dir="C:wampbinmysqlmysql5.5.xx"'
Been searching for a few hours and not seen this variation suggested, so hopefully it will help someone!
add a comment |
Also try disabling your antivirus before installing the gem. Mine got installed after I ran following command :
gem install mysql2 --platform=ruby -- '--with-mysql-lib=
"C:mysql-connectorlib" --with-mysql-include="C:mysql-connectorinclude" --wit
h-mysql-dir="C:mysql-connector"'
Same command was not working when my antivirus was enabled, as it was pushing some ruby file to chest.
Hope this helps someone.
THANK YOU I've been looking everywhere, but nothing was working. This worked for me.
– Padagomez
Jul 3 '14 at 15:28
thats great (Y)
– hira umair
Jul 15 '14 at 5:57
add a comment |
For Cygwin, I could consolidate various steps.
- Use cygwin setup.exe to download gcc, g++, make, cmake and libmysqlclient-devel (from cygwin ports)
- Download c/connector src for windows from mysql site. I downloaded 6.x version. OR download libmysqlclient-devel's version (not sure from where)
- unzip
- cd dir_connector
- Not required and RISKY, but if cygwin libmysqlclient-devel version is 5.5.40 , then change dir_connector/VERSION file's versions to 5.5.40
- mkdir build
- cd build
- comment dtoa in stdlib.h, else compilation is failing
- cmake ..
- make
- make install
- gem install mysql2 -- --with-mysql-config=/usr/local/mysql/bin/mysql_config
add a comment |
Ruby installer
rubyinstaller-devkit-2.5.3-1-x64
Mysql connector: mysql-connector-c-6.1.11-win32
https://downloads.mysql.com/archives/c-c/?version=6.1.2&os=src
Gem install:
gem install mysql2 --platform=ruby -- --with-mysql-lib="c:mysql-connector-c-6.1.11-win32"
Please don't write code-only answers.
– JJJ
Mar 23 at 12:25
Upvoted because JJJ being a bit mean there(assuming JJJ downvoted), welcome to StackOverflow generally speaking you should give me a bit more of a write up your answers, whilst the answer may be correct you should explain the steps ;-)
– Mrk Fldig
Mar 25 at 11:59
add a comment |
I downloaded the devkit 32-bit, with my 64-bit pc, however I realize that railsinstaller apparently installs a 32-bit version by default, so I have directed all facilities 32bit.
Initialize the ruby devkit dk.rb init
Download the mysql connector 32-bit, and place it in the mysql-connector C: mysql-connector
You should be aware, that when you unzip the file, it creates a subfolder with the same name and can give errors.
Then use the second command listed above:
gem install mysql2 - platform = ruby - '- with-mysql-dir = "C: mysql-connector"'
This was the solution I found, as I had the same problem.
add a comment |
On Windows 7 I found that the existing answers provided a partial solution, but I still couldn't get it to install.
The problem I had was that the MySQL Community Edition Windows installer I used insisted on putting the connectors in folders called things like C:MySQLMySQL Connector C 6.1.3
. The build process in the gem was reporting that it could not find "C:MySQLMySQL" ( and before that when I had it in Program Files, it complained it couldn't find "C:Programincludes" ) so clearly the spaces were a problem and I couldn't find a way to escape them that it could understand- possibly someone will be able to suggest one of those.
Because I wasn't sure whether changing these would break the installation, once I realised why the problem was arising I just created a symlink from the command line ( something that is easier from cmd
than powershell ) like this:
C:MySQL> mklink /D ConnectorC ".MySQL Connector C 6.1.3"
Then I could use the following install line:
gem install mysql2 --platform=ruby -- '--with-mysql-dir="C:/MySQL/ConnectorC/"'
This worked correctly.
Also, when I tried to use it, I ran into this problem so it may be useful to be aware that moving the MySQL lib file from the C Connector lib folder could be helpful.
add a comment |
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
- Install ruby version 2.0.0p481 (?)
- Devkit blah blah
- Install rails version 4.0.0
- Download Mysql Connector C 64 bit zip file, put in C drive as mysqlc
- Take DLL from that bin, put it in lib of ruby
- gem install mysql2 -- -- with-mysql-dir="C:mysqlc"
add a comment |
It worked for me after adding some tweaks
gem install mysql2 --platform=ruby -- '--with-mysql-lib="C:Program FilesMySQLMySQL Connector C 6.1.5lib" --with-mysql-include="C:Program FilesMySQLMySQL Connector C 6.1.5include" --with-mysql-dir="C:Program FilesMySQLMySQL Connector C 6.1.5"
Heh, yeah thats what the first option was, glad its sorted!
– Mrk Fldig
Aug 19 '14 at 7:12
add a comment |
None of that worked for me, until I realized that I have the 64-bit version of the DevKit installed. So I downloaded the 64-bit MySQL Connector/C from MySQL website
and installed the gem with the "with-mysql-dir" option
add a comment |
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.
add a comment |
Your Answer
StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f19014117%2fruby-mysql2-gem-installation-on-windows-7%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
17 Answers
17
active
oldest
votes
17 Answers
17
active
oldest
votes
active
oldest
votes
active
oldest
votes
EDIT 30/09/2014
When this answer was posted the 64 bit rails installer wasn't the recommended version - it now seems people are starting to use it more. It should be noted when you download the MySQL Connector you need to download either 64 or 32bit to correspond to the version of rails you installed.
Amazingly I lucked upon an answer very early this morning as I happened to be looking for something else of a similar nature. I'm not quite sure why there isn't a single simple guide for this as it appears to be very straight forward!
For some reason just specifying the mysql-dir when you install the gem doesn't pick up with other sub directories so you need to set the parameters manually.
For anyone else experiencing the same problem, I did the following:
1) Download the MySql C Connector from: http://dev.mysql.com/downloads/connector/c/
NOTE Don't download the installer, download the ARCHIVE for your OS
Download either the 32bit or 64 bit ARCHIVE to correspond with the version of rails you installed.
2) Extract the file to C:mysql-connector
3) Then ran:
gem install mysql2 --platform=ruby -- '--with-mysql-lib="C:mysql-connectorlib" --with-mysql-include="C:mysql-connectorinclude" --with-mysql-dir="C:mysql-connector"'
Voila everything is working fine.
EDIT 30/01/2014
I just had to do a fresh install on a bricked machine and the command in step 3 didn't work, what did work was:
gem install mysql2 --platform=ruby -- '--with-mysql-dir="C:mysql-connector"'
I'm not quite sure what the difference is but this time it seems to be picking up the directories ok, so if the first one doesn't work try this one!
I think this has to do with how you go about installing rails, this time round I used the railsinstaller which seems to set the paths up correctly.
A lot of the outcome here seems to depend on the shell your using, a lot of people are having problems with powershell so I wouldn't advise using it. I did this in an elevated command prompt.
Oh and lastly if you get an error regarding the mysql2 gem when you do RAILS S you need to copy the libmysql.dll from the LIB directory of the mysql connector to the bin directory where rails has been installed.
It worked! Thanks a lot :)
– Jubayer Arefin
Oct 28 '13 at 9:22
Thanks Man , saved me lots of time!
– Guy
Nov 4 '13 at 23:13
14
Did not work for me, sadly... Not sure why.
– Nate
Nov 12 '13 at 15:52
6
Make sure you download 32-bit server and 32-bit connector. github.com/oneclick/rubyinstaller/wiki/…
– Duke
Jan 2 '14 at 4:11
the second code worked using 32 bit version of mysql-connector
– user1922137
Feb 1 '14 at 13:06
|
show 10 more comments
EDIT 30/09/2014
When this answer was posted the 64 bit rails installer wasn't the recommended version - it now seems people are starting to use it more. It should be noted when you download the MySQL Connector you need to download either 64 or 32bit to correspond to the version of rails you installed.
Amazingly I lucked upon an answer very early this morning as I happened to be looking for something else of a similar nature. I'm not quite sure why there isn't a single simple guide for this as it appears to be very straight forward!
For some reason just specifying the mysql-dir when you install the gem doesn't pick up with other sub directories so you need to set the parameters manually.
For anyone else experiencing the same problem, I did the following:
1) Download the MySql C Connector from: http://dev.mysql.com/downloads/connector/c/
NOTE Don't download the installer, download the ARCHIVE for your OS
Download either the 32bit or 64 bit ARCHIVE to correspond with the version of rails you installed.
2) Extract the file to C:mysql-connector
3) Then ran:
gem install mysql2 --platform=ruby -- '--with-mysql-lib="C:mysql-connectorlib" --with-mysql-include="C:mysql-connectorinclude" --with-mysql-dir="C:mysql-connector"'
Voila everything is working fine.
EDIT 30/01/2014
I just had to do a fresh install on a bricked machine and the command in step 3 didn't work, what did work was:
gem install mysql2 --platform=ruby -- '--with-mysql-dir="C:mysql-connector"'
I'm not quite sure what the difference is but this time it seems to be picking up the directories ok, so if the first one doesn't work try this one!
I think this has to do with how you go about installing rails, this time round I used the railsinstaller which seems to set the paths up correctly.
A lot of the outcome here seems to depend on the shell your using, a lot of people are having problems with powershell so I wouldn't advise using it. I did this in an elevated command prompt.
Oh and lastly if you get an error regarding the mysql2 gem when you do RAILS S you need to copy the libmysql.dll from the LIB directory of the mysql connector to the bin directory where rails has been installed.
It worked! Thanks a lot :)
– Jubayer Arefin
Oct 28 '13 at 9:22
Thanks Man , saved me lots of time!
– Guy
Nov 4 '13 at 23:13
14
Did not work for me, sadly... Not sure why.
– Nate
Nov 12 '13 at 15:52
6
Make sure you download 32-bit server and 32-bit connector. github.com/oneclick/rubyinstaller/wiki/…
– Duke
Jan 2 '14 at 4:11
the second code worked using 32 bit version of mysql-connector
– user1922137
Feb 1 '14 at 13:06
|
show 10 more comments
EDIT 30/09/2014
When this answer was posted the 64 bit rails installer wasn't the recommended version - it now seems people are starting to use it more. It should be noted when you download the MySQL Connector you need to download either 64 or 32bit to correspond to the version of rails you installed.
Amazingly I lucked upon an answer very early this morning as I happened to be looking for something else of a similar nature. I'm not quite sure why there isn't a single simple guide for this as it appears to be very straight forward!
For some reason just specifying the mysql-dir when you install the gem doesn't pick up with other sub directories so you need to set the parameters manually.
For anyone else experiencing the same problem, I did the following:
1) Download the MySql C Connector from: http://dev.mysql.com/downloads/connector/c/
NOTE Don't download the installer, download the ARCHIVE for your OS
Download either the 32bit or 64 bit ARCHIVE to correspond with the version of rails you installed.
2) Extract the file to C:mysql-connector
3) Then ran:
gem install mysql2 --platform=ruby -- '--with-mysql-lib="C:mysql-connectorlib" --with-mysql-include="C:mysql-connectorinclude" --with-mysql-dir="C:mysql-connector"'
Voila everything is working fine.
EDIT 30/01/2014
I just had to do a fresh install on a bricked machine and the command in step 3 didn't work, what did work was:
gem install mysql2 --platform=ruby -- '--with-mysql-dir="C:mysql-connector"'
I'm not quite sure what the difference is but this time it seems to be picking up the directories ok, so if the first one doesn't work try this one!
I think this has to do with how you go about installing rails, this time round I used the railsinstaller which seems to set the paths up correctly.
A lot of the outcome here seems to depend on the shell your using, a lot of people are having problems with powershell so I wouldn't advise using it. I did this in an elevated command prompt.
Oh and lastly if you get an error regarding the mysql2 gem when you do RAILS S you need to copy the libmysql.dll from the LIB directory of the mysql connector to the bin directory where rails has been installed.
EDIT 30/09/2014
When this answer was posted the 64 bit rails installer wasn't the recommended version - it now seems people are starting to use it more. It should be noted when you download the MySQL Connector you need to download either 64 or 32bit to correspond to the version of rails you installed.
Amazingly I lucked upon an answer very early this morning as I happened to be looking for something else of a similar nature. I'm not quite sure why there isn't a single simple guide for this as it appears to be very straight forward!
For some reason just specifying the mysql-dir when you install the gem doesn't pick up with other sub directories so you need to set the parameters manually.
For anyone else experiencing the same problem, I did the following:
1) Download the MySql C Connector from: http://dev.mysql.com/downloads/connector/c/
NOTE Don't download the installer, download the ARCHIVE for your OS
Download either the 32bit or 64 bit ARCHIVE to correspond with the version of rails you installed.
2) Extract the file to C:mysql-connector
3) Then ran:
gem install mysql2 --platform=ruby -- '--with-mysql-lib="C:mysql-connectorlib" --with-mysql-include="C:mysql-connectorinclude" --with-mysql-dir="C:mysql-connector"'
Voila everything is working fine.
EDIT 30/01/2014
I just had to do a fresh install on a bricked machine and the command in step 3 didn't work, what did work was:
gem install mysql2 --platform=ruby -- '--with-mysql-dir="C:mysql-connector"'
I'm not quite sure what the difference is but this time it seems to be picking up the directories ok, so if the first one doesn't work try this one!
I think this has to do with how you go about installing rails, this time round I used the railsinstaller which seems to set the paths up correctly.
A lot of the outcome here seems to depend on the shell your using, a lot of people are having problems with powershell so I wouldn't advise using it. I did this in an elevated command prompt.
Oh and lastly if you get an error regarding the mysql2 gem when you do RAILS S you need to copy the libmysql.dll from the LIB directory of the mysql connector to the bin directory where rails has been installed.
edited Oct 14 '14 at 20:41
answered Sep 26 '13 at 8:29
Mrk FldigMrk Fldig
2,29851846
2,29851846
It worked! Thanks a lot :)
– Jubayer Arefin
Oct 28 '13 at 9:22
Thanks Man , saved me lots of time!
– Guy
Nov 4 '13 at 23:13
14
Did not work for me, sadly... Not sure why.
– Nate
Nov 12 '13 at 15:52
6
Make sure you download 32-bit server and 32-bit connector. github.com/oneclick/rubyinstaller/wiki/…
– Duke
Jan 2 '14 at 4:11
the second code worked using 32 bit version of mysql-connector
– user1922137
Feb 1 '14 at 13:06
|
show 10 more comments
It worked! Thanks a lot :)
– Jubayer Arefin
Oct 28 '13 at 9:22
Thanks Man , saved me lots of time!
– Guy
Nov 4 '13 at 23:13
14
Did not work for me, sadly... Not sure why.
– Nate
Nov 12 '13 at 15:52
6
Make sure you download 32-bit server and 32-bit connector. github.com/oneclick/rubyinstaller/wiki/…
– Duke
Jan 2 '14 at 4:11
the second code worked using 32 bit version of mysql-connector
– user1922137
Feb 1 '14 at 13:06
It worked! Thanks a lot :)
– Jubayer Arefin
Oct 28 '13 at 9:22
It worked! Thanks a lot :)
– Jubayer Arefin
Oct 28 '13 at 9:22
Thanks Man , saved me lots of time!
– Guy
Nov 4 '13 at 23:13
Thanks Man , saved me lots of time!
– Guy
Nov 4 '13 at 23:13
14
14
Did not work for me, sadly... Not sure why.
– Nate
Nov 12 '13 at 15:52
Did not work for me, sadly... Not sure why.
– Nate
Nov 12 '13 at 15:52
6
6
Make sure you download 32-bit server and 32-bit connector. github.com/oneclick/rubyinstaller/wiki/…
– Duke
Jan 2 '14 at 4:11
Make sure you download 32-bit server and 32-bit connector. github.com/oneclick/rubyinstaller/wiki/…
– Duke
Jan 2 '14 at 4:11
the second code worked using 32 bit version of mysql-connector
– user1922137
Feb 1 '14 at 13:06
the second code worked using 32 bit version of mysql-connector
– user1922137
Feb 1 '14 at 13:06
|
show 10 more comments
I've tried the solution of @Mrk Fldig but it didn't work...
So what solved the problem was:
- Downloaded the lastest MySQL Installer for windows 7 32 bits
- Installed the gem with the following command:
gem install mysql2 --platform=ruby -- '--with-mysql-dir="C:/Program Files/MySQL/MySQL Connector C 6.1 6.1.2/"'
One pitfall to be aware of is that I changed the backslashes () to normal slashes (/). I've tried the same procedure with backslashes and it didn't work.
The installer already includes the C connectors for MySQL at MySQL Connector C 6.1 6.1.2
directory. Therefore, passing only the --with-mysql-dir
parameter without the --with-mysql-lib
or --with-mysql-include
parameters, makes the gem to look at the same directory for the lib
and include
directories
1
This also fixes it for me. But I've just used the archive as per the above instructions. The issue seems to be what shell you're in. I'm running in the msysgit bash shell and multiple --with options seemed to fail with that. Your trick works just fine.
– Alexander Kellett
Jan 14 '14 at 9:13
1
Works fine for me too on CMD. Thanks!
– taiar
Jan 25 '14 at 18:39
add a comment |
I've tried the solution of @Mrk Fldig but it didn't work...
So what solved the problem was:
- Downloaded the lastest MySQL Installer for windows 7 32 bits
- Installed the gem with the following command:
gem install mysql2 --platform=ruby -- '--with-mysql-dir="C:/Program Files/MySQL/MySQL Connector C 6.1 6.1.2/"'
One pitfall to be aware of is that I changed the backslashes () to normal slashes (/). I've tried the same procedure with backslashes and it didn't work.
The installer already includes the C connectors for MySQL at MySQL Connector C 6.1 6.1.2
directory. Therefore, passing only the --with-mysql-dir
parameter without the --with-mysql-lib
or --with-mysql-include
parameters, makes the gem to look at the same directory for the lib
and include
directories
1
This also fixes it for me. But I've just used the archive as per the above instructions. The issue seems to be what shell you're in. I'm running in the msysgit bash shell and multiple --with options seemed to fail with that. Your trick works just fine.
– Alexander Kellett
Jan 14 '14 at 9:13
1
Works fine for me too on CMD. Thanks!
– taiar
Jan 25 '14 at 18:39
add a comment |
I've tried the solution of @Mrk Fldig but it didn't work...
So what solved the problem was:
- Downloaded the lastest MySQL Installer for windows 7 32 bits
- Installed the gem with the following command:
gem install mysql2 --platform=ruby -- '--with-mysql-dir="C:/Program Files/MySQL/MySQL Connector C 6.1 6.1.2/"'
One pitfall to be aware of is that I changed the backslashes () to normal slashes (/). I've tried the same procedure with backslashes and it didn't work.
The installer already includes the C connectors for MySQL at MySQL Connector C 6.1 6.1.2
directory. Therefore, passing only the --with-mysql-dir
parameter without the --with-mysql-lib
or --with-mysql-include
parameters, makes the gem to look at the same directory for the lib
and include
directories
I've tried the solution of @Mrk Fldig but it didn't work...
So what solved the problem was:
- Downloaded the lastest MySQL Installer for windows 7 32 bits
- Installed the gem with the following command:
gem install mysql2 --platform=ruby -- '--with-mysql-dir="C:/Program Files/MySQL/MySQL Connector C 6.1 6.1.2/"'
One pitfall to be aware of is that I changed the backslashes () to normal slashes (/). I've tried the same procedure with backslashes and it didn't work.
The installer already includes the C connectors for MySQL at MySQL Connector C 6.1 6.1.2
directory. Therefore, passing only the --with-mysql-dir
parameter without the --with-mysql-lib
or --with-mysql-include
parameters, makes the gem to look at the same directory for the lib
and include
directories
answered Dec 13 '13 at 13:54
André HerculanoAndré Herculano
9451524
9451524
1
This also fixes it for me. But I've just used the archive as per the above instructions. The issue seems to be what shell you're in. I'm running in the msysgit bash shell and multiple --with options seemed to fail with that. Your trick works just fine.
– Alexander Kellett
Jan 14 '14 at 9:13
1
Works fine for me too on CMD. Thanks!
– taiar
Jan 25 '14 at 18:39
add a comment |
1
This also fixes it for me. But I've just used the archive as per the above instructions. The issue seems to be what shell you're in. I'm running in the msysgit bash shell and multiple --with options seemed to fail with that. Your trick works just fine.
– Alexander Kellett
Jan 14 '14 at 9:13
1
Works fine for me too on CMD. Thanks!
– taiar
Jan 25 '14 at 18:39
1
1
This also fixes it for me. But I've just used the archive as per the above instructions. The issue seems to be what shell you're in. I'm running in the msysgit bash shell and multiple --with options seemed to fail with that. Your trick works just fine.
– Alexander Kellett
Jan 14 '14 at 9:13
This also fixes it for me. But I've just used the archive as per the above instructions. The issue seems to be what shell you're in. I'm running in the msysgit bash shell and multiple --with options seemed to fail with that. Your trick works just fine.
– Alexander Kellett
Jan 14 '14 at 9:13
1
1
Works fine for me too on CMD. Thanks!
– taiar
Jan 25 '14 at 18:39
Works fine for me too on CMD. Thanks!
– taiar
Jan 25 '14 at 18:39
add a comment |
Steps for Ruby 2.1.3, Windows 8.1 and MySQL Server 5.7. All x64 bit.
- Download Development Kit
- Extracted Development Kit.
- Run CMD and go to dir where is Development Kit extracted
- Run
ruby dk.rb init
- Run
ruby dk.rb install
- Run
gem install mysql2 -- '--with-mysql-lib="c:Program FilesMySQLMySQL Server 5.7lib" --with-mysql-include="c:Program FilesMySQLMySQL Server 5.7include" --with-mysql-dir="c:Program FilesMySQLMySQL Server 5.7"'
This solution worked for me on Windows 10, Ruby 2.5.5, MySQL Server 5.7 (all x64 bit). Thank you.
– marianc
May 2 at 22:40
add a comment |
Steps for Ruby 2.1.3, Windows 8.1 and MySQL Server 5.7. All x64 bit.
- Download Development Kit
- Extracted Development Kit.
- Run CMD and go to dir where is Development Kit extracted
- Run
ruby dk.rb init
- Run
ruby dk.rb install
- Run
gem install mysql2 -- '--with-mysql-lib="c:Program FilesMySQLMySQL Server 5.7lib" --with-mysql-include="c:Program FilesMySQLMySQL Server 5.7include" --with-mysql-dir="c:Program FilesMySQLMySQL Server 5.7"'
This solution worked for me on Windows 10, Ruby 2.5.5, MySQL Server 5.7 (all x64 bit). Thank you.
– marianc
May 2 at 22:40
add a comment |
Steps for Ruby 2.1.3, Windows 8.1 and MySQL Server 5.7. All x64 bit.
- Download Development Kit
- Extracted Development Kit.
- Run CMD and go to dir where is Development Kit extracted
- Run
ruby dk.rb init
- Run
ruby dk.rb install
- Run
gem install mysql2 -- '--with-mysql-lib="c:Program FilesMySQLMySQL Server 5.7lib" --with-mysql-include="c:Program FilesMySQLMySQL Server 5.7include" --with-mysql-dir="c:Program FilesMySQLMySQL Server 5.7"'
Steps for Ruby 2.1.3, Windows 8.1 and MySQL Server 5.7. All x64 bit.
- Download Development Kit
- Extracted Development Kit.
- Run CMD and go to dir where is Development Kit extracted
- Run
ruby dk.rb init
- Run
ruby dk.rb install
- Run
gem install mysql2 -- '--with-mysql-lib="c:Program FilesMySQLMySQL Server 5.7lib" --with-mysql-include="c:Program FilesMySQLMySQL Server 5.7include" --with-mysql-dir="c:Program FilesMySQLMySQL Server 5.7"'
answered Oct 9 '14 at 23:18
NebojisaNebojisa
7113
7113
This solution worked for me on Windows 10, Ruby 2.5.5, MySQL Server 5.7 (all x64 bit). Thank you.
– marianc
May 2 at 22:40
add a comment |
This solution worked for me on Windows 10, Ruby 2.5.5, MySQL Server 5.7 (all x64 bit). Thank you.
– marianc
May 2 at 22:40
This solution worked for me on Windows 10, Ruby 2.5.5, MySQL Server 5.7 (all x64 bit). Thank you.
– marianc
May 2 at 22:40
This solution worked for me on Windows 10, Ruby 2.5.5, MySQL Server 5.7 (all x64 bit). Thank you.
– marianc
May 2 at 22:40
add a comment |
This is what worked for me for the same error on Windows 8 64-bit and using ruby 64-bit
- Download and install MySQL Server 5.6 64-bit
Run this command:
gem install mysql2 -v '0.3.16' -- '--with-mysql-lib="c:Program FilesMySQLMySQL Server 5.6lib" --with-mysql-include="c:Program FilesMySQLMySQL Server 5.6include"'
Hope this helps
Nice to know that works too, for my project I already had a remote DB so I didn't need to install!
– Mrk Fldig
Aug 12 '14 at 7:38
Incidentally as far as I know railsinstaller is 32 bit so will require 32 bit libs as per the instructions below.
– Mrk Fldig
Aug 12 '14 at 7:44
add a comment |
This is what worked for me for the same error on Windows 8 64-bit and using ruby 64-bit
- Download and install MySQL Server 5.6 64-bit
Run this command:
gem install mysql2 -v '0.3.16' -- '--with-mysql-lib="c:Program FilesMySQLMySQL Server 5.6lib" --with-mysql-include="c:Program FilesMySQLMySQL Server 5.6include"'
Hope this helps
Nice to know that works too, for my project I already had a remote DB so I didn't need to install!
– Mrk Fldig
Aug 12 '14 at 7:38
Incidentally as far as I know railsinstaller is 32 bit so will require 32 bit libs as per the instructions below.
– Mrk Fldig
Aug 12 '14 at 7:44
add a comment |
This is what worked for me for the same error on Windows 8 64-bit and using ruby 64-bit
- Download and install MySQL Server 5.6 64-bit
Run this command:
gem install mysql2 -v '0.3.16' -- '--with-mysql-lib="c:Program FilesMySQLMySQL Server 5.6lib" --with-mysql-include="c:Program FilesMySQLMySQL Server 5.6include"'
Hope this helps
This is what worked for me for the same error on Windows 8 64-bit and using ruby 64-bit
- Download and install MySQL Server 5.6 64-bit
Run this command:
gem install mysql2 -v '0.3.16' -- '--with-mysql-lib="c:Program FilesMySQLMySQL Server 5.6lib" --with-mysql-include="c:Program FilesMySQLMySQL Server 5.6include"'
Hope this helps
edited Oct 4 '14 at 20:41
rink.attendant.6
17.9k1867113
17.9k1867113
answered Aug 12 '14 at 2:11
Omar M.Omar M.
10115
10115
Nice to know that works too, for my project I already had a remote DB so I didn't need to install!
– Mrk Fldig
Aug 12 '14 at 7:38
Incidentally as far as I know railsinstaller is 32 bit so will require 32 bit libs as per the instructions below.
– Mrk Fldig
Aug 12 '14 at 7:44
add a comment |
Nice to know that works too, for my project I already had a remote DB so I didn't need to install!
– Mrk Fldig
Aug 12 '14 at 7:38
Incidentally as far as I know railsinstaller is 32 bit so will require 32 bit libs as per the instructions below.
– Mrk Fldig
Aug 12 '14 at 7:44
Nice to know that works too, for my project I already had a remote DB so I didn't need to install!
– Mrk Fldig
Aug 12 '14 at 7:38
Nice to know that works too, for my project I already had a remote DB so I didn't need to install!
– Mrk Fldig
Aug 12 '14 at 7:38
Incidentally as far as I know railsinstaller is 32 bit so will require 32 bit libs as per the instructions below.
– Mrk Fldig
Aug 12 '14 at 7:44
Incidentally as far as I know railsinstaller is 32 bit so will require 32 bit libs as per the instructions below.
– Mrk Fldig
Aug 12 '14 at 7:44
add a comment |
I have tried all provided methods but the same error appears again and again :(
Fortunately, older version installed without any errors!
gem uninstall mysql2
gem install mysql2 -v 0.2.6
add a comment |
I have tried all provided methods but the same error appears again and again :(
Fortunately, older version installed without any errors!
gem uninstall mysql2
gem install mysql2 -v 0.2.6
add a comment |
I have tried all provided methods but the same error appears again and again :(
Fortunately, older version installed without any errors!
gem uninstall mysql2
gem install mysql2 -v 0.2.6
I have tried all provided methods but the same error appears again and again :(
Fortunately, older version installed without any errors!
gem uninstall mysql2
gem install mysql2 -v 0.2.6
edited Oct 4 '14 at 20:41
rink.attendant.6
17.9k1867113
17.9k1867113
answered May 30 '14 at 12:24
GediminasGediminas
2,96652340
2,96652340
add a comment |
add a comment |
Try to follow those steps:
I assume:
- a) you use windows7
- b) ruby 2+ on C:Ruby200-x64
- c) rails 4+ installed on ruby
- d) WAMP installed on C:wamp and running
1) uninstall your myslq2 gem:
$ gem uninstall mysql2
2) reinstall the mysql2 gem with path option:
$ gem install mysql2 -- '--with-mysql-lib="C:wampbinmysqlmysql5.6.12lib" --with-mysql-include="C:wampbinmysqlmysql5.6.12include"'
3) copy the libmysql.dll you find in C:wampbinmysqlmysql5.6.12lib into C:Ruby200-x64bin
4) open in your rails app the file "Gemfile" and edit it enabling the mysql2, by adding:
gem 'mysql2'
5) start your rails server:
$ rails server
6) open your browser and go to localhost:3000/
add a comment |
Try to follow those steps:
I assume:
- a) you use windows7
- b) ruby 2+ on C:Ruby200-x64
- c) rails 4+ installed on ruby
- d) WAMP installed on C:wamp and running
1) uninstall your myslq2 gem:
$ gem uninstall mysql2
2) reinstall the mysql2 gem with path option:
$ gem install mysql2 -- '--with-mysql-lib="C:wampbinmysqlmysql5.6.12lib" --with-mysql-include="C:wampbinmysqlmysql5.6.12include"'
3) copy the libmysql.dll you find in C:wampbinmysqlmysql5.6.12lib into C:Ruby200-x64bin
4) open in your rails app the file "Gemfile" and edit it enabling the mysql2, by adding:
gem 'mysql2'
5) start your rails server:
$ rails server
6) open your browser and go to localhost:3000/
add a comment |
Try to follow those steps:
I assume:
- a) you use windows7
- b) ruby 2+ on C:Ruby200-x64
- c) rails 4+ installed on ruby
- d) WAMP installed on C:wamp and running
1) uninstall your myslq2 gem:
$ gem uninstall mysql2
2) reinstall the mysql2 gem with path option:
$ gem install mysql2 -- '--with-mysql-lib="C:wampbinmysqlmysql5.6.12lib" --with-mysql-include="C:wampbinmysqlmysql5.6.12include"'
3) copy the libmysql.dll you find in C:wampbinmysqlmysql5.6.12lib into C:Ruby200-x64bin
4) open in your rails app the file "Gemfile" and edit it enabling the mysql2, by adding:
gem 'mysql2'
5) start your rails server:
$ rails server
6) open your browser and go to localhost:3000/
Try to follow those steps:
I assume:
- a) you use windows7
- b) ruby 2+ on C:Ruby200-x64
- c) rails 4+ installed on ruby
- d) WAMP installed on C:wamp and running
1) uninstall your myslq2 gem:
$ gem uninstall mysql2
2) reinstall the mysql2 gem with path option:
$ gem install mysql2 -- '--with-mysql-lib="C:wampbinmysqlmysql5.6.12lib" --with-mysql-include="C:wampbinmysqlmysql5.6.12include"'
3) copy the libmysql.dll you find in C:wampbinmysqlmysql5.6.12lib into C:Ruby200-x64bin
4) open in your rails app the file "Gemfile" and edit it enabling the mysql2, by adding:
gem 'mysql2'
5) start your rails server:
$ rails server
6) open your browser and go to localhost:3000/
answered Mar 20 '14 at 15:12
EdoardoEdoardo
874
874
add a comment |
add a comment |
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-win32liblibmysql.dll file to C:RailsInstallerRuby1.9.3bin
Step 5 :bundle update && Start rails server
add a comment |
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-win32liblibmysql.dll file to C:RailsInstallerRuby1.9.3bin
Step 5 :bundle update && Start rails server
add a comment |
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-win32liblibmysql.dll file to C:RailsInstallerRuby1.9.3bin
Step 5 :bundle update && Start rails server
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-win32liblibmysql.dll file to C:RailsInstallerRuby1.9.3bin
Step 5 :bundle update && Start rails server
answered May 21 '14 at 9:15
Prasanth RJPrasanth RJ
11918
11918
add a comment |
add a comment |
Here's what worked for me:
gem install mysql2 -- '--with-mysql-dir="C:wampbinmysqlmysql5.5.xx"'
Been searching for a few hours and not seen this variation suggested, so hopefully it will help someone!
add a comment |
Here's what worked for me:
gem install mysql2 -- '--with-mysql-dir="C:wampbinmysqlmysql5.5.xx"'
Been searching for a few hours and not seen this variation suggested, so hopefully it will help someone!
add a comment |
Here's what worked for me:
gem install mysql2 -- '--with-mysql-dir="C:wampbinmysqlmysql5.5.xx"'
Been searching for a few hours and not seen this variation suggested, so hopefully it will help someone!
Here's what worked for me:
gem install mysql2 -- '--with-mysql-dir="C:wampbinmysqlmysql5.5.xx"'
Been searching for a few hours and not seen this variation suggested, so hopefully it will help someone!
answered May 31 '14 at 14:50
user1105056user1105056
66118
66118
add a comment |
add a comment |
Also try disabling your antivirus before installing the gem. Mine got installed after I ran following command :
gem install mysql2 --platform=ruby -- '--with-mysql-lib=
"C:mysql-connectorlib" --with-mysql-include="C:mysql-connectorinclude" --wit
h-mysql-dir="C:mysql-connector"'
Same command was not working when my antivirus was enabled, as it was pushing some ruby file to chest.
Hope this helps someone.
THANK YOU I've been looking everywhere, but nothing was working. This worked for me.
– Padagomez
Jul 3 '14 at 15:28
thats great (Y)
– hira umair
Jul 15 '14 at 5:57
add a comment |
Also try disabling your antivirus before installing the gem. Mine got installed after I ran following command :
gem install mysql2 --platform=ruby -- '--with-mysql-lib=
"C:mysql-connectorlib" --with-mysql-include="C:mysql-connectorinclude" --wit
h-mysql-dir="C:mysql-connector"'
Same command was not working when my antivirus was enabled, as it was pushing some ruby file to chest.
Hope this helps someone.
THANK YOU I've been looking everywhere, but nothing was working. This worked for me.
– Padagomez
Jul 3 '14 at 15:28
thats great (Y)
– hira umair
Jul 15 '14 at 5:57
add a comment |
Also try disabling your antivirus before installing the gem. Mine got installed after I ran following command :
gem install mysql2 --platform=ruby -- '--with-mysql-lib=
"C:mysql-connectorlib" --with-mysql-include="C:mysql-connectorinclude" --wit
h-mysql-dir="C:mysql-connector"'
Same command was not working when my antivirus was enabled, as it was pushing some ruby file to chest.
Hope this helps someone.
Also try disabling your antivirus before installing the gem. Mine got installed after I ran following command :
gem install mysql2 --platform=ruby -- '--with-mysql-lib=
"C:mysql-connectorlib" --with-mysql-include="C:mysql-connectorinclude" --wit
h-mysql-dir="C:mysql-connector"'
Same command was not working when my antivirus was enabled, as it was pushing some ruby file to chest.
Hope this helps someone.
edited Jun 26 '14 at 10:43
byJeevan
2,41312445
2,41312445
answered Jun 26 '14 at 10:23
hira umairhira umair
91
91
THANK YOU I've been looking everywhere, but nothing was working. This worked for me.
– Padagomez
Jul 3 '14 at 15:28
thats great (Y)
– hira umair
Jul 15 '14 at 5:57
add a comment |
THANK YOU I've been looking everywhere, but nothing was working. This worked for me.
– Padagomez
Jul 3 '14 at 15:28
thats great (Y)
– hira umair
Jul 15 '14 at 5:57
THANK YOU I've been looking everywhere, but nothing was working. This worked for me.
– Padagomez
Jul 3 '14 at 15:28
THANK YOU I've been looking everywhere, but nothing was working. This worked for me.
– Padagomez
Jul 3 '14 at 15:28
thats great (Y)
– hira umair
Jul 15 '14 at 5:57
thats great (Y)
– hira umair
Jul 15 '14 at 5:57
add a comment |
For Cygwin, I could consolidate various steps.
- Use cygwin setup.exe to download gcc, g++, make, cmake and libmysqlclient-devel (from cygwin ports)
- Download c/connector src for windows from mysql site. I downloaded 6.x version. OR download libmysqlclient-devel's version (not sure from where)
- unzip
- cd dir_connector
- Not required and RISKY, but if cygwin libmysqlclient-devel version is 5.5.40 , then change dir_connector/VERSION file's versions to 5.5.40
- mkdir build
- cd build
- comment dtoa in stdlib.h, else compilation is failing
- cmake ..
- make
- make install
- gem install mysql2 -- --with-mysql-config=/usr/local/mysql/bin/mysql_config
add a comment |
For Cygwin, I could consolidate various steps.
- Use cygwin setup.exe to download gcc, g++, make, cmake and libmysqlclient-devel (from cygwin ports)
- Download c/connector src for windows from mysql site. I downloaded 6.x version. OR download libmysqlclient-devel's version (not sure from where)
- unzip
- cd dir_connector
- Not required and RISKY, but if cygwin libmysqlclient-devel version is 5.5.40 , then change dir_connector/VERSION file's versions to 5.5.40
- mkdir build
- cd build
- comment dtoa in stdlib.h, else compilation is failing
- cmake ..
- make
- make install
- gem install mysql2 -- --with-mysql-config=/usr/local/mysql/bin/mysql_config
add a comment |
For Cygwin, I could consolidate various steps.
- Use cygwin setup.exe to download gcc, g++, make, cmake and libmysqlclient-devel (from cygwin ports)
- Download c/connector src for windows from mysql site. I downloaded 6.x version. OR download libmysqlclient-devel's version (not sure from where)
- unzip
- cd dir_connector
- Not required and RISKY, but if cygwin libmysqlclient-devel version is 5.5.40 , then change dir_connector/VERSION file's versions to 5.5.40
- mkdir build
- cd build
- comment dtoa in stdlib.h, else compilation is failing
- cmake ..
- make
- make install
- gem install mysql2 -- --with-mysql-config=/usr/local/mysql/bin/mysql_config
For Cygwin, I could consolidate various steps.
- Use cygwin setup.exe to download gcc, g++, make, cmake and libmysqlclient-devel (from cygwin ports)
- Download c/connector src for windows from mysql site. I downloaded 6.x version. OR download libmysqlclient-devel's version (not sure from where)
- unzip
- cd dir_connector
- Not required and RISKY, but if cygwin libmysqlclient-devel version is 5.5.40 , then change dir_connector/VERSION file's versions to 5.5.40
- mkdir build
- cd build
- comment dtoa in stdlib.h, else compilation is failing
- cmake ..
- make
- make install
- gem install mysql2 -- --with-mysql-config=/usr/local/mysql/bin/mysql_config
answered Nov 14 '14 at 8:12
ndasndas
11714
11714
add a comment |
add a comment |
Ruby installer
rubyinstaller-devkit-2.5.3-1-x64
Mysql connector: mysql-connector-c-6.1.11-win32
https://downloads.mysql.com/archives/c-c/?version=6.1.2&os=src
Gem install:
gem install mysql2 --platform=ruby -- --with-mysql-lib="c:mysql-connector-c-6.1.11-win32"
Please don't write code-only answers.
– JJJ
Mar 23 at 12:25
Upvoted because JJJ being a bit mean there(assuming JJJ downvoted), welcome to StackOverflow generally speaking you should give me a bit more of a write up your answers, whilst the answer may be correct you should explain the steps ;-)
– Mrk Fldig
Mar 25 at 11:59
add a comment |
Ruby installer
rubyinstaller-devkit-2.5.3-1-x64
Mysql connector: mysql-connector-c-6.1.11-win32
https://downloads.mysql.com/archives/c-c/?version=6.1.2&os=src
Gem install:
gem install mysql2 --platform=ruby -- --with-mysql-lib="c:mysql-connector-c-6.1.11-win32"
Please don't write code-only answers.
– JJJ
Mar 23 at 12:25
Upvoted because JJJ being a bit mean there(assuming JJJ downvoted), welcome to StackOverflow generally speaking you should give me a bit more of a write up your answers, whilst the answer may be correct you should explain the steps ;-)
– Mrk Fldig
Mar 25 at 11:59
add a comment |
Ruby installer
rubyinstaller-devkit-2.5.3-1-x64
Mysql connector: mysql-connector-c-6.1.11-win32
https://downloads.mysql.com/archives/c-c/?version=6.1.2&os=src
Gem install:
gem install mysql2 --platform=ruby -- --with-mysql-lib="c:mysql-connector-c-6.1.11-win32"
Ruby installer
rubyinstaller-devkit-2.5.3-1-x64
Mysql connector: mysql-connector-c-6.1.11-win32
https://downloads.mysql.com/archives/c-c/?version=6.1.2&os=src
Gem install:
gem install mysql2 --platform=ruby -- --with-mysql-lib="c:mysql-connector-c-6.1.11-win32"
answered Mar 23 at 12:07
dnthanhdnthanh
11
11
Please don't write code-only answers.
– JJJ
Mar 23 at 12:25
Upvoted because JJJ being a bit mean there(assuming JJJ downvoted), welcome to StackOverflow generally speaking you should give me a bit more of a write up your answers, whilst the answer may be correct you should explain the steps ;-)
– Mrk Fldig
Mar 25 at 11:59
add a comment |
Please don't write code-only answers.
– JJJ
Mar 23 at 12:25
Upvoted because JJJ being a bit mean there(assuming JJJ downvoted), welcome to StackOverflow generally speaking you should give me a bit more of a write up your answers, whilst the answer may be correct you should explain the steps ;-)
– Mrk Fldig
Mar 25 at 11:59
Please don't write code-only answers.
– JJJ
Mar 23 at 12:25
Please don't write code-only answers.
– JJJ
Mar 23 at 12:25
Upvoted because JJJ being a bit mean there(assuming JJJ downvoted), welcome to StackOverflow generally speaking you should give me a bit more of a write up your answers, whilst the answer may be correct you should explain the steps ;-)
– Mrk Fldig
Mar 25 at 11:59
Upvoted because JJJ being a bit mean there(assuming JJJ downvoted), welcome to StackOverflow generally speaking you should give me a bit more of a write up your answers, whilst the answer may be correct you should explain the steps ;-)
– Mrk Fldig
Mar 25 at 11:59
add a comment |
I downloaded the devkit 32-bit, with my 64-bit pc, however I realize that railsinstaller apparently installs a 32-bit version by default, so I have directed all facilities 32bit.
Initialize the ruby devkit dk.rb init
Download the mysql connector 32-bit, and place it in the mysql-connector C: mysql-connector
You should be aware, that when you unzip the file, it creates a subfolder with the same name and can give errors.
Then use the second command listed above:
gem install mysql2 - platform = ruby - '- with-mysql-dir = "C: mysql-connector"'
This was the solution I found, as I had the same problem.
add a comment |
I downloaded the devkit 32-bit, with my 64-bit pc, however I realize that railsinstaller apparently installs a 32-bit version by default, so I have directed all facilities 32bit.
Initialize the ruby devkit dk.rb init
Download the mysql connector 32-bit, and place it in the mysql-connector C: mysql-connector
You should be aware, that when you unzip the file, it creates a subfolder with the same name and can give errors.
Then use the second command listed above:
gem install mysql2 - platform = ruby - '- with-mysql-dir = "C: mysql-connector"'
This was the solution I found, as I had the same problem.
add a comment |
I downloaded the devkit 32-bit, with my 64-bit pc, however I realize that railsinstaller apparently installs a 32-bit version by default, so I have directed all facilities 32bit.
Initialize the ruby devkit dk.rb init
Download the mysql connector 32-bit, and place it in the mysql-connector C: mysql-connector
You should be aware, that when you unzip the file, it creates a subfolder with the same name and can give errors.
Then use the second command listed above:
gem install mysql2 - platform = ruby - '- with-mysql-dir = "C: mysql-connector"'
This was the solution I found, as I had the same problem.
I downloaded the devkit 32-bit, with my 64-bit pc, however I realize that railsinstaller apparently installs a 32-bit version by default, so I have directed all facilities 32bit.
Initialize the ruby devkit dk.rb init
Download the mysql connector 32-bit, and place it in the mysql-connector C: mysql-connector
You should be aware, that when you unzip the file, it creates a subfolder with the same name and can give errors.
Then use the second command listed above:
gem install mysql2 - platform = ruby - '- with-mysql-dir = "C: mysql-connector"'
This was the solution I found, as I had the same problem.
answered Feb 15 '14 at 20:29
KrazSoftwareKrazSoftware
11
11
add a comment |
add a comment |
On Windows 7 I found that the existing answers provided a partial solution, but I still couldn't get it to install.
The problem I had was that the MySQL Community Edition Windows installer I used insisted on putting the connectors in folders called things like C:MySQLMySQL Connector C 6.1.3
. The build process in the gem was reporting that it could not find "C:MySQLMySQL" ( and before that when I had it in Program Files, it complained it couldn't find "C:Programincludes" ) so clearly the spaces were a problem and I couldn't find a way to escape them that it could understand- possibly someone will be able to suggest one of those.
Because I wasn't sure whether changing these would break the installation, once I realised why the problem was arising I just created a symlink from the command line ( something that is easier from cmd
than powershell ) like this:
C:MySQL> mklink /D ConnectorC ".MySQL Connector C 6.1.3"
Then I could use the following install line:
gem install mysql2 --platform=ruby -- '--with-mysql-dir="C:/MySQL/ConnectorC/"'
This worked correctly.
Also, when I tried to use it, I ran into this problem so it may be useful to be aware that moving the MySQL lib file from the C Connector lib folder could be helpful.
add a comment |
On Windows 7 I found that the existing answers provided a partial solution, but I still couldn't get it to install.
The problem I had was that the MySQL Community Edition Windows installer I used insisted on putting the connectors in folders called things like C:MySQLMySQL Connector C 6.1.3
. The build process in the gem was reporting that it could not find "C:MySQLMySQL" ( and before that when I had it in Program Files, it complained it couldn't find "C:Programincludes" ) so clearly the spaces were a problem and I couldn't find a way to escape them that it could understand- possibly someone will be able to suggest one of those.
Because I wasn't sure whether changing these would break the installation, once I realised why the problem was arising I just created a symlink from the command line ( something that is easier from cmd
than powershell ) like this:
C:MySQL> mklink /D ConnectorC ".MySQL Connector C 6.1.3"
Then I could use the following install line:
gem install mysql2 --platform=ruby -- '--with-mysql-dir="C:/MySQL/ConnectorC/"'
This worked correctly.
Also, when I tried to use it, I ran into this problem so it may be useful to be aware that moving the MySQL lib file from the C Connector lib folder could be helpful.
add a comment |
On Windows 7 I found that the existing answers provided a partial solution, but I still couldn't get it to install.
The problem I had was that the MySQL Community Edition Windows installer I used insisted on putting the connectors in folders called things like C:MySQLMySQL Connector C 6.1.3
. The build process in the gem was reporting that it could not find "C:MySQLMySQL" ( and before that when I had it in Program Files, it complained it couldn't find "C:Programincludes" ) so clearly the spaces were a problem and I couldn't find a way to escape them that it could understand- possibly someone will be able to suggest one of those.
Because I wasn't sure whether changing these would break the installation, once I realised why the problem was arising I just created a symlink from the command line ( something that is easier from cmd
than powershell ) like this:
C:MySQL> mklink /D ConnectorC ".MySQL Connector C 6.1.3"
Then I could use the following install line:
gem install mysql2 --platform=ruby -- '--with-mysql-dir="C:/MySQL/ConnectorC/"'
This worked correctly.
Also, when I tried to use it, I ran into this problem so it may be useful to be aware that moving the MySQL lib file from the C Connector lib folder could be helpful.
On Windows 7 I found that the existing answers provided a partial solution, but I still couldn't get it to install.
The problem I had was that the MySQL Community Edition Windows installer I used insisted on putting the connectors in folders called things like C:MySQLMySQL Connector C 6.1.3
. The build process in the gem was reporting that it could not find "C:MySQLMySQL" ( and before that when I had it in Program Files, it complained it couldn't find "C:Programincludes" ) so clearly the spaces were a problem and I couldn't find a way to escape them that it could understand- possibly someone will be able to suggest one of those.
Because I wasn't sure whether changing these would break the installation, once I realised why the problem was arising I just created a symlink from the command line ( something that is easier from cmd
than powershell ) like this:
C:MySQL> mklink /D ConnectorC ".MySQL Connector C 6.1.3"
Then I could use the following install line:
gem install mysql2 --platform=ruby -- '--with-mysql-dir="C:/MySQL/ConnectorC/"'
This worked correctly.
Also, when I tried to use it, I ran into this problem so it may be useful to be aware that moving the MySQL lib file from the C Connector lib folder could be helpful.
edited May 23 '17 at 12:17
Community♦
11
11
answered Apr 9 '14 at 9:24
glenatronglenatron
8,21495493
8,21495493
add a comment |
add a comment |
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
- Install ruby version 2.0.0p481 (?)
- Devkit blah blah
- Install rails version 4.0.0
- Download Mysql Connector C 64 bit zip file, put in C drive as mysqlc
- Take DLL from that bin, put it in lib of ruby
- gem install mysql2 -- -- with-mysql-dir="C:mysqlc"
add a comment |
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
- Install ruby version 2.0.0p481 (?)
- Devkit blah blah
- Install rails version 4.0.0
- Download Mysql Connector C 64 bit zip file, put in C drive as mysqlc
- Take DLL from that bin, put it in lib of ruby
- gem install mysql2 -- -- with-mysql-dir="C:mysqlc"
add a comment |
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
- Install ruby version 2.0.0p481 (?)
- Devkit blah blah
- Install rails version 4.0.0
- Download Mysql Connector C 64 bit zip file, put in C drive as mysqlc
- Take DLL from that bin, put it in lib of ruby
- gem install mysql2 -- -- with-mysql-dir="C:mysqlc"
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
- Install ruby version 2.0.0p481 (?)
- Devkit blah blah
- Install rails version 4.0.0
- Download Mysql Connector C 64 bit zip file, put in C drive as mysqlc
- Take DLL from that bin, put it in lib of ruby
- gem install mysql2 -- -- with-mysql-dir="C:mysqlc"
answered Jul 26 '14 at 21:16
user3880577user3880577
1
1
add a comment |
add a comment |
It worked for me after adding some tweaks
gem install mysql2 --platform=ruby -- '--with-mysql-lib="C:Program FilesMySQLMySQL Connector C 6.1.5lib" --with-mysql-include="C:Program FilesMySQLMySQL Connector C 6.1.5include" --with-mysql-dir="C:Program FilesMySQLMySQL Connector C 6.1.5"
Heh, yeah thats what the first option was, glad its sorted!
– Mrk Fldig
Aug 19 '14 at 7:12
add a comment |
It worked for me after adding some tweaks
gem install mysql2 --platform=ruby -- '--with-mysql-lib="C:Program FilesMySQLMySQL Connector C 6.1.5lib" --with-mysql-include="C:Program FilesMySQLMySQL Connector C 6.1.5include" --with-mysql-dir="C:Program FilesMySQLMySQL Connector C 6.1.5"
Heh, yeah thats what the first option was, glad its sorted!
– Mrk Fldig
Aug 19 '14 at 7:12
add a comment |
It worked for me after adding some tweaks
gem install mysql2 --platform=ruby -- '--with-mysql-lib="C:Program FilesMySQLMySQL Connector C 6.1.5lib" --with-mysql-include="C:Program FilesMySQLMySQL Connector C 6.1.5include" --with-mysql-dir="C:Program FilesMySQLMySQL Connector C 6.1.5"
It worked for me after adding some tweaks
gem install mysql2 --platform=ruby -- '--with-mysql-lib="C:Program FilesMySQLMySQL Connector C 6.1.5lib" --with-mysql-include="C:Program FilesMySQLMySQL Connector C 6.1.5include" --with-mysql-dir="C:Program FilesMySQLMySQL Connector C 6.1.5"
edited Aug 18 '14 at 19:34
Volker E.
4,399103862
4,399103862
answered Aug 18 '14 at 19:08
MusaMusa
1
1
Heh, yeah thats what the first option was, glad its sorted!
– Mrk Fldig
Aug 19 '14 at 7:12
add a comment |
Heh, yeah thats what the first option was, glad its sorted!
– Mrk Fldig
Aug 19 '14 at 7:12
Heh, yeah thats what the first option was, glad its sorted!
– Mrk Fldig
Aug 19 '14 at 7:12
Heh, yeah thats what the first option was, glad its sorted!
– Mrk Fldig
Aug 19 '14 at 7:12
add a comment |
None of that worked for me, until I realized that I have the 64-bit version of the DevKit installed. So I downloaded the 64-bit MySQL Connector/C from MySQL website
and installed the gem with the "with-mysql-dir" option
add a comment |
None of that worked for me, until I realized that I have the 64-bit version of the DevKit installed. So I downloaded the 64-bit MySQL Connector/C from MySQL website
and installed the gem with the "with-mysql-dir" option
add a comment |
None of that worked for me, until I realized that I have the 64-bit version of the DevKit installed. So I downloaded the 64-bit MySQL Connector/C from MySQL website
and installed the gem with the "with-mysql-dir" option
None of that worked for me, until I realized that I have the 64-bit version of the DevKit installed. So I downloaded the 64-bit MySQL Connector/C from MySQL website
and installed the gem with the "with-mysql-dir" option
answered Sep 27 '14 at 12:56
user3282989user3282989
165
165
add a comment |
add a comment |
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.
add a comment |
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.
add a comment |
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 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.
answered May 31 '16 at 14:20
wired00wired00
9,25745860
9,25745860
add a comment |
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f19014117%2fruby-mysql2-gem-installation-on-windows-7%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
As it indicates, check out: Results logged to C:/Ruby200/lib/ruby/gems/2.0.0/gems/mysql2-0.3.13/ext/mysql2/g em_make.out and also mkmf.log for descriptive errors. Post them here. It probably needs headers such as by supplying "gem install mysql2 -- --with-MySQL-lib=<MySQL source file that matches the correct mod level>". These files can be downloaded to permit installation, but make sure it matches your gem's mod level. I use BitNami Rubystack on Windows 8 which includes MySQL. RailsInstaller is a very popular comprehensive install.
– Richard_G
Sep 26 '13 at 4:11
It may be a problem with native gem installation. Can you install other native gems like bson_ext?
– crazybob
Sep 26 '13 at 6:05
Yeah thanks for the help guys, @R_G yeah you were right I needed to specify the locations for each of the required files via the gem command below, quite why gem install doesn't look in the same folder i'm not sure, I was trying to stay away from bundled installers as it helps me understand rails a bit better!
– Mrk Fldig
Sep 26 '13 at 8:33
possible duplicate of Unable to install mysql2 gem on windows 7
– André Herculano
Dec 13 '13 at 13:56
Read the yellow text at the top of my question. That's the reason the mysql gem nor the mysql2 gem won't install! stackoverflow.com/questions/30361280/…
– MacGyver
May 22 '15 at 1:40