This article describes how to use php to batch delete all tables prefixed with prefix _ in the database. This function is more practical, for more information, see how to use php to batch delete all tables prefixed with prefix _ in the database.
For example, delete all tables with the prefix "prefix.
<? Php // Set the database connection information. Database server address, database username, data password mysql_connect ('database host', 'database username ', 'database password '); // Set the queried database name mysql_select_db ('database name'); $ rs = mysql_query ('Show tables '); while ($ arr = mysql_fetch_array ($ rs )) {// Set the database table prefix to be deleted in batches, for example, prefix _ $ TF = strpos ($ arr [0], 'prefix _'); if ($ TF = 0) {$ FT = mysql_query ("drop table $ arr [0]"); if ($ FT) {echo "$ arr [0] deleted successfully!
";}}?>
Operation instance:
Create a new php file and save it as deletedata. php.
For example, if you want to delete the back-end data of www.jb51.net or http://www.jb51.net/, you can perform the following two steps:
1. Upload the saved deletedata. php file to the root directory of your website;
2. enter www.jb51.net/deletedata.php?http://www.jb51.net/deletedata.phpto delete the script.
The script displays information about the successful deletion of all tables in the browser.