protected function getMysqlArguments($credentials, $appendDatabase = true)
    {
        $arguments = [];
        $database = '';
        foreach ($this->databaseArguments as $key) {
            if (empty($credentials[$key])) {
                continue;
            }
            $value = escapeshellarg($credentials[$key]);
            if ($key === 'database') {
                $database = $value;
            } else {
                $arguments[$key] = '--' . $key . '=' . $value;
            }
        }
        if ($appendDatabase === true) {
            return implode(' ', $arguments) . ' ' . $database;
        } else {
            return implode(' ', $arguments);
        }
    }