be a Hash" unless opts.is_a? Hash opts = Mysql2::Util.key_hash_as_symbols(opts) ... user = opts[:username] || opts[:user] pass = opts[:password] || opts[:pass] host = opts[:host] || opts[:hostname] port = opts[:port] database = opts[:database] || opts[:dbname] || opts[:db] socket = opts[:socket] || opts[:sock] conn_attrs = parse_connect_attrs(opts[:connect_attrs]) ... connect user, pass, host, port, database, socket, flags, conn_attrs end mysq2/client.rb initializeメソッドで database.yml の情報をもとに接続要求