mysql access -- works from webrick but not from tests or mongrel

I have set up Rails on my OS X laptop and am trying to use mysql as a
backend for my Rails app.

If I start the app using script/server (webrick) everything works fine,
but when I try and run tests or start up mongrel I get the following
error:

  Mysql::Error: Access denied for user 'rails'@'localhost' (using
password: YES)

I've tried a bunch of the standard fixes for mysql access and none of
them have helped.

What really confuses me is webrick working but the tests and mongrel
having trouble. I invoke webrick with "script/server", the tests by
running "rake" and mongrel with "mongrel_rails" -- all from the rails
root directory.

Anybody have an idea why Rails mysql access behavior would be different
under webrick than mongrel and rake run tests?

Larry

P.S. here's a bunch of background info in my set-up.

Version info:

    Mac OS: 10.4.7
    ruby: 1.8.4 /opt/local/bin
    rails: 1.1.6 /opt/local/bin
    mysql: 4.1.20 /opt/local/bin
    mongrel_rails: 0.3.13.3 /opt/local/bin

My database.yml file looks like:

    development:
      adapter: mysql
      database: st_development
      host: localhost
      username: rails
      password: *****

    test:
      adapter: mysql
      database: st_test
      host: localhost
      username: rails
      password: *****

    production:
      adapter: mysql
      database: st_production
      host: localhost
      username: rails
      password: ******

Did you add a "rails" user to mysql

try logging in to mysql and running...

GRANT ALL PRIVILEGES ON *.* TO 'rails'@'localhost' IDENTIFIED BY
'mypassword' WITH GRANT OPTION;

~Jamie

Hi Jamie,

Good question. I should have metioned that I can log into the mysql
server using the command line "mysql" application with the "rails"
credentials and access and modify both the st_development and st_test
databases. The st_develpment access is also confirmed by the fact that
I can get my Rails app to run properly using webrick (script/server).

Larry