# Scaffolding tries to connect to wrong db

**URL:** <https://www.ruby-forum.com/t/scaffolding-tries-to-connect-to-wrong-db/104362>\
**Category:** Deployment\
**Created:** [May 17, 2007, 5:46am UTC](https://www.ruby-forum.com/t/scaffolding-tries-to-connect-to-wrong-db/104362 "2007-05-17T05:46:13Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![coelho](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/e9c0ed/32.png) [@coelho](https://www.ruby-forum.com/u/coelho)\
**Post date:** [May 17, 2007, 5:46am UTC](https://www.ruby-forum.com/t/scaffolding-tries-to-connect-to-wrong-db/104362/1 "2007-05-17T05:46:13Z")

</div>

Hello,

Im getting an error when trying to scaffold, rails tries to connect to  
the wrong database, I am running RoR on windows.  
When I try to acces localhost:3000/contexts I get this  
Mysql::Error in ContextsController#index  
#42000Unknown database ‘gtd\_development’

This is my controller

class ContextsController \< ApplicationController  
scaffold :context  
end

And this is my config/database.yml

development:  
adapter: mysql  
database: gtd  
username: root  
password:  
host: localhost

test:  
adapter: mysql  
database: gtd\_teste  
username: root  
password:  
host: localhost

production:  
development

How do I fix this?

---

<div class="post-metadata">

**Author:** ![coelho](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/e9c0ed/32.png) [@coelho](https://www.ruby-forum.com/u/coelho)\
**Post date:** [May 17, 2007, 7:46am UTC](https://www.ruby-forum.com/t/scaffolding-tries-to-connect-to-wrong-db/104362/2 "2007-05-17T07:46:59Z")

</div>

And you have your RAILS\_ENV environment variable set to “production”?

* * *

Jun-Dai Bates-Kobashigawa  
purico.jp

---

<div class="post-metadata">

**Author:** ![coelho](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/e9c0ed/32.png) [@coelho](https://www.ruby-forum.com/u/coelho)\
**Post date:** [May 17, 2007, 7:17pm UTC](https://www.ruby-forum.com/t/scaffolding-tries-to-connect-to-wrong-db/104362/3 "2007-05-17T19:17:11Z")

</div>

Yes, I modified RAILS\_ENV and it worked, good enough  
thank you
