欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  数据库

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

程序员文章站 2022-05-13 11:55:04
...

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(); ?>

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