I'm trying to connect to a hosted MySQL database from my Ruby script.
require "rubygems"
require "mysql"
con = Mysql::new('host', 'user', 'pass', 'database')
Running this results in:
ArgumentError: wrong number of arguments (4 for 0)
method initialize in untitled at line 4
method new in untitled at line 4
at top level in untitled at line 4
My setup:
- Mac OS X Snow Leopard 10.6.4
- Ruby 1.8.7
- mysql (rubygem) 2.8.1
- gem 1.3.7
- MySQL 5.1.26 (hosted)
I've tried using these variants when connecting:
con = Mysql.new('host', 'user', 'pass', 'database')
# same as above
con = Mysql.real_connect('host', 'user', 'pass', 'database')
# output => NoMethodError: undefined method ‘real_connect’ for Mysql:Class
Please point me in the right direction.