mysql 删除(清除)所有表数据方法,表格保留

来源:互联网 发布:网络销售合作协议范本 编辑:程序博客网 时间:2024/05/11 15:15

首先把删除表格的sql找出来:

SELECT CONCAT('TRUNCATE TABLE ',TABLE_NAME,';') FROM TABLES WHERE TABLE_SCHEMA='要删除DB名字'

结果大概:

TRUNCATE TABLE chat_activity;TRUNCATE TABLE chat_checkin;TRUNCATE TABLE chat_loginlog;TRUNCATE TABLE chat_message;TRUNCATE TABLE chat_message_bakup;TRUNCATE TABLE chat_setting;TRUNCATE TABLE chat_teacher;TRUNCATE TABLE chat_tvote;TRUNCATE TABLE chat_user;TRUNCATE TABLE count_voting;TRUNCATE TABLE cr_userinfo;TRUNCATE TABLE diy_block;TRUNCATE TABLE diy_color;TRUNCATE TABLE diy_common;TRUNCATE TABLE diy_kefu;TRUNCATE TABLE diy_logo;TRUNCATE TABLE diy_notice;TRUNCATE TABLE diy_vipcode;TRUNCATE TABLE user_type;

然后你懂的, 直接运行这个列表的sql就大功告成了!!!



0 0
原创粉丝点击