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: ******