```ruby
module Activerecord::Mysql::Reconnect::NewConnectionWithRetry
  def new_connection
    Activerecord::Mysql::Reconnect.retryable(
      :proc => proc { super },
      :connection => spec.config,
    )
  end
end
class ActiveRecord::ConnectionAdapters::ConnectionPool
  prepend Activerecord::Mysql::Reconnect::NewConnectionWithRetry
end
```

Load database config from db_config instead
user
```ruby
module Activerecord::Mysql::Reconnect::NewConnectionWithRetry
  def new_connection
    if defined?(db_config)
      Activerecord::Mysql::Reconnect.retryable(
        :proc => proc { super },
        :connection => db_config.configuration_hash
      )
    else
      Activerecord::Mysql::Reconnect.retryable(
        :proc => proc { super },
        :connection => spec.config,
      )
    end
  end
end
class ActiveRecord::ConnectionAdapters::ConnectionPool
  prepend Activerecord::Mysql::Reconnect::NewConnectionWithRetry
end
```
assistant