mysql 之 清空表中数据

Posted zero_vic

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了mysql 之 清空表中数据相关的知识,希望对你有一定的参考价值。

 

清空表的时候注意外键约束

 

命令版

查询数据库中所有表名
select table_name from information_schema.tables where table_schema=\'DB_name\' and table_type=\'base table\';

查询指定数据库中指定表的所有字段名column_name
select column_name from information_schema.columns where table_schema=\'DB_name\' and table_name=\'users\'

清空数据库中某表的数据

truncate table 表名 ;


 navicat 版

选中你要清空的表,右键

清除索引、和外

 

以上是关于mysql 之 清空表中数据的主要内容,如果未能解决你的问题,请参考以下文章