<?php
/**
#FileName: mysql_backup.php #Author: faisun #Website: http://www.jb200.com
//保存目录,路径要用反斜杠.您需要手动建立它. $store_folder = ’D:/databse_backup’;
//用户名和密码
//该帐号须有操作[所有]的
数据库及FILE的权限
//否则有些数据库不能备份
*/
$db_username = "root";
$db_password = "";
$time=time();
$nowdir = "$store_folder
//".date("Ymd",$time)."";
if(
file_exists("$nowdir.rar")) die("File exists./n");
@mkdir($nowdir);
mysql_connect("localhost","$db_username","$db_password");
$query=mysql_list_dbs();
while($result=mysql_fetch_array($query))
{
system (dirname(__FILE__).’/../mysql/bin/
mysqldump --opt ’.
"$result[Database]-u{$db_username} ".($db_password?"-p{$db_password}":"")." >$nowdir//$result[Database].sql");
echo "dumping database `$result[Database]`.../n"; } echo "/nWinrar loading.../n"; system( dirname(__FILE__)."
//WinRAR//WinRAR.exe a -ep1 -r -o+ -m5 -df /"$nowdir.rar/" "$nowdir/" " );
//删除 5 天前的文件 @unlink("$store_folder//".date("Ymd",$time-86400*5).".rar");
echo "/nOK!/n"; >
?>
6. 双击该 bat 文件运行,检测是否可以正常运行。