Merhaba,

<?php
// Veritabanı bilgileri
$host = "localhost"; // Veritabanı sunucusu
$dbname = "veritabani_adi"; // Veritabanı adı
$username = "kullanici_adi"; // Veritabanı kullanıcı adı
$password = "sifre"; // Veritabanı şifresi

// Yedek dosyasının adı (Güncel tarihli olarak)
$backupFile = $dbname . "_" . date("Y-m-d_H-i-s") . ".sql";

// mysqldump komutunu oluşturma
$command = "mysqldump --opt -h $host -u $username -p$password $dbname > $backupFile";

// Komutu çalıştırma
system($command);

// Yedek dosyasını indirime sunma
header('Content-Description: File Transfer');
header('Content-Type: application/octet-stream');
header('Content-Disposition: attachment; filename="' . basename($backupFile) . '"');
header('Expires: 0');
header('Cache-Control: must-revalidate');
header('Pragma: public');
header('Content-Length: ' . filesize($backupFile));
readfile($backupFile);

// Yedek dosyasını sunucudan silme (isteğe bağlı)
unlink($backupFile);

exit;
?>
PHP işleriniz yapılır... (PM)