ºìÁªLinuxÃÅ»§
Linux°ïÖú

´ÓMySQLµ¼Èëµ¼³ö´óÁ¿Êý¾ÝµÄ³ÌÐòʵÏÖ·½·¨

·¢²¼Ê±¼ä:2006-09-27 16:59:54À´Ô´:ºìÁª×÷Õß:lgms2008
´ó¼ÒÒ»¶¨Ê¹Óùý phpmyadmin ÀïÃæµÄÊý¾Ý¿âµ¼È룬µ¼³ö¹¦ÄÜ£¬·Ç³£·½±ã¡£µ«ÊÇÔÚʵ¼ÊÓ¦ÓÃÖУ¬ÎÒ·¢ÏÖÈçϼ¸¸öÎÊÌ⣺
1 Êý¾Ý¿â³¬¹ýÒ»¶¨³ß´ç£¬±ÈÈç6M ÕâʱʹÓõ¼³öÒ»°ãûÎÊÌ⣬¿ÉÒÔÕýÈ·µÄ±£´æµ½±¾»úÓ²ÅÌÉÏÃ棬µ«Êǵ¼ÈëÔò²»ÐУ¡Ô­ÒòÊÇ£ºÒ»°ãµÄ PHP.INI ÀïÃæÉèÖÃÁÙʱÎļþ/ÉÏ´«ÎļþµÄ´óСÏÞÖÆΪ2M£¬¶øphpmyadminʹÓÃÁËÉÏ´«µÄ·½Ê½£¬Ôì³Éʧ°Ü¡£
2 µ¼³öµ½Ó²ÅÌµÄ .SQL ÎļþÔÚµ¼»Øʱ£¬¾­³£³öÏÖÓÉÓÚijЩµ¥ÒýºÅµÄÎÊÌâÒýÆðʧ°Ü£¬Ôì³Éµ¼Èëʧ°Ü£¬Ö»ÄÜÓà mysqlµÈÓ¦ÓóÌÐòµ¼ÈëÁË¡£
ÎÒµÄÊý¾Ý¿âÒѾ­³¬¹ý10M,ËùÒÔ±ØÐë½â¾öÕâ¸öÎÊÌâ¡£ÎÒµÄ˼·£º
µ¼³ö£º ÓÃphpmyadmin ±£´æÊý¾Ý¿â/±í¸ñ½á¹¹£¬Óýű¾¶ÁÈ¡Êý¾Ý¿âÄÚÈݲ¢±£´æµ½ÎļþÀïÃ棡
µ¼È룺 ÓÃphpmyadmin »Ö¸´Êý¾Ý¿â/±í¸ñ½á¹¹£¬Óýű¾¶ÁÈ¡Îļþ£¬È»ºó±£´æµ½¿âÀïÃ棡
µ¼³ö³ÌÐòÈçÏ£ºµ÷Ó÷½·¨Îª ****.php?table=tablename
Õâ¸ö¼òµ¥µÄ³ÌÐòÄ¿Ç°Ò»´Î±£´æÒ»¸ö±í¸ñ£¡£¡Ã¿ÐÐΪһ¸ö×ֶεÄÊý¾Ý£¡£¡

if($table==\"\")exit();
mysql_connect(\"localhost\",\"name\",\"password\");
mysql_select_db(\"database\");
$result = mysql_query(\"select * from $table\");
if(mysql_num_rows($result)
echo \"¿ªÊ¼×ª»»Êý¾Ýµ½Îı¾...
\";
$handle = fopen(\"$table.txt\",\"w\");
$numfields = mysql_num_fields($result);
fputs($handle,$numfields.\"\r\n\");
for($k=0;$k
{
$msg = mysql_fetch_row($result);
for($i=0;$i
{
$msg[$i] = str_replace(\"\r\n\",\"&&php2000mysqlreturn&&\",$msg[$i]);
$msg[$i] = str_replace(\"\n\" ,\"&&php2000mysqlreturn&&\",$msg[$i]);
fputs($handle,$msg[$i].\"\r\n\");
}
fputs($handle,\"------- php2000 dump data program V1.0 for MySQL --------\r\n\");
}
fclose($handle);
echo \"ok\";
?>
µ¼ÈëµÄ³ÌÐòÈçÏ£ºÓ÷¨Í¬ÉÏÃ棡

if($table==\"\")exit();
mysql_connect(\"localhost\",\"name\",\"password\");
mysql_select_db(\"database\");
$message = file(\"$table.txt\");
echo $numfields = chop($message[0]);
for($k=1;$k
{
$value=\"\";
for ($i=$k;$i
{
$tmp = str_replace(\"&&php2000mysqlreturn&&\",\"\r\n\",chop($message[$i]));
$value .= \"\'\".addslashes($tmp).\"\',\";
}
$tmp = str_replace(\"&&php2000mysqlreturn&&\",\"\r\n\",chop($message[$k+$numfields-1]));
$value .= \"\'\".$tmp.\"\'\";
$query = \"insert into $table values (\".$value.\")\";
echo mysql_error();
mysql_query($query);
echo $k.\" \";
}
echo \"ok\";
?>
ʹÓ÷½·¨ºÍ¿ÉÄܵÄÎÊÌ⣡
1 µ¼Èëʱ file()º¯Êý¿ÉÄÜ»áÓÐÎÊÌ⣨ÎÒµÄ10MµÄÊý¾Ýû³öÏÖÎÊÌ⣩£¬¿ÉÒÔ¸ÄΪ fopen()È»ºóû´Î¶ÁÒ»ÐУ¡£¡
2 µ¼È룬µ¼³ö¶¼ÐèÒªÓà ftp ²Ù×÷£¬Ò²¾ÍÊǵ¼³öºó£¬Óà ftp °ÑÊý¾Ýתµ½±¾»ú£¬µ¼ÈëʱÏÈÓÃftpתÒÆÊý¾Ýµ½·þÎñÆ÷£¡
ÎÄÕÂÆÀÂÛ

¹²ÓÐ 0 ÌõÆÀÂÛ