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

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

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
Release: 2016-06-01 14:05:03
Original
1336 people have browsed it

保存为***.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 "成功

";

?>
Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template