Rails: #28000Access denied

I’m continuing to mess around with Ruby on Rails on WinXP. I just ran into another problem that took me over an hour to figure out. I set up a database in MySQL, configured my database.yml file, created a model and a controller and launched WEBrick. I put the scaffold line in the controller to generate auto-magical interface and I kept getting this error message:

#28000Access denied for user ‘root’@'localhost’ (using password: NO)
RAILS_ROOT: ./script/../config/..

This was driving me crazy, because my yml file specified to use the “webuser” account instead of the root. And yet, rails insisted on fucking around with the root account. I checked it about a hundred times, changed access privileges on my table every possible way, and scoured the web for similar problems. It seems that quite a few people are running into the same damn issue, and almost no one knows hot to fix it.

Finally after reading through the comments here, I found the solution. Simply run the server in production mode:

ruby script/server -p80 -environment=production

This worked for me just fine. I’m not sure why this was happening. Any ruby experts out there can explain this behavior to me? Oh well, for now I guess that as long as I stay in production, I can avoid that stupid error.

Btw, rails is pretty amazing when it works. It only takes one line of code, and you get a simple, yet surprisingly custom complete interface allowing me to populate, edit and remove stuff from your database table:

Rails Scaffold

How awesome is that?

Related Posts:

  • Aptana - First Impression
  • Ruby on Rails doesn’t Scale Well
  • Twitter is useless to me.
  • Ruby
  • Strange WEBrick Error
  • Rails 2.0 on Ubuntu Gutsy
  • Project Idea
  • What happened to scaffold in Rails 2.x?
  • Starting a Rails 2.0 Project
  • Safari on Windows: Bonjour Slowing Down MS Office

  • 2 Responses to “Rails: #28000Access denied”

    1. Gravatar Dan Diemer UNITED STATES Says:

      Thanks a ton. You saved me an hours worth of headache figuring that one out.

      Posted using Safari Safari on Mac OS Mac OS X
    2. Gravatar Luke UNITED STATES Says:

      Glad I could help. ) I still have no clue what causes this to pop up in the first place.

      Posted using Mozilla Firefox Mozilla Firefox 2.0.0.3 on Windows Windows XP

    Leave a Reply

    XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <code> <pre lang=""> <em> <i> <strike> <strong>

    [Quote selected]