A rather n00by question on rake, from "Build Your Own RoR Applications" by Patrick Lenz

Hi! I had a question on rake. I am going through Mr. Lenz’s book, and have been coasting through successfully until I hit the section in Ch. 6 on testing. At the command line, in my application root, I typed: $ rake test:units

My error message was:

daniel-ahns-power-mac-g5:~/Sites/shovell dannyG5$ rake test:units
(in /Users/dannyG5/Sites/shovell)
rake aborted!

#28000Access denied for user ‘root’@‘localhost’ (using password: NO)

(See full trace by running task with --trace)

It seems as if rake is trying to communicate with mysql – i put a password on mysql, though my username is still root. Do I have to log on to mysql or somehow provide rake with my mysql password so it can successfully test? How do I do that?

When I used $ rake db:migrate, everything worked fine, so I’m confused, as my mysql knowledge is at a beginner level.

I’m on a G5 OSX 10.4.10, running Ruby 1.8.6, rails 1.2.3, mysql 5. Any help would be greatly appreciated!




Lutz Horn wrote:


mysqladmin -u root -p password

But be aware that there must not be a blank between "-p" and your password.




you could also do mysql -u root -p (press enter) and then get a prompt
for password.
this is useful if there are people watching your monitor and you don't
want to type the pass in clear text.

jp antunes