mysql数据库表清空后id如何从1开始自增

mysql数据库表清空后id如何从1开始自增
我们的数据库表中经常会使用id自增,但是每次清空表后id并不是从1开始计数,总是接着之前的进行自增,那么解决呢?

使用mysql的truncate命令,

用法:truncate table 表名;

这样表的id自增就会变回从1开始自增了。

如果清除失败,那就去看看要删除的表和另外的表有无关联,如果有关联,删除关联关系后再清除即可!

posted @ 2020-09-08 20:50  博客码  阅读(1203)  评论(0编辑  收藏  举报
……
(function($){$.fn.snow=function(options){var $flake=$(' ').css({'position':'absolute','top':'-50px'}).html('❄'),documentHeight=$(document).height(),documentWidth=$(document).width(),defaults={minSize:10,maxSize:20,newOn:500,flakeColor:"#FFFFFF"},options=$.extend({},defaults,options);var interval=setInterval(function(){var startPositionLeft=Math.random()*documentWidth-100,startOpacity=0.5+Math.random(),sizeFlake=options.minSize+Math.random()*options.maxSize,endPositionTop=documentHeight-40,endPositionLeft=startPositionLeft-100+Math.random()*200,durationFall=documentHeight*10+Math.random()*5000;$flake.clone().appendTo('body').css({left:startPositionLeft,opacity:startOpacity,'font-size':sizeFlake,color:options.flakeColor}).animate({top:endPositionTop,left:endPositionLeft,opacity:0.2},durationFall,'linear',function(){$(this).remove()});},options.newOn);};})(jQuery); $.fn.snow({ minSize: 5, maxSize: 50, newOn: 1000, flakeColor: '#FFF' });