Jump to content

[SOLVED] mysql table backup


pcw

Recommended Posts

Hi, I am having a prob with this script. It is creating the backup file, but is not writing the contents of the table into it.

 

 

include_once("data/required.php");

$date = date("d-m-Y");
$backupFile = "$date-profiles.sql";

$backupDir  = "/home/moveitho/public_html/sitebuilder/backup/"; 

$conn = mysql_connect($dbhost, $dbuser, $dbpass) or die(mysql_error()); 

$back = $backupDir.$backupFile; 
$strCommand = sprintf("mysqldump moveitho_sitebuilder profiles -h%s -u%s -p%s > %s",$host,$user,$pass,$back) or die (mysql_error()); 

echo shell_exec($strCommand); 
echo "Backup file $backupFile has been created successfully";
echo "This file has been saved in $backupDir";

 

This was working yeaterday, but I think I might have accidently changed something.

Link to comment
https://forums.phpfreaks.com/topic/150349-solved-mysql-table-backup/
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.