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!

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 trial

Ruby ActiveRecord Basics Migrations and Relationships Migrations

rake db:create & mysql

I recently switched my OS to Ubuntu and re-installed all RoR along with mySQL. After creating my new rails app and type in the good old fashion rake db:create, I receive the following response..

Access denied for user 'root'@'localhost' (using password: NO)Please provide the root password for your mysql installation

I type in my password and receive the same response. I am able to enter into mysql using the same root password with no issues. Can anyone help me identify this problem?

3 Answers

Maciej Czuchnowski
Maciej Czuchnowski
36,441 Points

I had the same problem, had to force a change of mysql password for root (although I never set one) and after that write this password in my config/database.yml file.

Try this method: http://askubuntu.com/questions/489098/unable-to-reset-root-password-of-mysql

Nikola Novakovic
Nikola Novakovic
4,171 Points

Wow this was so useful! As TJ below said, there was an issue with this on the TreehouseVM and it can be fixed with this! :)))

The same issue for my treehouse virtual machine (VirtualBox + vagrant) that was installed in the previous lessons of RubyOnRails. The fixes Maciej suggested work fine for me: i.e.

[1]  sudo dpkg-reconfigure mysql-server-5.5    # (re)set root password
[2]  add the pasword in "password: ***" lines of .../config/database.yml
Carlos Reyes
Carlos Reyes
30,056 Points


This worked for me too, solved my problem in the course ActiveRecord Basic > Migrations.

Working in win 8 + TVM.