Chinaunix首页 | 论坛 | 博客
  • 博客访问: 385505
  • 博文数量: 112
  • 博客积分: 10
  • 博客等级: 民兵
  • 技术积分: 800
  • 用 户 组: 普通用户
  • 注册时间: 2010-12-29 13:41
文章分类

全部博文(112)

文章存档

2020年(1)

2018年(10)

2017年(27)

2016年(18)

2015年(31)

2014年(25)

分类: Mysql/postgreSQL

2014-12-26 17:26:22

现在我的数据库(minmin)里面有好多好多以t_开头的表,我现在想删掉所有这样的表。但是,一个个的删出又很麻烦,经过查找资料掌握了一个批量删除的方法:
drop_tab.sh
#!/bin/bash
droptab=`mysql -e "select concat('drop table ',group_concat(table_name),';') as tables from information_schema.tables where table_schema = 'minmin' and table_name  regexp '^t_.*';"|grep -v tables`
mysql -e "use minmin;${droptab}"
阅读(907) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~