美文网首页
Mysql清空某个数据库下的所有表的数据

Mysql清空某个数据库下的所有表的数据

作者: cuihaomaster | 来源:发表于2019-06-18 17:49 被阅读0次

使用navicat 软件

1.db_game 为要清空的数据库

select CONCAT('truncate TABLE ',table_schema,'.',TABLE_NAME, ';') 
from INFORMATION_SCHEMA.TABLES where  table_schema in ('db_game');

执行结果:


image.png
  1. 选中复制步骤一的执行结果,再打开个新的查询窗口,粘贴执行。


    image.png

相关文章

网友评论

      本文标题:Mysql清空某个数据库下的所有表的数据

      本文链接:https://www.haomeiwen.com/subject/tclqqctx.html