2006-01-18 18:20:22 by: h4x0r

清空MySQL数据库的简单办法

Font Size: Large | Medium | Small
<?php

$user = ""; //数据库用户名
$password = "";//数据库密码
$db_name = "";//数据库名

$link = mysql_connect("localhost:3306",$user,$password);
mysql_select_db("$db_name",$link);
echo "<p>正在清空数据库...";
$result=mysql_query("SHOW tables",$link);
while ($currow=mysql_fetch_array($result)) {
mysql_query("drop TABLE IF EXISTS $currow[0]");
echo $currow[0]."<br>";
}
echo "成功</p>";

?>

保存为***.php运行就OK了:
Comments Feed Comments Feed: http://www.4evil.org/feed.asp?q=comment&id=516

There is no comment on this article.

Post Comment
Smilies
[smile] [confused] [cool] [cry]
[eek] [angry] [wink] [sweat]
[lol] [stun] [razz] [redface]
[rolleyes] [sad] [yes] [no]
[heart] [star] [music] [idea]
Enable UBB Codes
Auto Convert URL
Show Smilies
Hidden Comment
Username:   Password:   Register Now?
Security Code * Please Enter the Security Code