Focus on IT Recommend

Home > ruby on rails - mysql2 gem installation on linux

ruby on rails - mysql2 gem installation on linux

I am trying to install a gem on linux but it is giving me an error:

An error occured while installing mysql2 (0.3.11), and Bundler cannot continue.
Make sure that gem install mysql2 -v '0.3.11' succeeds before bundling.

What do I need to do now?

  this question
edited Aug 10 '12 at 10:35 Frederick Cheung 65.1k 5 90 117 asked Aug 10 '12 at 10:26 priyamoralwar 26 1 2


2 Answers

Probably, it can't build mysql2 native extension.

If you're using Ubuntu 14.04 or newer, try sudo apt-get install ruby-mysql libmysqlclient-dev.

On older versions of Ubuntu install this: sudo apt-get install libmysql-ruby libmysqlclient-dev

On OS X: brew install mysql

There are also similar questions: 1, 2, 3.

Recommend:ruby on rails - Cannot load mysql2 gem

I have to fix this without touching the Gemfile. I'm currently creating my working environment so that it matches the production server, so, I cannot modify the rails' code at all. My OS: OSX 10.11 Ruby: ruby 2.0.0p643 Rails: 4.0.0 The gem

  this answer
edited Mar 5 '16 at 1:11 answered Aug 10 '12 at 10:36 Resure 364 5 16 1   it is ruby-mysql now instead of libmysql-ruby –  avguchenko Mar 4 '16 at 22:36      Thanks, I've updated the answer. –  Resure Mar 5 '16 at 1:12


I was using LInux 16 Cinnamon and got that error message. I used "Resure"'s, solution sudo apt-get install libmysql-ruby libmysqlclient-dev

then ran bundle install for project.

It worked!

  this answer
answered Jul 21 '14 at 3:12 user3386050 73 10


Recommend:mysql - gem mysql2 not installed on ruby on rails

lling mysql2: Failed to build gem native extension 23 answers I have installed following versions: ruby 1.9.3p484 (2013-11-22) [i386-mingw32] rails 4.0.2 DevKit-tdm-32-4.5.2-20111229-1559-sfx rubygems-2.1.11 MySQL Server 5.6 mysql-connector


------splitte line----------------------------