alter table table_name auto_increment=n;
注意n只能大于已有的auto_increment的整数值,小于的值无效.
show table status like 'table_name' 可以看到auto_increment这一列是表现有的值.
如果曾经的数据都不需要的话,可以直接清空所有数据,并将自增字段恢复从1开始计数
truncate table 表名
重建列
truancate 表
使用命令,如下:
Welcome to the MySQL monitor. Commands end with ; or \g.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql use test
Database changed
+----+
| id |
| 1 |
| 10 |
mysql
两种方法修改或者重置mysql中的自增字段的值:autoIncrement;
其中方法二可以修改成任意值.
以上就是土嘎嘎小编为大家整理的怎么重置mysql自增相关主题介绍,如果您觉得小编更新的文章只要能对粉丝们有用,就是我们最大的鼓励和动力,不要忘记讲本站分享给您身边的朋友哦!!