Heim >Datenbank >MySQL-Tutorial >MySQL批量删除表_MySQL

MySQL批量删除表_MySQL

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOriginal
2016-06-01 13:30:151159Durchsuche

bitsCN.com

MySQL批量删除表

 

mysql中没有现有的工具可以直接实现,所以原理就是使用现有的功能实现drop table 的语句的自动拼写,从而达到简化目的。

 

下边举例说明,如果想删除”wp_”开头的表:

 

1Select CONCAT( 'drop table ', table_name, ';' )2FROM information_schema.tables3Where table_name LIKE 'wp_%';

 

 

这样就会出现drop table wp_xxxx 的所有语句,复制下来,简单修改一下,直接粘贴到命令行中运行就可以了。

 

bitsCN.com
Stellungnahme:
Der Inhalt dieses Artikels wird freiwillig von Internetnutzern beigesteuert und das Urheberrecht liegt beim ursprünglichen Autor. Diese Website übernimmt keine entsprechende rechtliche Verantwortung. Wenn Sie Inhalte finden, bei denen der Verdacht eines Plagiats oder einer Rechtsverletzung besteht, wenden Sie sich bitte an admin@php.cn