# Problems in moving an application database from a local to a

**URL:** <https://www.ruby-forum.com/t/problems-in-moving-an-application-database-from-a-local-to-a/52950>\
**Category:** Rails\
**Created:** [January 21, 2006, 1:39am UTC](https://www.ruby-forum.com/t/problems-in-moving-an-application-database-from-a-local-to-a/52950 "2006-01-21T01:39:02Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![luigi](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/l/73ab20/32.png) [@luigi](https://www.ruby-forum.com/u/luigi)\
**Post date:** [January 21, 2006, 1:39am UTC](https://www.ruby-forum.com/t/problems-in-moving-an-application-database-from-a-local-to-a/52950/1 "2006-01-21T01:39:02Z")

</div>

hi.

i’ve an application which is using a local mysql server (on  
localhost). i then moved the mysql server to another machine (remote  
host) and changed accordingly the “database.yml” file.

when i launch webrick from the “localhost”, it can connect to the  
database but as soon as i call a controller of the application (for  
example “[http://remotehost/indicator/list](http://remotehost/indicator/list)”) i get the following error  
(please, see below).

i installed on the remote machine (a win2003 box) both ruby (one-click  
installer) and ruby for apache (because of the mysql.so file). the  
fact is that it seems activerecord is still getting the mysql host as  
“localhost” instead of the remote host address.

could it be a cache issue? any ideas? many thanks in advance.

–l

Mysql::Error in Indicator#list

Can’t connect to MySQL server on ‘localhost’ (10061)

RAILS\_ROOT: ./script/…/config/…  
Application Trace | Framework Trace | Full Trace

c:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.13.2/lib/active\_record/connection\_adapters/mysql\_adapter.rb:316:in  
`real_connect' c:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.13.2/lib/active_record/connection_adapters/mysql_adapter.rb:316:in `connect’  
c:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.13.2/lib/active\_record/connection\_adapters/mysql\_adapter.rb:87:in  
`initialize' c:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.13.2/lib/active_record/connection_adapters/mysql_adapter.rb:37:in `new’  
c:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.13.2/lib/active\_record/connection\_adapters/mysql\_adapter.rb:37:in  
`mysql_connection' c:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.13.2/lib/active_record/connection_adapters/abstract/connection_specification.rb:145:in `send’  
c:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.13.2/lib/active\_record/connection\_adapters/abstract/connection\_specification.rb:145:in  
`connection_without_query_cache=' c:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.13.2/lib/active_record/query_cache.rb:54:in `connection=’  
c:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.13.2/lib/active\_record/connection\_adapters/abstract/connection\_specification.rb:106:in  
`retrieve_connection' c:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.13.2/lib/active_record/connection_adapters/abstract/connection_specification.rb:20:in `connection’  
c:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.13.2/lib/active\_record/base.rb:518:in  
`count_by_sql' c:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.13.2/lib/active_record/base.rb:511:in `count’  
c:/ruby/lib/ruby/gems/1.8/gems/actionpack-1.11.2/lib/action\_controller/pagination.rb:167:in  
`count_collection_for_pagination' c:/ruby/lib/ruby/gems/1.8/gems/actionpack-1.11.2/lib/action_controller/pagination.rb:188:in `paginator\_and\_collection\_for’  
c:/ruby/lib/ruby/gems/1.8/gems/actionpack-1.11.2/lib/action\_controller/pagination.rb:124:in  
`paginate' #{RAILS_ROOT}/app/controllers/indicator_controller.rb:13:in `list’

---

<div class="post-metadata">

**Author:** ![luigi](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/l/73ab20/32.png) [@luigi](https://www.ruby-forum.com/u/luigi)\
**Post date:** [January 21, 2006, 9:26am UTC](https://www.ruby-forum.com/t/problems-in-moving-an-application-database-from-a-local-to-a/52950/2 "2006-01-21T09:26:47Z")

</div>

On 21/01/06, Luigi R. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> hi.
> 
> i’ve an application which is using a local mysql server (on  
> localhost). i then moved the mysql server to another machine (remote  
> host) and changed accordingly the “database.yml” file.

> Can’t connect to MySQL server on ‘localhost’ (10061)

It’s not picking up your

host: whereever

line, and defaulting to localhost.

Check the usual suspects (two spaces, no tabs).

–  
Rasputin :: Jack of All Trades - Master of Nuns  
[http://number9.hellooperator.net/](http://number9.hellooperator.net/)

---

<div class="post-metadata">

**Author:** ![luigi](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/l/73ab20/32.png) [@luigi](https://www.ruby-forum.com/u/luigi)\
**Post date:** [January 21, 2006, 9:59am UTC](https://www.ruby-forum.com/t/problems-in-moving-an-application-database-from-a-local-to-a/52950/3 "2006-01-21T09:59:51Z")

</div>

Hello Dick.

Many thanks for your suggestion.

As a matter of fact I recreated from scratch the “database.yml” file,  
and it started working. So the “usual suspects” were indeed the  
culprits! 🙂

–Luigi
