Today suddenly found that we have many more tables in the database, suffix named "Copy", is expected to be a direct copy of the navicat caused, and then to those with the same suffix name of the table to delete, assuming that a choice will be very troublesome, the table for many, in the online search method, the Internet mainly through SQL statements to delete. Himself on his basis to write a PHP file implemented by 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 is necessary to adjust the only need to adjust the "%_copy" can be, according to the characteristics of the table to be removed to adjust
[2] Deletes the table, based on the generated text. After copying. Operation can be achieved by deleting the table.
2, PHP implementation Delete. Actually, the same thing 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