当前位置:Gxlcms > mysql > MuSQL以文件形式导入导出整个数据库

MuSQL以文件形式导入导出整个数据库

时间:2021-07-01 10:21:17 帮助过:26人阅读

MuSQL以文件形式导入导出整个数据库 :lt;?php /* 导出 SELECT * INTO OUTFILE

MuSQL以文件形式导入导出整个数据库 :'; }else{ echo 'Not insert into table '.$row[0].'
'; } } echo "The task is finished"; }else{ if (is_writable(DIR)) { while ($row = mysql_fetch_array($result, MYSQL_NUM)) { $fileName=DIR.$row[0].".txt"; if(file_exists($fileName)){ unlink($fileName); } $querySql = "SELECT * INTO OUTFILE '".$fileName."' FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '\'' LINES TERMINATED BY '\n' FROM `".$row[0]."`"; mysql_query($querySql) or die("Could not dump table: ". $querySql . mysql_error()); echo 'dump table '.$row[0].' success.
'; } echo "The task is finished"; }else{ echo 'Folder '.DIR.' can not writeable'; } } mysql_free_result($result); mysql_close(); ?>

linux

人气教程排行