# Access denied problem

**URL:** <https://www.ruby-forum.com/t/access-denied-problem/52767>\
**Category:** Rails\
**Created:** [January 18, 2006, 10:23pm UTC](https://www.ruby-forum.com/t/access-denied-problem/52767 "2006-01-18T22:23:03Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![scottbrisko](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/aca169/32.png) [@scottbrisko](https://www.ruby-forum.com/u/scottbrisko)\
**Post date:** [January 18, 2006, 10:23pm UTC](https://www.ruby-forum.com/t/access-denied-problem/52767/1 "2006-01-18T22:23:03Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![scottbrisko](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/aca169/32.png) [@scottbrisko](https://www.ruby-forum.com/u/scottbrisko)\
**Post date:** [January 18, 2006, 10:44pm UTC](https://www.ruby-forum.com/t/access-denied-problem/52767/2 "2006-01-18T22:44:08Z")

</div>

On 1/18/06, Scott B. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) 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?

---

<div class="post-metadata">

**Author:** ![scottbrisko](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/aca169/32.png) [@scottbrisko](https://www.ruby-forum.com/u/scottbrisko)\
**Post date:** [January 18, 2006, 10:53pm UTC](https://www.ruby-forum.com/t/access-denied-problem/52767/3 "2006-01-18T22:53:12Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![scottbrisko](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/aca169/32.png) [@scottbrisko](https://www.ruby-forum.com/u/scottbrisko)\
**Post date:** [January 19, 2006, 10:33am UTC](https://www.ruby-forum.com/t/access-denied-problem/52767/4 "2006-01-19T10:33:16Z")

</div>

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)?

---

<div class="post-metadata">

**Author:** ![scottbrisko](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/aca169/32.png) [@scottbrisko](https://www.ruby-forum.com/u/scottbrisko)\
**Post date:** [January 19, 2006, 3:20pm UTC](https://www.ruby-forum.com/t/access-denied-problem/52767/5 "2006-01-19T15:20:28Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![scottbrisko](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/aca169/32.png) [@scottbrisko](https://www.ruby-forum.com/u/scottbrisko)\
**Post date:** [September 20, 2006, 4:50pm UTC](https://www.ruby-forum.com/t/access-denied-problem/52767/6 "2006-09-20T16:50:26Z")

</div>

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
