Luigi Rizzo
2006-Jan-21 00:01 UTC
[Rails] problems in moving an application database from a local to a remote mysql server
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: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''
Dick Davies
2006-Jan-21 07:49 UTC
[Rails] problems in moving an application database from a local to a remote mysql server
On 21/01/06, Luigi Rizzo <luigi.rizzo@gmail.com> 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/
Luigi Rizzo
2006-Jan-21 08:20 UTC
[Rails] problems in moving an application database from a local to a remote mysql server
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 On 1/21/06, Dick Davies <rasputnik@gmail.com> wrote:> It''s not picking up your > > host: whereever > > line, and defaulting to localhost. > > Check the usual suspects (two spaces, no tabs).