简体   繁体   中英

Ruby, connect to sql server

I'm trying to connect to a SQL server in a domain, but I don't know why I have an error.

My environnement is Ubuntu 14.04, and I use mysql2. I think my problem is :server="myServer" but I have to specify what server.

My request is :

db = Mysql2::Client.new(:host => "xxx.xxx.xxx.xxx",:server="myServer" ,:username => "myname", :password => "SECRET", :port => 3306, :database => "test" )

which gives me this error: Mysql2::error (111)

This request is working:

db = Mysql2::Client.new(:host => "192.168.1.1", :username => "root", :password => "SECRET", :port => 3306, :database => "test" )

Take a look at this: Can't connect to MySQL server error 111

Probably you are facing the same issue.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM