I have this in the Gemfile:
gem \'mysql2\'
But when I run bundle update, I get this error message:
An error oc
I just installed mysql via $ brew install mysql
and it fixed the problem.
I've ended up with a near-identical error message from attempting to build on a machine without gcc-c++
installed; mkmf
is failing to compile a simple c program because the compiler flat out isn't there.
If you're on CentOS, you want sudo yum install gcc-c++
. On Ubuntu, it's sudo apt-get install g++
. It's a little disappointing that old versions of ruby-devel
don't have a dependency on g++
.
On Ubuntu, run
sudo apt-get install libmysqlclient-dev
Or, if you use MariaDB, run
sudo apt-get install libmariadbclient-dev
Add this in Gemfile:-
gem 'mysql2', '0.3.16'
Then:-
bundle install
After that try:-
bundle update
Looks like there is no mysql2 gem
installed in your machine.As you are using Mac OSX
,you should be installing mysql2 gem
like this
gem install mysql2 -- --with-mysql-dir=/usr/local/opt/mysql/
If the above command did't work,try like this
sudo gem install mysql -- --with-mysql-config=/usr/local/mysql/bin/mysql_config
And after try
bundle install
This should fix the error.
Source