Can access mysql server via command line utility but not via rails


#1

I’ve been successfully read and writing to a MySQL database on one
server from my RAILS application on another server for almost a year.
For various reasons that I aren’t important I tried to switch to
another database server. I can access, read and write to that
database server from my application server via the mysql command, but
when I attempt to load the console it takes a really, really long time
to load the console. Then when I try to read the first record of an
arbitrary model the console hangs again for a really, really long time
and comes back with this message:

Mysql::Error: Can’t connect to MySQL server on ‘72.32.121.29’ (110)
from /usr/lib/ruby/gems/1.8/gems/activerecord-2.2.2/lib/
active_record/connection_adapters/mysql_adapter.rb:548:in
real_connect' from /usr/lib/ruby/gems/1.8/gems/activerecord-2.2.2/lib/ active_record/connection_adapters/mysql_adapter.rb:548:inconnect’
from /usr/lib/ruby/gems/1.8/gems/activerecord-2.2.2/lib/
active_record/connection_adapters/mysql_adapter.rb:198:in initialize' from /usr/lib/ruby/gems/1.8/gems/activerecord-2.2.2/lib/ active_record/connection_adapters/mysql_adapter.rb:74:innew’
from /usr/lib/ruby/gems/1.8/gems/activerecord-2.2.2/lib/
active_record/connection_adapters/mysql_adapter.rb:74:in
mysql_connection' from /usr/lib/ruby/gems/1.8/gems/activerecord-2.2.2/lib/ active_record/connection_adapters/abstract/connection_pool.rb:223:insend’
from /usr/lib/ruby/gems/1.8/gems/activerecord-2.2.2/lib/
active_record/connection_adapters/abstract/connection_pool.rb:223:in
new_connection' from /usr/lib/ruby/gems/1.8/gems/activerecord-2.2.2/lib/ active_record/connection_adapters/abstract/connection_pool.rb:245:incheckout_new_connection’
from /usr/lib/ruby/gems/1.8/gems/activerecord-2.2.2/lib/
active_record/connection_adapters/abstract/connection_pool.rb:188:in
checkout' from /usr/lib/ruby/gems/1.8/gems/activerecord-2.2.2/lib/ active_record/connection_adapters/abstract/connection_pool.rb:184:inloop’
from /usr/lib/ruby/gems/1.8/gems/activerecord-2.2.2/lib/
active_record/connection_adapters/abstract/connection_pool.rb:184:in
checkout' from /usr/lib/ruby/1.8/monitor.rb:238:insynchronize’
from /usr/lib/ruby/gems/1.8/gems/activerecord-2.2.2/lib/
active_record/connection_adapters/abstract/connection_pool.rb:183:in
checkout' from /usr/lib/ruby/gems/1.8/gems/activerecord-2.2.2/lib/ active_record/connection_adapters/abstract/connection_pool.rb:98:inconnection’
from /usr/lib/ruby/gems/1.8/gems/activerecord-2.2.2/lib/
active_record/connection_adapters/abstract/connection_pool.rb:326:in
retrieve_connection' from /usr/lib/ruby/gems/1.8/gems/activerecord-2.2.2/lib/ active_record/connection_adapters/abstract/connection_specification.rb: 121:inretrieve_connection’
from /usr/lib/ruby/gems/1.8/gems/activerecord-2.2.2/lib/
active_record/connection_adapters/abstract/connection_specification.rb:
113:in connection' from /usr/lib/ruby/gems/1.8/gems/activerecord-2.2.2/lib/ active_record/base.rb:2934:inquoted_table_name’
from /usr/lib/ruby/gems/1.8/gems/activerecord-2.2.2/lib/
active_record/base.rb:1626:in construct_finder_sql' from /usr/lib/ruby/gems/1.8/gems/activerecord-2.2.2/lib/ active_record/base.rb:1490:infind_every’
from /usr/lib/ruby/gems/1.8/gems/activerecord-2.2.2/lib/
active_record/base.rb:1452:in find_initial' from /usr/lib/ruby/gems/1.8/gems/activerecord-2.2.2/lib/ active_record/base.rb:587:infind’
from /usr/lib/ruby/gems/1.8/gems/activerecord-2.2.2/lib/
active_record/base.rb:597:in `first’
from (irb):1

I’m really confused why the servers can talk via the mysql command and
not via the rails app. Any help would be appreciated.


#2

Never mind! It was a hosts file issue. All better now.