一楼的代码经修改后,能生成相应数据库的SQL文件并压缩,但不能导出数据及脚本,生成的SQL文件内容为空.
代码如下:
$store_folder = 'E:\DiscuzEXP\mysqldb_bk';
//用户名和密码//该帐号须有操作[所有]的数据库及FILE的权限//否则有些数据库不能备份.$db_username = "root";$db_passWord = "";
//$db_username = "root";
//$db_password = "123456";
$db_username = "discuz";
$db_password = "discuzexp";
$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");
mysql_connect("localhost:6033","$db_username","$db_password");
$query=mysql_list_dbs();
while($result=mysql_fetch_array($query)){
system (dirname(__FILE__).'\\..\\mysql\\bin\\mysqldump --opt -f'."$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";
我试着在DOS窗体中MYSQL5/BIN目录下录入mysqldump --opt -f discuz -usdiscuz -pdiscuzexp >'E:\DiscuzEXP\mysqldb_bk'\mysqlbk.log
可看到虽有提示:" mysqldump: Got error L 23: out of resources when opening file '.\discuz\ecs-template.MYD(Errcode : 24 )when using LOCK TABLES "
但仍能导出MYSQL的数据及脚本.
请问system语句中导出mysql数据库哪里错了呢, |