rake tool tries to connect to wrong ip address for migration

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

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