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 rubyHeres the code:
[code]
# example of connecting to mysqlrequire "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.closeend
[/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/\.