Ubuntu – Problem in installing thesql2 in ubuntu 14.04 in virtual box

software installation

When I run this command, I got this error

$ sudo gem install mysql2
Building native extensions.  This could take a while...
ERROR:  Error installing mysql2:
    ERROR: Failed to build gem native extension.

Best Answer

You need to install a few mandatory packages for gem to work. Should be ...

sudo apt-get install libmysql-ruby libmysqlclient-dev

and after that

sudo gem install mysql2

will work.