uri = URI.parse("mysql://u-kondo:XXXXX@localhost:3306/hogege") uri.class #=> URI::MySQL uri.host #=> localhost require 'uri' require 'active_record' class URI::MySQL < URI::Generic def default_port 3306 end def database path[1..-1] rescue nil end def connection_hash { :adapter => scheme, :host => host, :username => user, :password => password, :database => database, :encoding => 'utf8', :port => p