I am getting some errors whilst connecting to MySQL and the fixing of it led me to upgrade the mysql2 gem.
I ran this command to install mysql2:
ruby install mysql2
and now “gem list” shows this gem: mysql2 (0.3.2)
But I think it isn’t part of my application environment still since the server gives this error:
Please install the mysql2 adapter: `gem install activerecord-mysql2-adapter` (no such file to load -- active_record/connection_adapters/mysql2_adapter)
I have RVM and I’ve used bundler to make a gemset for this application. How can I add mysql2 to this application’s gemset?
This is my gemfile:
source 'http://rubygems.org'
gem 'rails', '3.0.7'
# Bundle edge Rails instead:
# gem 'rails', :git => 'git://github.com/rails/rails.git'
gem 'sqlite3'
gem 'mysql2' , '0.3.2'
And this is my MySQL adapter version:
$bundle show mysql2
/home/agenadinik/workspace/udfr/mysql2/ruby/1.9.1/gems/mysql2-0.3.2
Also
$ rvm gemdir
/home/agenadinik/.rvm/rubies/ruby-1.9.2-p180/bin/gem:4: warning: Insecure world writable dir /home/agenadinik in PATH, mode 040777
/home/agenadinik/.rvm/gems/ruby-1.9.2-p180
Note that you cannot use mysql2 version 0.3.x with Rails version less than 3.1.x.
I assume you are using Rails 3.0.x or below (and thus you need to use mysql2 version 0.2.x):
Here is an example of how to set up a gemset and the Gemfile to use mysql2: