From: "Kroeger, Simon (ext)" Date: 2006-05-06T00:21:46+09:00 Subject: Re: accessing mysql thorugh ruby This might help: http://wiki.rubyonrails.org/rails/pages/MySQL+Database+access+problem cheers Simon > -----Original Message----- > From: list-bounce@example.com > [mailto:list-bounce@example.com] On Behalf Of Andrew Buchan > Sent: Friday, May 05, 2006 5:04 PM > To: ruby-talk ML > Subject: accessing mysql thorugh ruby > > Heres the code: > > [code] > # example of connecting to mysql > > require "mysql" > > begin > > dbName = "database" > m = Mysql.new("localhost", "root", "password") # this line fails > m.select_db(dbName) > > result = m.query("SELECT * FROM test") > fields = result.fetch_fields > fields.each do |field| > puts field.name > end > gets > m.close > > end > > [/code] > > The error: "Cant connect to MySQL server on "localhost" (10061) > (MySQL::Error) > > I accessed mysql through its window with the values I use in the line > that fails, so they are correct. > > Any ideas? > > -- > Posted via http://www.ruby-forum.com/. > >