Today suddenly found that we have many tables in the database, suffix named "Copy", is estimated to be a direct copy of the navicat caused, and then to those with the same suffix name of the table to delete, if a choice will be troublesome, the table for more, find a method on the Internet, mainly through SQL statements to delete, Himself on his basis to write a PHP file implementation of the bulk delete table, in fact the principle is the same.
1. mysql Batch Delete
[1] Get the bulk delete command:
Select CONCAT (' drop table ', table_name, '; ') From Information_schema.tables Where table_name like '%_copy ';
It needs to be adjusted only need to adjust the "%_copy", according to the table characteristics to be removed to adjust
[2] Delete the table, according to the generated text, after copying, execution can be implemented to delete the table.
2, PHP implementation of the deletion, in fact, the same principle as above
<?php$con = mysql_connect ("localhost", "root", "" "), mysql_select_db (" Ceshibiao ", $con); $query =" Select CONCAT (' Drop Table ', table_name, '; ') As Ceshifrom information_schema.tables Where table_name like '%_copy '; "; $cursor = mysql_query ($query), while ($ROW =mysql_fetch_array ($cursor)) {mysql_query ($ROW ["Ceshi"])}?>
MySQL bulk delete specified prefix or suffix table