I am having some problems when trying to install mysql2
gem for Rails. When I try to install it by running bundle install
or gem install mysql2
it gives me the following error:
Error installing mysql2: ERROR: Failed to build gem native extension.
How can I fix this and successfully install mysql2
?
I'm on a mac and use homebrew to install open source programs. I did have to install mac Dev tools in order to install homebrew, but after that it was a simple:
to install mysql. I haven't had a mysql gem problem since.
If you are using yum try:
For windows user: You set the lib and include path of your mysql, for instance, if youre using xampp you can have like this:
You have to Install some dependencies
Solution only works on Mac OS X
If you've installed MySQL with homebrew, what worked for me was uninstalling MySQL, and installing MySQL Community Edition via the MySQL website (https://www.mysql.com/).
After installed, just re-enter the command to
gem install mysql2
or if necessary,sudo gem install mysql2
, if you are getting permission denied problems.You are getting this problem because you have not install MySql. Before install mysql2 gem. Install MySQL. After that mysql2 gem will install.