Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialHossam Khalifa
17,200 Pointsrake db:create fails
Specified 'mysql2' for database adapter, but the gem is not loaded. Add gem 'mysql2'
to your Gemfile (and ensure its version is at the minimum required by ActiveRecord).
although: gem 'mysql2' , '>=0.4' in Gemfile
3 Answers
Filip Vanderstappen
3,877 PointsYou have to specify a version lower than 0.4 for mysql2. It's a bug in rails for rails 4.x (https://github.com/rails/rails/issues/21544)
Use the following in your Gemfile:
gem 'mysql2', '~> 0.3.18'
Izabella Konstanciak
10,173 PointsI had the same problem. I did as you told @Filip and then this appeared:
Could not find gem 'mysql2 (~> 0.3.18) ruby' in any of the gem sources listed in your Gemfile or available on this machine.
Run `bundle install` to install missing gems.
So I used:
bundle install
then once again:
rake db:migrate
and it worked.
Max Hirsh
16,773 PointsYeah, this is what worked for me. It sounds like this is a bug that they are working out for the next version of rails.
Kevin Korte
28,149 PointsWindows?
Hossam Khalifa
17,200 PointsNo Mac
Kevin Korte
28,149 PointsOk, see if this helps you. https://teamtreehouse.com/community/mysql2-gem-is-not-loading-mac
Let me know
Kevin Korte
28,149 Pointsdelete the 
from the end of the url and reload. the forum is doing that to all links, page should load with those three characters removed.
Hossam Khalifa
17,200 Pointsnothing worked
nhat nhat
817 Pointsif you are using OS 11, this could be a help https://forums.developer.apple.com/thread/7935
Chris Savage
3,066 PointsIf you can actually read that link and understand it, it would be helpful. Alas, I cannot, so the link is not. Any dummed down help from that link would be appreciated as this course is no longer viable from this web site.
Hossam Khalifa
17,200 PointsHossam Khalifa
17,200 Pointspage does not exist