debugsqlrailsCritical
Error installing mysql2: Failed to build gem native extension
Viewed 0 times
errorinstallingnativeextensiongemmysql2buildfailed
Problem
I am having some problems when trying to install
Error installing mysql2: ERROR: Failed to build gem native extension.
How can I fix this and successfully 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?Solution
On Ubuntu/Debian and other distributions using aptitude:
Package
If the above command doesn't work because
On Red Hat/CentOS and other distributions using yum:
On Mac OS X with Homebrew:
sudo apt-get install libmysql-ruby libmysqlclient-devPackage
libmysql-ruby has been phased out and replaced by ruby-mysql. This is where I found the solution.If the above command doesn't work because
libmysql-ruby cannot be found, the following should be sufficient:sudo apt-get install libmysqlclient-devOn Red Hat/CentOS and other distributions using yum:
sudo yum install mysql-develOn Mac OS X with Homebrew:
brew install mysqlCode Snippets
sudo apt-get install libmysql-ruby libmysqlclient-devsudo apt-get install libmysqlclient-devsudo yum install mysql-develbrew install mysqlContext
Stack Overflow Q#3608287, score: 988
Revisions (0)
No revisions yet.