码迷,mamicode.com
首页 > 数据库 > 详细

mysql批量删除表数据

时间:2015-09-23 19:07:12      阅读:184      评论:0      收藏:0      [点我收藏+]

标签:

2015-09-23

 

#delete_table_data.sh
#批量删除mysql库中表数据 #
!/bin/bash ### AUTHOR: Leo ### DATE: 2015/09/23 ### REV: 1.0 echo -e "Input the dbname you want to use: \c" read db mysql -uroot -ppro#pateo -e "use $db;show tables;"|grep -v Tables>tb_in_$db.txt; for tb in `cat tb_in_$db.txt` do echo $tb; mysql -uroot -ppro#pateo -e "use tas;delete from $tb;select * from $tb;" echo ---------------------------------------; done rm -rf tb_in_$db.txt;

 

mysql批量删除表数据

标签:

原文地址:http://www.cnblogs.com/cenliang/p/4832873.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!