Hello, I''m trying to connect to a remote mysql server using a ssh tunnel and activerecord. I know the ssh tunnel is working because I can connect via the cmd line client. I''ve set the ssh tunnel up like this: ssh -L 3307:127.0.0.1:3306. So, I thought I could just change the port on my active record connection, but it still connects to my local mysql server. class MyClass < ActiveRecord::Base establish_connection( :adapter => ''mysql'', :user => ''root'', :database => ''hrsuite_production'', :server => "127.0.0.1", :port => 3307) I''ve also tried :server => ''127.0.0.1:3307'' but that did not work either. I also tried :socket => nil, but no luck. I''m running active record 2.3.4 Any suggestions and thanks for taking a look, Matt
mpiskorz wrote:> > > class MyClass < ActiveRecord::Base > establish_connection( > :adapter => ''mysql'', > :user => ''root'', > :database => ''hrsuite_production'', > :server => "127.0.0.1", > :port => 3307) > > I''ve also tried :server => ''127.0.0.1:3307'' but that did not work > either. I also tried :socket => nil, but no luck. >Try :host instead of :server . -- Posted via http://www.ruby-forum.com/.
Aldric, Thanks a lot! That was it. I don''t know how many times I looked at the API yesterday, but there it was. Thanks for catching it. By chance, do you know what the difference is between using host and server? Thanks again! Matt On Nov 11, 5:53 am, Aldric Giacomoni <rails-mailing-l...@andreas- s.net> wrote:> mpiskorz wrote: > > > class MyClass < ActiveRecord::Base > > establish_connection( > > :adapter => ''mysql'', > > :user => ''root'', > > :database => ''hrsuite_production'', > > :server => "127.0.0.1", > > :port => 3307) > > > I''ve also tried :server => ''127.0.0.1:3307'' but that did not work > > either. I also tried :socket => nil, but no luck. > > Try :host instead of :server . > -- > Posted viahttp://www.ruby-forum.com/.
mpiskorz wrote:> > I don''t know how many times I looked at the API yesterday, but there > it was. Thanks for catching it.You''re welcome :)> > By chance, do you know what the difference is between using host and > server? >You mean, besides the fact that host works and server doesn''t? ;-) I''m guessing that, in the absence of a valid :host option, it tries to connect to localhost. -- Posted via http://www.ruby-forum.com/.