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 trialAndrew Pope
11,915 Points*RESOLVED* MySQL Error (gem install) with Rails
Hi everyone,
I am currently following along with Hampton's course on ActiveRecord Basics. In the Migrations video in Stage 2, the project is created using
rails new biller -d mysql
However, when I try I get an error when it tries to install mysql with gem install.
Here is my console output
Errno::EACCES: Permission denied @ rb_sysopen - /Users/andrew/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/mysql2-0.3.16/MIT-LICENSE
An error occurred while installing mysql2 (0.3.16), and Bundler cannot continue.
Make sure that `gem install mysql2 -v '0.3.16'` succeeds before bundling.
run bundle exec spring binstub --all
/Users/andrew/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/bundler-1.6.2/lib/bundler/resolver.rb:352:in `resolve': Could not find gem 'mysql2 (>= 0) ruby' in the gems available on this machine. (Bundler::GemNotFound)
from /Users/andrew/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/bundler-1.6.2/lib/bundler/resolver.rb:165:in `start'
from /Users/andrew/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/bundler-1.6.2/lib/bundler/resolver.rb:129:in `resolve'
from /Users/andrew/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/bundler-1.6.2/lib/bundler/definition.rb:203:in `resolve'
from /Users/andrew/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/bundler-1.6.2/lib/bundler/definition.rb:133:in `specs'
from /Users/andrew/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/bundler-1.6.2/lib/bundler/definition.rb:178:in `specs_for'
from /Users/andrew/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/bundler-1.6.2/lib/bundler/definition.rb:167:in `requested_specs'
from /Users/andrew/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/bundler-1.6.2/lib/bundler/environment.rb:18:in `requested_specs'
from /Users/andrew/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/bundler-1.6.2/lib/bundler/runtime.rb:13:in `setup'
from /Users/andrew/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/bundler-1.6.2/lib/bundler.rb:120:in `setup'
from /Users/andrew/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/bundler-1.6.2/lib/bundler/setup.rb:17:in `<top (required)>'
from /Users/andrew/.rbenv/versions/2.1.2/lib/ruby/2.1.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from /Users/andrew/.rbenv/versions/2.1.2/lib/ruby/2.1.0/rubygems/core_ext/kernel_require.rb:55:in `require'
I already have mysql installed as part of MAMP, however the server is not running (neither httpd or mysql).
Any ideas why the command won't complete would be greatly appreciated!
Thanks in advance,
Andy.
7 Answers
Andrew Pope
11,915 PointsSorry, all is fixed now!
For anyone experiencing the same, or a similar error here is what I did:
If you haven't installed homebrew, then install it!
Ensure the latest version of mysql is installed to your machine
brew install mysql
if you don't have mysql installed, or alternatively
brew upgrade mysql
to update to the latest version.
then run
sudo gem install mysql2
and finally, create the rails project
rails new biller -d mysql
Hope this helps somebody!
Andy.
Kyle Robertson
31,600 Pointsthanks for the tip!
Cavan Biggs
25,212 PointsGreat work, thanks for the help.
Cavan Biggs
25,212 PointsAlso if anyone gets a "brew:command not found" this link will help you get through that http://techsharehub.blogspot.com/2013/08/brew-command-not-found.html
Ben Goldman
14,626 PointsWhat if you're not using a mac?
Holly Banning
16,096 PointsYes, is there an equivalent for windows users?
Ben Goldman
14,626 PointsWell, I sort of resolved the issue. I tried various fixes, but nothing worked. So, finally, I opted for working within a virtual workspace. Don't know why I didn't think of this earlier. Take Windows out of the equation, and no more conflict.
David Eichel
28,860 PointsWindows users: Disable your antivirus. Wait let me say it again for those of you who don't believe me. DISABLE YOUR ANTIVIRUS. Make sure it's disabled while attempting to install mysql2.
Jim Withington
12,025 PointsI'm still having this issue. Can't figure out what it is.
Jaime Young
8,110 PointsHi I installed the mysql2 gem properly but when I input rake db:create, it still creates an error.
/Users/JaimeYoung/.rvm/gems/ruby-2.2.0@global/gems/activesupport-4.0.2/lib/active_support/values/time_zone.rb:282: warning: circular argument reference - now Access denied for user 'root'@'localhost' (using password: NO)Please provide the root password for your mysql installation
^ i type in my root password and it still rejects me