#!/usr/local/bin/ruby require 'rubygems' require 'mysql' mysql = Mysql.init mysql.connect 'localhost', 'music_app', 'music_app', 'music_app' #connect(host=nil, user=nil, passwd=nil, db=nil, port=nil, sock=nil, flag=nil) results = mysql.query 'SELECT * FROM genres;' results.each { |row| puts row } mysql.close() # Functions vary per database / per driver! eg, Postgres... #conn = PGconn.connect("localhost", 5432, '', '', "test", "myid", "mypass") #res = conn.exec('SELECT * FROM genres;') #res.each { |row| puts row } #conn.close()