请各位帮看下,今天使用 gem install mysql 安装了驱动,但还是连接不到数据库。 数据库在 windows 上正常登陆访问 Ruby 代码都是书上的例子和网上找的“ 代码: #encoding:utf-8 require"mysql" begin my =Mysql.connect('127.1.0.1','rubytest','hui8579','MININT-TGJ8CT5\SQL2005') puts "服务器版本:"+my.get_server_info rescue Mysql::Error => err puts"错误代码:#{err.errno}" ensure my.close if my end
错误信息如下:
C:/Ruby193/lib/ruby/1.9.1/mysql.rb:103:in initialize': No connection could be made because the target machine actively refused it. - connect(2) (Errno::ECONNREFUSED)
from C:/Ruby193/lib/ruby/1.9.1/mysql.rb:103:in
new'
from C:/Ruby193/lib/ruby/1.9.1/mysql.rb:103:in real_connect'
from C:/Ruby193/lib/ruby/1.9.1/mysql.rb:91:in
initialize'
from C:/Ruby193/lib/ruby/1.9.1/mysql.rb:1085:in new'
from C:/Ruby193/lib/ruby/1.9.1/mysql.rb:1085:in
real_connect'
from D:/Ruby_test/test_24/tieba.rb:4:in `
请帮忙看下,万分感谢· ruby 版本:1.9.3 sql 版本:sql2005