PDO::ERRMODE_EXCEPTION, PDO::ATTR_DEFAULT_FETCH_MODE => PDO::FETCH_ASSOC, ]; try { $pdo = new PDO($dsn, $user, $pass, $options); $pdo->exec("CREATE DATABASE IF NOT EXISTS `$db`"); $pdo->exec("USE `$db`"); $pdo->exec(" CREATE TABLE IF NOT EXISTS filler ( id INT AUTO_INCREMENT PRIMARY KEY, data LONGBLOB ) "); } catch (\PDOException $e) { die("❌ DB connection failed: " . $e->getMessage()); } // Get database size from information_schema try { $stmt = $pdo->query(" SELECT ROUND(SUM(data_length + index_length) / 1024 / 1024 / 1024, 2) AS total_size_gb FROM information_schema.tables WHERE table_schema = 'testfill' "); $dbSize = $stmt->fetch()['total_size_gb'] ?? '0'; } catch (Exception $e) { $dbSize = 'N/A'; } $message = ''; if ($_SERVER['REQUEST_METHOD'] === 'POST' && isset($_POST['fill'])) { // Insert ~1GB of binary data $iterations = 1024; $data = str_repeat(random_bytes(1024), 1024); // 1MB $stmt = $pdo->prepare("INSERT INTO filler (data) VALUES (:data)"); for ($i = 0; $i < $iterations; $i++) { $stmt->execute([':data' => $data]); } // Recalculate DB size $stmt = $pdo->query(" SELECT ROUND(SUM(data_length + index_length) / 1024 / 1024 / 1024, 2) AS total_size_gb FROM information_schema.tables WHERE table_schema = 'testfill' "); $dbSize = $stmt->fetch()['total_size_gb'] ?? '0'; $message = "

✅ 1GB inserted into MariaDB successfully.

"; } ?> MariaDB Filler

MariaDB Storage Filler