Jump to content


Photo

mysql backup script


  • Please log in to reply
No replies to this topic

#1 natalieG

natalieG
  • Members
  • PipPipPip
  • Advanced Member
  • 63 posts

Posted 15 June 2006 - 03:48 PM

we want to backup our database with a CRONTAB and need to geenrate the php script file. We don't
know the PHP configuration as to if it is stanfdalone or not, but we will sort that out
later. The filename will haver the date of backup in it. We have not tried the below scripot, but could
you take a quick look and tell us of this should work?
Thanks,

Jennifer

<?php
$todaydate=date('m-d-Y');
$dbname=my database name;
$user = username
$password=mysql password
$filename='backup' . $todaydate .'.dmp' ;
$dumpstr="mysqldump $dbname -u $user -p $password > /home/msdsimg/backup/$filename";
shell($dumpstr);
?>





0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users