Home > Database > Mysql Tutorial > PHP删除MYSQL 数据库中所有表的代码_MySQL

PHP删除MYSQL 数据库中所有表的代码_MySQL

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
Release: 2016-06-01 13:57:13
Original
1012 people have browsed it

    如果不想删除库,只想删除库里的所有表,那就用这个脚本吧呵呵

很方便的.

.$hostname ='localhost';
$userid = 'user';
$password = 'password';
$dbname = 'dbname';
$connect = mysql_connect($hostname,$userid,$password);
mysql_select_db($dbname);
$result = mysql_query("show table status from $dbname",$connect);
while($data=mysql_fetch_array($result)) {
mysql_query("drop table $data[Name]");
}
?>

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