Home >Database >Mysql Tutorial >Mysql重置自动索引的方法_MySQL

Mysql重置自动索引的方法_MySQL

WBOY
WBOYOriginal
2016-06-01 13:37:021858browse

bitsCN.com


Mysql重置自动索引的方法

 

由于删除了某些记录行,所以自增字段不连 续了 1,3,4,5,7,10

 

这样子 若要重新恢复1,2,3,4,5,6,7连续排序只需要做:

 

方法1:truncate table 你的表名    

 

方法2:delete from 你的表名 dbcc checkident(你的表名,reseed,0) 

 

//重新定位自增的字段,让它从1 开始.
 

bitsCN.com
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn