Forum: Ruby on Rails Can access mysql server via command line utility but not via rails

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
stasch (Guest)
on 2009-04-03 02:41
(Received via mailing list)
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:in `connect'
        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:in `new'
        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:in
`send'
        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:in
`checkout_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:in
`loop'
        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:in `synchronize'
        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:in
`connection'
        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:in `retrieve_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:in `quoted_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:in `find_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:in `find'
        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.
stasch (Guest)
on 2009-04-03 03:26
(Received via mailing list)
Never mind!  It was a hosts file issue.  All better now.
This topic is locked and can not be replied to.