protected function buildDsn($withDatabase = true)
    {
        $dsn = 'mysql:host='.$this->config['host'];
        if ($withDatabase) {
            $dsn .= ';dbname='.$this->config['name'];
        }
        if (!empty($this->config['port'])) {
            $dsn .= ';port='.$this->config['port'];
        }

        return $dsn;
    }