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 trialMichael Hulet
47,913 PointsRoot Password for MySQL on the Treehouse VM?
So I'm trying to take the ActiveRecord Basics course using the Treehouse VM used in earlier ruby videos, and when it comes to rake db:create
after setting the projects database to be MySQL (when running rails new
), I get an error saying: "Access denied for user 'root'@'localhost' (using password: NO)Please provide the root password for your MySQL installation
". My question is, what is that root password?
5 Answers
Justin Mahar
8,422 PointsI just ran into this same issue. I followed the advice on this thread to fix the problem. Here are the steps I took (YMMV):
- For me, the treehouse VM password for the mysql root account was "treehouse"
- Open mysql CLI using
mysql -u root -p
and specifying "treehouse" as the password. - Run the following statements:
UPDATE mysql.user SET Password=PASSWORD('MyNewPass') WHERE User='root'; FLUSH PRIVILEGES;
- In your rails project, open config/database.yml and specify your new password in dev, test and production.
- Run
rake db:create
again.
Jason Seifer
Treehouse Guest TeacherHey Michael Hulet there should be no root mysql password. Which treehouse vm are you using? That will help us troubleshoot the issue.
Michael Hulet
47,913 PointsAfter running vagrant ssh
to log into it, it says that it's running Ubuntu 12.04.3 LTS (GNU/Linux 3.8.0-33-generic i686)
Michael Hulet
47,913 PointsDoes that information help any, Jason Seifer ?
Jason Seifer
Treehouse Guest TeacherMichael Hulet Yep! That VM shouldn't have a mysql root password set. Perhaps one was set accidentally or by a random program? Perhaps try downloading the VM again.
Michael Hulet
47,913 PointsI tried totally reinstalling the Treehouse VM (the one for Build a Todo List Application with Rails 4), and the same thing happens. Do you think it might have something to do with the fact that I have MySQL Workbench installed on the host machine from the Database Foundations course earlier in the Rails track?
Michael Hulet
47,913 PointsI just took super drastic measure and installed OS X fresh on an external drive, booted my Mac to that, installed Vagrant, VirtualBox, and the described Treehouse VM, and I still got the same error, so I don't think it's my machine
Michael Hulet
47,913 PointsSo I ended up spending the past couple weeks scouring the internet for possible answers, and I ended up getting it working locally on my Mac by running brew install mysql
, then starting the MySQL server with mysql.server start
. I almost got it working on Ubuntu 14.04 on my ChromeBook (running ChrUbuntu) by installing a few developer libraries with APT, but it says it's just missing a JavaScript Runtime Environment, and I'm honestly too lazy to fix that, since I just got it working on my Mac
Jon Thomas
8,916 PointsI'm getting this on the treehouse vm as well.
Couldn't create database for {"adapter"=>"mysql2", "encoding"=>"utf8", "database"=>"biller_test", "pool"=>5, "username"=>"root", "password"=>nil, "socket"=>"/var/run/mysqld/mysqld.sock"}
Jon Thomas
8,916 PointsIt looks like using "treehouse" as the password worked.
Alvin Shern
3,421 PointsAlvin Shern
3,421 PointsThanks! Solved my problem.
Alvin Shern
3,421 PointsAlvin Shern
3,421 PointsThanks! Solved my problem.