清空数据库sql

1、清空test库中表数据:

select concat('truncate table ',table_schema,'.',table_name,';') as '执行sql' from information_schema.TABLES where table_schema='test';

2、删除test库中所有表:

select concat('drop table ',table_schema,'.',table_name,';') as '执行sql' from information_schema.TABLES where table_schema='test';

执行相关sql即可。

猜你喜欢

转载自blog.csdn.net/wangpeng322/article/details/85614664