{"record":{"id":"15ab5f52ea5bb1d6","repo":"flarum/framework","slug":"mariadb-version-version-too-low-you-need-at-least-mariadb","errorCode":null,"errorMessage":"MariaDB version ($version) too low. You need at least MariaDB ","messagePattern":"MariaDB version \\(\\$version\\) too low\\. You need at least MariaDB ","errorType":"exception","errorClass":"RangeException","httpStatus":null,"severity":"error","filePath":"framework/core/src/Install/Steps/ConnectToDatabase.php","lineNumber":65,"sourceCode":"            'mysql' => $this->mysql($config),\n            'mariadb' => $this->mariadb($config),\n            'pgsql' => $this->pgsql($config),\n            'sqlite' => $this->sqlite($config),\n            default => throw new InvalidArgumentException('Unsupported database driver: '.$config['driver']),\n        };\n    }\n\n    private function mysql(array $config): void\n    {\n        $pdo = (new MySqlConnector)->connect($config);\n\n        $raw = $pdo->query('SELECT VERSION()')->fetchColumn();\n\n        if (DatabaseRequirements::isMariaDb($raw)) {\n            $version = DatabaseRequirements::normaliseVersion($raw, true) ?? $raw;\n\n            if (version_compare($version, DatabaseRequirements::MARIADB_MINIMUM, '<')) {\n                throw new RangeException(\"MariaDB version ($version) too low. You need at least MariaDB \".DatabaseRequirements::MARIADB_MINIMUM);\n            }\n        } else {\n            $version = DatabaseRequirements::normaliseVersion($raw, false) ?? $raw;\n\n            if (version_compare($version, DatabaseRequirements::MYSQL_MINIMUM, '<')) {\n                throw new RangeException(\"MySQL version ($version) too low. You need at least MySQL \".DatabaseRequirements::MYSQL_MINIMUM);\n            }\n        }\n\n        ($this->store)(\n            new MySqlConnection(\n                $pdo,\n                $config['database'],\n                $config['prefix'],\n                $config\n            )\n        );\n    }","sourceCodeStart":47,"sourceCodeEnd":83,"githubUrl":"https://github.com/flarum/framework/blob/4b939f685389bfe8a380e9e28ddf305a1c66950c/framework/core/src/Install/Steps/ConnectToDatabase.php#L47-L83","documentation":"RangeException from ConnectToDatabase::mysql when the connected server reports a MariaDB version below DatabaseRequirements::MARIADB_MINIMUM. After connecting, the step runs SELECT VERSION(); if the raw string identifies MariaDB, its normalized version is compared against the minimum and the install aborts. (Its sibling branch throws the equivalent error for MySQL below MYSQL_MINIMUM.)","triggerScenarios":"Connecting to a MariaDB server older than the required minimum (per DatabaseRequirements::MARIADB_MINIMUM) during the ConnectToDatabase install step.","commonSituations":"Old distro packages (e.g. MariaDB 10.1/10.2 on legacy Ubuntu/CentOS); managed hosting with fixed old versions; local dev using an outdated MariaDB container image; upgrades of the app raising the minimum requirement.","solutions":["Upgrade the MariaDB server to at least the version in DatabaseRequirements::MARIADB_MINIMUM (e.g. via the official MariaDB repository).","Point DB_HOST at a newer server/container (e.g. mariadb:10.11 image).","If upgrading is impossible, use a hosting provider or container with a supported version.","Check your current version with SELECT VERSION(); before installing."],"exampleFix":"// before\ndocker run -d mariadb:10.2   # too old\n// after\ndocker run -d mariadb:10.11  # >= DatabaseRequirements::MARIADB_MINIMUM","handlingStrategy":"validation","validationCode":"$version = $pdo->query('SELECT VERSION()')->fetchColumn();\nif (DatabaseRequirements::isMariaDb($version)) {\n    $norm = DatabaseRequirements::normaliseVersion($version, true);\n    if (version_compare($norm, DatabaseRequirements::MARIADB_MINIMUM, '<')) {\n        throw new RuntimeException(\"Upgrade MariaDB: have {$norm}, need \".DatabaseRequirements::MARIADB_MINIMUM);\n    }\n}","typeGuard":"function meetsMinVersion(string $raw, string $min, bool $maria): bool {\n    $v = DatabaseRequirements::normaliseVersion($raw, $maria) ?? $raw;\n    return version_compare($v, $min, '>=');\n}","tryCatchPattern":"try {\n    $step->run($config);\n} catch (RangeException $e) {\n    if (str_contains($e->getMessage(), 'too low')) {\n        $errors['db'] = $e->getMessage().' — upgrade your database server.';\n    }\n}","preventionTips":["Pin container images to a version >= the app's minimum requirement.","Run SELECT VERSION() as an install pre-flight check.","Subscribe to minimum-version changes when upgrading the application.","Use distro repos that ship current MariaDB versions (official MariaDB repo)."],"tags":["database","mariadb","version","compatibility","install"],"backgroundTag":"database-version-unsupported","analyzedSha":"4b939f685389bfe8a380e9e28ddf305a1c66950c","analyzedAt":"2026-09-15T18:09:20.879Z","contentChangedAt":"2026-09-15T18:09:20.879Z","schemaVersion":2},"datasetVersion":"2026-09-16T09:17:16.951Z"}