Home  >  Article  >  Database  >  清空MYSQL数据库的简单办法_MySQL

清空MYSQL数据库的简单办法_MySQL

WBOY
WBOYOriginal
2016-06-01 14:05:031267browse

保存为***.php运行就OK了.:


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

$link = mysql_connect("localhost:3306",$user,$password);
mysql_select_db("$db_name",$link);
echo "

正在清空数据库...";
$result=mysql_query("SHOW tables",$link);
while ($currow=mysql_fetch_array($result)) {
mysql_query("drop TABLE IF EXISTS $currow[0]");
echo $currow[0]."
";
}
echo "成功

";

?>
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn