Bundler will not install mysql2

First of all, I went through dozens of posts here on SO and google, and could not find the answer. I am trying to install mysql2 with bundler and it will not do this.

Powered by Ubuntu 11.04 Natty Server

Here is some background information:

ruby -v ruby 1.8.7 (2012-02-08 patchlevel 358) [x86_64-linux] gem -v 1.8.24 rails -v Rails 3.2.5 $ mysql --version mysql Ver 14.14 Distrib 5.1.62, for debian-linux-gnu (x86_64) using readline 6.2 

I have a gem "mysql2", "~> 0.3.11" in my gemfile

When I execute bundle install , it goes through the process and succeeds ( No errors ), but it does not install mysql2. When I do a bundle show , mysql2 is not specified.

I tried the gazillion recommended here and on the forums and still cannot get mysql2 to install using bundler.

Any ideas?

Thanks.

+4
source share
2 answers

So, after many attempts, reading and pulling hair, I found out what the problem is, so I send it to those who may encounter the same situation.

The reason the bundler will not install mysql2 is because the stone was inside this platform structure, see below:

 platforms :mri_19, :mingw_19 do group :mysql do gem "mysql2", "0.3.11" end end 

So, all I did was move only the gem "mysql2", "0.3.11" by itself to the top of the Gemfile and run bundle install , and that did it! Mysql2 is now listed in the package list, and the rails application is now running.

Thanks to everyone who tried to help!

+2
source

For mysql2 you need to install dev files on your server.

try first:

 sudo apt-get install libmysqlclient-dev 

Then first check your GemFile in your RoR root directory. I have this line in my GemFile:

 gem 'mysql2', '0.3.11' 

execute package:

 bundle install 

or try the command from Emily first, then install the package:

 gem install mysql2 -v=0.3.11 bundle install 

I hope this helps

+9
source

All Articles