From 40f3a2c491a067b762b76171ab27b0a123c0fa7c Mon Sep 17 00:00:00 2001 From: Brian Lopez Date: Wed, 30 Jun 2010 10:47:53 -0700 Subject: [PATCH] default the username to 'root' if nothing was specified --- lib/active_record/connection_adapters/mysql2_adapter.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/active_record/connection_adapters/mysql2_adapter.rb b/lib/active_record/connection_adapters/mysql2_adapter.rb index b5b5e83..704639c 100644 --- a/lib/active_record/connection_adapters/mysql2_adapter.rb +++ b/lib/active_record/connection_adapters/mysql2_adapter.rb @@ -5,6 +5,7 @@ require 'mysql2' unless defined? Mysql2 module ActiveRecord class Base def self.mysql2_connection(config) + config[:username] = 'root' if config[:username].nil? client = Mysql2::Client.new(config.symbolize_keys) options = [config[:host], config[:username], config[:password], config[:database], config[:port], config[:socket], 0] ConnectionAdapters::Mysql2Adapter.new(client, logger, options, config)