[Tips] the simplest way to clear a MYSQL database

Source: Internet
Author: User
Copy the following code and save it as ***. php, and it will be OK. lt ;? Php $ userquot; database username quot; $ passwordquot; Database Password quot; $

Copy the following code and save it as ***. php, and it will be OK. lt ;? Php $ user = quot; database username quot; // $ password = quot; Database password quot; // $

Copy the following code and save it as ***. php.

$ User = "database username ";//
$ Password = "Database password ";//
$ Db_name = "Database Name ";//

$ Link = mysql_connect ("localhost: 3306", $ user, $ password );
Mysql_select_db ("$ db_name", $ link );
Echo"

Clearing database ...";
$ Result = mysql_query ("SHOW tables", $ link );
While ($ currow = mysql_fetch_array ($ result )){
Mysql_query ("drop table if exists $ currow [0]");
Echo $ currow [0]."
";
}
Echo "successful

";

?>


// Upload the above code to any directory in the space and access it through the URL !!!

,

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.