ERROR: Failed to build gem native extension (mysql2 on rails 3.2.3)

♀尐吖头ヾ 提交于 2019-11-28 03:33:39

From https://github.com/brianmario/mysql2/issues/8

just copied this in the console

sudo apt-get install mysql-client libmysqlclient-dev

and worked!!

I used Homebrew for Mac to install mysql:

brew install mysql

Then I used a gem command to install the mysql2 gem:

sudo gem install mysql2
sameera207

This is mostly due to lack of mysql headers, Try to install mysql developer (mysql-devel) packages

Normally this error comes when 'libmysqlclient-dev' package is missing

I just ran into the same problem, using OS X Sierra and MAMP and Rails 5. I successfully installed the gem via

gem install mysql2 -- --with-mysql-config=/Applications/MAMP/Library/bin/mysql_config

After that, bundle install worked just fine.

I ended up just installing a fresh copy of MySQL and not using MAMP and that did the trick. Also had to be sure to install the 64-bit version, not 32-bit.

maniempire

You can follow this thread Errors Installing mysql2 gem via the Bundler which explains the solution for Centos and this problem will be fixed, if you tweak the commands w.r.t your OS and you can be able to successfully install the mysql2 gem.

Just add MAMP mysql to PATH, then you can run bundle install as per normal.

$ /Applications/MAMP/Library/bin/mysql --host=localhost -uroot -proot

source: http://blog-en.mamp.info/2009/08/using-mysql-command-line-with-mamp.html

When I got this error, I was able to fix this by running:

gem install devtools
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!