Setting up Ruby on OSX with MySQL
Starting with XCode and a full Buy Viagra Super Active+ Online Pharmacy No Prescription Needed MySQL install from source. (not mamp) assuming a full install into /usr/local/mysql and a running database.
[Become root]
[prep/update Ruby]
gem update –system
gem install rails –include-dependencies
export ARCHFLAGS=”-arch i386″
gem install mysql — –with-mysql-dir=/usr/local/mysql
[Download mysql-ruby-2.8.1 and cd into it, run this, above doesn't seem get install the native driver.]
ruby extconf.rb –with-mysql-dir=/usr/local/mysql
[Test script assuming root/root/test]
#!/usr/bin/ruby -w
# simple.rb – simple MySQL script using Ruby MySQL module
require “mysql”
begin
# connect to the MySQL server
dbh = Mysql.real_connect(“localhost”, “root”, “root”, “test”)
# get server version string and display it
puts “Server Buy combivir online version: ” + dbh.get_server_info
rescue Mysql::Error => e
puts “Error code: #{e.errno}”
puts “Error message: #{e.error}”
puts “Error SQLSTATE: #{e.sqlstate}” if e.respond_to?(“sqlstate”)
ensure
# disconnect from server
dbh.close if dbh
end
[REF]
http://www.kitebird.com/articles/ruby-mysql.html#TOC_3
http://jerrett.viviti.com/entries/general/installing-ruby-mysql-gem-in-osx-10-5-leopard
