Problems in moving an application database from a local to a


#1

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”) 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:inconnect’
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:innew’
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:insend’
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:inconnection=’
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:inconnection’
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:incount’
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:inpaginator_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:inlist’


#2

On 21/01/06, Luigi R. 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/


#3

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! :slight_smile:

–Luigi