Jump to content

php script to backup a mysql database


cleary1981

Recommended Posts

Hi,

 

Does anyone know of a good script i could use to backup my database. Im using windows and I want to back my db up locally but I want the script to run say once a week. Any pointers are much appreciated. I found this script but cant get it to work properly.

 

<?php


$backupFile = 'c:\backup\backup_';
$tableName  = 'supplier';
$dbname = 'tes';
$dbhost = 'localhost';
$dbuser = 'admin';
$dbpass = 'password';

$backupFile = $dbname . date("Y-m-d-H-i-s") . '.gz';
$command = "mysqldump --opt -h $dbhost -u $dbuser -p $dbpass $dbname | gzip > $backupFile";
system($command);


?> 

Link to comment
https://forums.phpfreaks.com/topic/130896-php-script-to-backup-a-mysql-database/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.