Failure to Install Old MySQL2 Gem

Failure to install old mysql2 gem

As per the description shared it seems like the mysql dependencies are unable to install.

First we need to ‘locate mysql_config’ and then replace the path in the following command with where that file is.

gem install mysql2 -- --with-mysql-config=/usr/local/mysql/bin/mysql_config

Error installing mysql2: Failed to build gem native extension

On Ubuntu/Debian and other distributions using aptitude:

sudo apt-get install libmysql-ruby libmysqlclient-dev

Package 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-dev

On Red Hat/CentOS and other distributions using yum:

sudo yum install mysql-devel

On Mac OS X with Homebrew:

brew install mysql

Problems installing mysql2 gem

Somehow, after several tries typing this worked:

$ gem install mysql2 -- --srcdir=/usr/local/mysql/include

But then the server wouldn't run.

But typing from this answer, worked:

$ gem uninstall mysql2
$ gem install mysql2 --platform=ruby

Ruby gem mysql2 install failing

You have to have 64-bit MySQL installed on your machine, plus the build tools you get when you install xcode.

Error installing mysql2 gem version '0.3.21' on Ubuntu 20.04

I solved the issue. I ran the following command

gem install mysql2 -v '0.3.21' -- --srcdir=/var/lib/mysql

where srcdir is pointing to the local installation of mysql.

Error installing gem mysql2 -v 0.3.21 on RHEL 8

The mysql2 gem in version 0.3.21 is not compatible with MySQL 8.0.

As such, unless there are any actual concerns, you should update your gem versions (both on testing and production). mysql2 0.4.10 (the last version of 0.4.x) should be compatible with your Rails version and supports MySQL 8.0. If you can also update Rails to at least 4.2.11.3 (which you should, there were a lot of security fixes since version 4.2.7.1), you can also use mysql2 0.5.x.

In any case all of the ruby software versions you mentioned (i.e. ruby itself, rails and mysql2) are outdated and do not receive any updates in their respective branches anymore. You should invest to update all of those to newer supported versions.

mysql2 gem installation fails

I got this working:

 wget http://cdn.mysql.com/Downloads/MySQL-5.5/MySQL-devel-5.5.27-1.el6.x86_64.rpm 

rpm -Uvh MySQL-devel-5.5.27-1.el6.x86_64.rpm

gem install mysql

gem install mysql2


Related Topics



Leave a reply



Submit