Hi, Tried to configure the database.yml file to point to a remote mysql database but faced an error "Connection refused - connect(2)". Here''s a copy of my database.yml configuration. development: adapter: mysql encoding: utf8 host: <hostname> port: <portnumber> database: <databasename> username: <username> password: <password> socket: <socketpath> Would appreciate any assistance in this area, as I can''t seem to find any articles on Ruby connecting to a remote mysql database. I''m sure that the username and password works. Is there something that I might missed out? Thanks! = ] --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Hi marTyN, This post probably belongs on a MySQL mailing list, not a Rails one, but... It appears that you need to configure the MySQL permissions on your remote database server to allow remote connections from your "originating" host (for the username/password combo you configure in your yml file). The other thing to check is that the firewall on your remote server allows incoming connections (on port 3306 - by default). FYI, Peter On 11 Jun 2008, at 07:21, marTyN wrote:> Hi, > > Tried to configure the database.yml file to point to a remote mysql > database but faced an error "Connection refused - connect(2)". > > Here''s a copy of my database.yml configuration. > > development: > adapter: mysql > encoding: utf8 > host: <hostname> > port: <portnumber> > database: <databasename> > username: <username> > password: <password> > socket: <socketpath> > > Would appreciate any assistance in this area, as I can''t seem to find > any articles on Ruby connecting to a remote mysql database. I''m sure > that the username and password works. Is there something that I might > missed out? > > Thanks! = ]--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
On Tue, Jun 10, 2008 at 11:21 PM, marTyN <martyn.yap-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Tried to configure the database.yml file to point to a remote mysql > database but faced an error "Connection refused - connect(2)". > > Here''s a copy of my database.yml configuration. > > development: > adapter: mysql > encoding: utf8 > host: <hostname> > port: <portnumber> > database: <databasename> > username: <username> > password: <password> > socket: <socketpath>WAG: remove the ''socket'' entry HTH, -- Hassan Schroeder ------------------------ hassan.schroeder-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Hi, I have the exact same problem for connecting to remote DB. 1) This is not a mysql issue, as I can remotely connect to the server user mysql-client 2) I don''t have the host option in my database.yml -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
I made a typo, one should read: 2) I don''t have the socket option in database.yml Anyway, I could go a step further by installing gem mysql, and now I get: Can''t connect to MySQL server on ''10.0.0.2'' (111) -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
does this: # telnet mysql.database.com 3306 give you this: Trying mysql.database.com... Connected to mysql.database.com (mysql.database.com). Escape character is ''^]''. ; 5.1.22-rc-logg? ?? do you have the mysql client locally? you could try this: # mysql -h mysql.database.com -u username -p Here is an example of the database.yml: --- production: username: username adapter: mysql port: 3306 host: mysql.database.com password: password database: my_app_production mysql gem or not, you should be able to connect... sounds like you need to run this on your mysql server: mysql> GRANT ALL PRIVILEGES ON my_app_production.* TO ''username''@''remote.rails.server''; --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
I just confirmed that I can connect to a remote db with both an older (1.2.3) and a newer (2.0.2) rails app. Do a `show grants` from a mysql client to make sure your permissions are set right. -- Hassan Schroeder ------------------------ hassan.schroeder-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---