Please install mysql2 adapter-Collection of common programming errors
I’m new of rails, and i have this big problem. I’m running rails 3.2.9 and Ruby 1.9.3, I did a porting of a rails app from linux to windows, but in windows i’m having a lot of problems with mysql2 gem. I installed mysql2 gem yesterday and than i tried to run rake db:migrate but i have this output:
rake aborted!
Please install the mysql2 adapter:gem install activerecord-mysql2-adapter
(cannot load such file — mysql2) C:/Users/RoccaA/Desktop/project/config/environment.rb:5:in `’ Tasks: TOP => db:migrate => environment(See full trace by running task with –trace)
Then this is my Gemfile
gem 'rails', '3.2.9'
# Bundle edge Rails instead:
# gem 'rails', :git => 'git://github.com/rails/rails.git'
#gem 'sqlite3'
# Gems used only for assets and not required
# in production environments by default.
group :assets do
gem 'sass-rails', '~> 3.2.3'
# gem 'coffee-rails', '~> 3.2.1'
# See https://github.com/sstephenson/execjs#readme for more supported runtimes
# gem 'therubyracer', :platforms => :ruby
# gem 'uglifier', '>= 1.0.3'
end
gem 'coffee-rails', '~> 3.2.1'
gem 'uglifier', '>= 1.0.3'
gem 'jquery-rails'
# To use ActiveModel has_secure_password
# gem 'bcrypt-ruby', '~> 3.0.0'
# To use Jbuilder templates for JSON
# gem 'jbuilder'
# Use unicorn as the app server
# gem 'unicorn'
# Deploy with Capistrano
# gem 'capistrano'
# To use debugger
# gem 'debugger'
# this gems needs for auth
gem 'cancan'
gem 'devise'
gem 'rolify'
gem 'execjs'
gem 'therubyracer', :platform => :ruby
gem 'populator'
gem 'faker'
gem 'paperclip'
gem 'simple_xlsx_writer'
gem 'roo'
gem 'mysql2', '0.3.11'
gem 'simple_xlsx_writer'
gem 'rake', '~> 10.0.4'
gem 'icalendar'
And this is my database.yml
development:
adapter: mysql2
encoding: utf8
reconnect: false
database: emc
pool: 5
username: root
password: root
socket: /var/run/mysqld/mysqld.sock
testing:
adapter: mysql2
encoding: utf8
reconnect: false
database: emc
pool: 5
username: root
password: root
socket: /var/run/mysqld/mysqld.sock
production:
adapter: mysql2
encoding: utf8
reconnect: false
database: emc
pool: 5
username: root
password: root
socket: /var/run/mysqld/mysqld.sock
I tried to solve this problem in a lots of ways, i read that i have to use mysql2 version < 0.3 but with this version I have this output
WARNING: This version of mysql2 (0.2.18) isn’t compatible with Rails 3.1 as the ActiveRecord adapter was pulled into Rails itself. WARNING: Please use the 0.3.x (or greater) releases if you plan on using it in Rails >= 3.1.x rake aborted! undefined method `accept’ for nil:NilClass Tasks: TOP => db:migrate
(See full trace by running task with –trace)**
Hope someone can help me, thanks.