Access denied problem

Hello

I’ve started working through the book “Agile web development with
Rails” and so far everything has been great.

I’m on page 56, 57 trying to create the admin tool for the example
project “Depot”.

I’m on OS X Panther 10.3.9. I have checked the Errata on the website
and tried some of the suggestions there, but nothing has worked. When
I type… ruby/generate scaffold Product Admin I get an error that
says Access denied for user ‘root’@‘localhost’ (using password: NO).

In the book it states this could be a problem with leaving parts of the
database.yml config file blank. I’ve tried both leaving it blank and
filling in an explicit user and password. I still get the same error.

When I tried to view the page at localhost:3000/admin I get the error
Routing Error Recognition failed for “/admin”.

I’m not sure where to go from here. When I originally set up Ruby and
Ruby on Rails on my machine I followed a tutorial from the O’Reilly
network and the database connections worked just fine. (I know this
because I remember being completely amazed at how I could alter the db
and have the admin section change instantly!)

The only thing I have changed from the time of doing the O’Reilly
tuturial and buying the books is upgrading to Rails 1.0.

I’ve tried entering the username as root and the root pass in the
database.yml configuration, but that didn’t seem to work. I don’t know
why Rails continues to try to access the db as root.

I’ve checked my priveleges in mysql (4.1.14) and everything seems to be
ok for the user I have set up for the “Depot” example. I’ve even
connected with the user to the db through the console. So, to the best
of my knowledge the user I’m connecting under has the right access to
the db.

Since the website suggested turning to this mailing list for help…
here I am. I hope someone out there is apply to help.

Thanks very much.
Scott

On 1/18/06, Scott B. [email protected] wrote:

I’ve checked my priveleges in mysql (4.1.14) and everything seems to be
ok for the user I have set up for the “Depot” example. I’ve even
connected with the user to the db through the console. So, to the best
of my knowledge the user I’m connecting under has the right access to
the db.

The error message says that you’re trying to connect as root. Is that
what you expected?

No, didn’t expect to connect to as root at all. I set up the databases
as directed in the example, used an existing user (scott) and granted
all privileges to that user.

Access denied error showed up when I moved on to the next step for
creating the scaffold for the admin tools.

Scott B. wrote:

No, didn’t expect to connect to as root at all. I set up the databases
as directed in the example, used an existing user (scott) and granted
all privileges to that user.

Access denied error showed up when I moved on to the next step for
creating the scaffold for the admin tools.
Care to post your database.yml (with passwords masked, of course)?

Alex

As you requested, here is the database.yml, minus the passwords.

development:
adapter: mysql
database: depot_development
host: localhost
username: scott
password: mypass

test:
adapter: mysql
database: depot_test
host: localhost
username: scott
password: mypass

production:
adapter: mysql
database: depot_production
host: localhost
username: scott
password: mypass

When I got the error that said access denied, I assumed Rails was
trying to access the db as root. So I also tried on the development
settings to put “root” and my db root pass into the username and
password but I still got the same error.

Thanks
Scott

Hi Scott,

I spent ages on this and eventually found a suggestion somewhere that
recommended killing off the ruby processes - problem appears to be that
ruby isn’t (always) picking up the latest changes in the database.yml
file.

It working for me,

Spiky