PDO::ERRMODE_EXCEPTION, ]); echo "Connected to MySQL server successfully.\n"; // Create the database if it doesn't exist $pdo->exec("CREATE DATABASE IF NOT EXISTS `" . DB_NAME . "` CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;"); echo "Database '" . DB_NAME . "' created or already exists.\n"; } catch (PDOException $e) { die("Database creation failed: " . $e->getMessage() . "\n"); }