Question

gem install mysql2 failed on on Ubuntu 14.04

  • Posted on September 10, 2014
  • lucashesgAsked by lucashesg
~# gem install mysql2
Building native extensions.  This could take a while...
ERROR:  Error installing mysql2:
        ERROR: Failed to build gem native extension.

    /usr/local/rvm/rubies/ruby-2.0.0-p353/bin/ruby extconf.rb

Gem files will remain installed in /usr/local/rvm/gems/ruby-2.0.0-p353/gems/mysql2-0.3.16 for inspection.

I google and tried the below but still the same error. Pleas help! Thank you!

sudo apt-get install mysql-client libmysqlclient-dev

Show comments

Submit an answer

This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Want to learn more? Join the DigitalOcean Community!

Join our DigitalOcean community of over a million developers for free! Get help and share knowledge in Q&A, subscribe to topics of interest, and get courses and tools that will help you grow as a developer and scale your project or business.

It looks like you are probably missing something needed to compile the mysql2 gem’s C extension. Try installing the following packages:

sudo apt-get install build-essential libmysqlclient-dev
sudo apt-get install build-essential libmysqlclient-dev

works for me! thanks

Also need to install ruby2.*-dev