Rails 4 - Gem::LoadError: Specified 'mysql2' for database adapter, but the gem is not loaded
Just a further update - the solution in the question is correct.
The 4th comment is worth taking note of:
This isn't a bug with mysql2, it's a problem with the requirement in
the ActiveRecord adapter: http://github.com/rails/rails/issues/21544.
This is fixed in rails master:
https://github.com/rails/rails/commit/5da5e3772c32593ecf2f27b8865e81dcbe3af692
I was able to tie Rails 4.2.4
to the 4-2-stable
branch and get it working with the latest mysql2
:
gem 'rails', '~> 4.2.4', git: "git://github.com/rails/rails.git", branch: '4-2-stable'
gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw] #-> Rails 4.1+
#DB
gem 'mysql2'
Rails: Specified 'mysql2' for database adapter but the gem is not loaded
Add the following to your Gemfile
:
gem 'mysql2', '~> 0.3.18'
Then run:
bundle install
Gem::LoadError Specified 'mysql2' for database adapter, but the gem is not loaded
It doesn't load mysql2 gem because new version of mysql2(0.4.1) gem unable to load the mysql2_adaptor. This is working for me.
gem 'mysql2', '~> 0.3.13'
and run
bundle install
If still facing problem then This solution will surely help
Note: I'm assuming that you've mysql database installed on your system :P
Add `gem 'mysql2'` to your Gemfile (and ensure its version is at the minimum required by ActiveRecord)
You started a string which you didn't end at the end of this line :
gem 'mysql2', '~> 0.3.20'"
Change it to this:
gem 'mysql2', '~> 0.3.20'
Gem::LoadError: Specified 'mysql' for database adapter, but the gem is not loaded
When you set your DATABASE_URL
, you need to specify to use mysql2://
instead of mysql://
Something like this:
heroku config:set DATABASE_URL='mysql2://adffdadf2341:adf4234@us-cdbr-east.cleardb.com/heroku_db?reconnect=true'
Specified sqlite3 for database adapter but gem is not loaded
Your sqlite3 gem is not being loaded, because of where you've got it in the Gemfile. Take it out of platform :ruby do
and place it outside of that block , May be right under gem 'rails', '~> 4.2.0'
Same source code on two machines yield different executable behavior
The app uses the Regional Settings of the machine it's running on, and it looks like it is your problem. You can force a thread to use a specific culture by setting System.Threading.Thread.CurrentThread.CurrentCulture and System.Threading.Thread.CurrentThread.CurrentUICulture to a specific value.
Related Topics
How to Calculate the Day of the Week of a Date in Ruby
Rails 3.1 Limit User Created Objects
Cannot Use Rvm-Installed Ruby With Sudo
Ruby Local Variable Is Undefined
Can't Install Pg Gem on Windows
Can Ruby Print Out Time Difference (Duration) Readily
Set Utf-8 as Default String Encoding in Heroku
What Does "≪≪-" Mean in Ruby
How to Access a Variable Defined in a Ruby File I Required in Irb
How to Run All Tests With Minitest
Rake "Already Initialized Constant Wfkv_" Warning
"Gem Install Rails" Fails With Dns Error
Ruby Run Shell Command in a Specific Directory
Convert Unicode Codepoint to String Character in Ruby
Change the Name of the :Id Parameter in Routing Resources for Rails
Is There a Hook Similar to Class#Inherited That's Triggered Only After a Ruby Class Definition