生活分享

  • 首页
HETAO
业余码农、业余机械爱好者
  1. 首页
  2. 未分类
  3. 正文

Mysql 删除所有表

2014年7月23日 1000点热度 0人点赞 0条评论
SET FOREIGN_KEY_CHECKS = 0; 
SET @tables = NULL;
SELECT GROUP_CONCAT(table_schema, '.', table_name) INTO @tables
  FROM information_schema.tables 
  WHERE table_schema = 'database_name'; -- specify DB name here.

SET @tables = CONCAT('DROP TABLE ', @tables);
PREPARE stmt FROM @tables;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET FOREIGN_KEY_CHECKS = 1; 

 

需要把databasse_name替换为你的表名,这个处理会关闭外键检查

Post Views: 1,055
标签: mysql
最后更新:2014年7月23日

jinzhao

这个人很懒,什么都没留下

点赞
< 上一篇
下一篇 >

COPYRIGHT © 2022 生活分享. ALL RIGHTS RESERVED.

Theme Kratos Made By Seaton Jiang

浙ICP备14004285号-1