default the username to 'root' if nothing was specified
This commit is contained in:
parent
6ef738200d
commit
40f3a2c491
@ -5,6 +5,7 @@ require 'mysql2' unless defined? Mysql2
|
|||||||
module ActiveRecord
|
module ActiveRecord
|
||||||
class Base
|
class Base
|
||||||
def self.mysql2_connection(config)
|
def self.mysql2_connection(config)
|
||||||
|
config[:username] = 'root' if config[:username].nil?
|
||||||
client = Mysql2::Client.new(config.symbolize_keys)
|
client = Mysql2::Client.new(config.symbolize_keys)
|
||||||
options = [config[:host], config[:username], config[:password], config[:database], config[:port], config[:socket], 0]
|
options = [config[:host], config[:username], config[:password], config[:database], config[:port], config[:socket], 0]
|
||||||
ConnectionAdapters::Mysql2Adapter.new(client, logger, options, config)
|
ConnectionAdapters::Mysql2Adapter.new(client, logger, options, config)
|
||||||
|
Loading…
Reference in New Issue
Block a user