Problems connecting to remote mysql db

Hi,

I am having a problem connecting to a remote mysql db and I can’t
figure out what the problem is. When I try to connect I get the error:

getaddrinfo: no address associated with hostname.

I have looked all over for clues as to what that means but I haven’t
been able to find anything that helps. I have no problems connecting
to the database with php and with the mysql query browser, I only have
problems connecting with rails and the settings in database.yml
correspond to the settings I have in php. I also don’t have any
problem connecting to the mysql db on my local machine. I have also
tried it on Windows and Mac OSX and I get the same error on both
platforms.

The remote db version is MySQL 4.0.15-standard. I have also granted
privelages for the user I am connecting with for all domains.

The trace gives me:

C:/InstantRails-1.0/ruby/lib/ruby/gems/1.8/gems/activerecord-1.14.3/lib/active_record/vendor/mysql.rb:108:in
initialize' C:/InstantRails-1.0/ruby/lib/ruby/gems/1.8/gems/activerecord-1.14.3/lib/active_record/vendor/mysql.rb:108:inreal_connect’
C:/InstantRails-1.0/ruby/lib/ruby/gems/1.8/gems/activerecord-1.14.3/lib/active_record/connection_adapters/mysql_adapter.rb:330:in
connect' C:/InstantRails-1.0/ruby/lib/ruby/gems/1.8/gems/activerecord-1.14.3/lib/active_record/connection_adapters/mysql_adapter.rb:87:ininitialize’
C:/InstantRails-1.0/ruby/lib/ruby/gems/1.8/gems/activerecord-1.14.3/lib/active_record/connection_adapters/mysql_adapter.rb:36:in
mysql_connection' C:/InstantRails-1.0/ruby/lib/ruby/gems/1.8/gems/activerecord-1.14.3/lib/active_record/connection_adapters/abstract/connection_specification.rb:251:inconnection_without_query_cache=’
C:/InstantRails-1.0/ruby/lib/ruby/gems/1.8/gems/activerecord-1.14.3/lib/active_record/query_cache.rb:54:in
connection=' C:/InstantRails-1.0/ruby/lib/ruby/gems/1.8/gems/activerecord-1.14.3/lib/active_record/connection_adapters/abstract/connection_specification.rb:220:inretrieve_connection’
C:/InstantRails-1.0/ruby/lib/ruby/gems/1.8/gems/activerecord-1.14.3/lib/active_record/connection_adapters/abstract/connection_specification.rb:78:in
connection' C:/InstantRails-1.0/ruby/lib/ruby/gems/1.8/gems/activerecord-1.14.3/lib/active_record/base.rb:1046:inadd_limit!’
C:/InstantRails-1.0/ruby/lib/ruby/gems/1.8/gems/activerecord-1.14.3/lib/active_record/base.rb:1017:in
construct_finder_sql' C:/InstantRails-1.0/ruby/lib/ruby/gems/1.8/gems/activerecord-1.14.3/lib/active_record/base.rb:924:infind_every’
C:/InstantRails-1.0/ruby/lib/ruby/gems/1.8/gems/activerecord-1.14.3/lib/active_record/base.rb:381:in
find' #{RAILS_ROOT}/app/controllers/intro_controller.rb:24:inauth’

If anyone has an idea about what is going on I would really appreciate
it.

Thanks,
Jake

On Thu, 2006-07-27 at 17:42 -0700, Jake J. wrote:

problems connecting with rails and the settings in database.yml
correspond to the settings I have in php. I also don’t have any
problem connecting to the mysql db on my local machine. I have also
tried it on Windows and Mac OSX and I get the same error on both
platforms.

The remote db version is MySQL 4.0.15-standard. I have also granted
privelages for the user I am connecting with for all domains.

The trace gives me:


make sure that there are no tab characters in database.yml, only spaces
as separators.

gettaddinfo: no address associated with hostname means that the ‘host’
name listed within database.yml so it would seem that the problem is
either a typo or use of tabs instead of spaces

Craig

Craig,

Thank you very much. I didn’t have any tab characters in my
database.yml file (although I didn’t know that and it is a useful
thing to know) but that led me to the right answer. The problem was
that I had the port number as part of the host with the host.

I had the host set like I did in php

host: my.domain.com:3306

and I found an example of the correct way

host: my.domain.com
port: 3306

Thanks again,
Jake