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:in `real_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:in `initialize'' 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:in `connection_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:in `retrieve_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:in `add_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:in `find_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:in `auth'' 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 Jacobsen wrote:> 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:---- 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 On 7/27/06, Craig White <craigwhite@azapple.com> wrote:> On Thu, 2006-07-27 at 17:42 -0700, Jake Jacobsen wrote: > > 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: > ---- > 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 > > _______________________________________________ > Rails mailing list > Rails@lists.rubyonrails.org > http://lists.rubyonrails.org/mailman/listinfo/rails >
Reasonably Related Threads
- looking for help with NoMethodError: undefined method `key?' for #<String:0x4795488>
- Brand new to rails: can't get databases to work
- problems in moving an application database from a local to a remote mysql server
- Database can''t connect -
- ActiveRecord, insert and not auto-incremented primary keys...