I\'m trying to get MySQL installed to the latest version due to some installation going wrong somewhere along the line. I run the command gem install mysql
and
If you use Percona Mysql server
$ yum install Percona-Server-devel-55
$ gem install mysql
First of all you need to differentiate between the MySQL as Server, MySQL as Client and the Ruby bindings to MySQL.
I'm not familiar with Mac, but for *nix OS you need to install MySQL through your package manager. To get the Ruby bindings installed with
gem install mysql
you need the development headers of ruby (in Ubuntu it is the package ruby-dev) and the development headers of the MySQL-Client (currently libmysqlclient16-dev
in Ubuntu). I don't know if they are named different on Mac, but after you got those installed the Ruby bindings should install without any error.
I had a similar experience, so here are the things that I tried
Firstly, I tried to install mysql's required packages by running the command below in my terminal
sudo apt-get install build-essential libmysqlclient-dev
Secondly, I tried updating rubygems on my system by running the command below in my terminal
sudo gem update --system
But I was still experiencing the same issue. After much research I realized that I was using an almost out-of-date version of the mysql gem. I simply needed to use the mysql2 gem (mysql2 gem)and not the mysql gem, so I fixed it by running the command below in my terminal
gem install mysql2
This worked fine for me. Before running the last command, ensure that you've ran the first and second commands to be sure that everything is fine on your system.
That's all.
I hope this helps
Attention: You need to specify -- key, and than --with-mysql-config=/usr/local/mysql/bin/mysql_config
you can try to reinstall the latest version of xcode / dev. tools for snow leopard - this should fix your errors
Installing the mysql gem on OSX
in a terminal.. First do a ‘locate mysql_config’ and then replace the path in the following command with where that file is.
$ sudo gem install mysql -- —–with-mysql-config=/usr/local/mysql/bin/mysql_config
Building native extensions. This could take a while…
Successfully installed mysql-2.7
1 gem installed