# rake tool tries to connect to wrong ip address for migration

**URL:** <https://discuss.rubyonrails.org/t/rake-tool-tries-to-connect-to-wrong-ip-address-for-migration/57975>\
**Category:** rubyonrails-talk\
**Created:** [March 18, 2011, 2:16pm UTC](https://discuss.rubyonrails.org/t/rake-tool-tries-to-connect-to-wrong-ip-address-for-migration/57975 "2011-03-18T14:16:28Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![gkaykck](https://avatars.discourse-cdn.com/v4/letter/g/7993a0/32.png) [@gkaykck](https://discuss.rubyonrails.org/u/gkaykck)\
**Post date:** [March 18, 2011, 2:16pm UTC](https://discuss.rubyonrails.org/t/rake-tool-tries-to-connect-to-wrong-ip-address-for-migration/57975/1 "2011-03-18T14:16:28Z")

</div>

I have asked a question similar, but not same. I was unable to connect to my remote mysql server from windows, it tries to connect to local server, whatever i wrote in database.yml din’t made any changes at all. So i ve switched to linux. Now my rails app sees what i wrote inside my database.yml and tries to connect the right ip address. But now my rake tool gets confused and tries to connect local mysql instance.

I think i have to override database.yml file for rake only, but i don’t know how to do so.

— database.yml (i ve changed my host with \*)

development:

adapter: mysql2

encoding: utf8

reconnect: false

database: devel\_database

pool: 5

username: ‘username’

password: ‘password’

host: _._._._

test:

adapter: mysql2

encoding: utf8

reconnect: false

database: temp\_test

pool: 5

username: root

password:

host: _._._._

production:

adapter: mysql2

encoding: utf8

reconnect: false

database: temp\_production

pool: 5

username: root

password:

host: _._._._

— database.yml

gkaykck@node2:~/Dropbox/portalegitim$ rake db:migrate

(in /home/gkaykck/Dropbox/portalegitim)

rake aborted!

Access denied for user ‘username’@‘78.170.46.170’ (using password: YES)

(See full trace by running task with --trace)

78.170.46.170 is my computers ip not my mysql servers ip. It is different in database.yml file

---

<div class="post-metadata">

**Author:** ![Frederick\_Cheung](https://sea2.discourse-cdn.com/rubyonrails/user_avatar/discuss.rubyonrails.org/frederick_cheung/32/3901_2.png) [@Frederick\_Cheung](https://discuss.rubyonrails.org/u/Frederick_Cheung)\
**Post date:** [March 18, 2011, 4:16pm UTC](https://discuss.rubyonrails.org/t/rake-tool-tries-to-connect-to-wrong-ip-address-for-migration/57975/2 "2011-03-18T16:16:57Z")

</div>

That doesn't mean that you were trying to connect to 78.170.46.170, it's saying that the server refused access to the user username from the machine with ip address 78.170.46.170

Fred
