网创优客建站品牌官网
为成都网站建设公司企业提供高品质网站建设
热线:028-86922220
成都专业网站建设公司

定制建站费用3500元

符合中小企业对网站设计、功能常规化式的企业展示型网站建设

成都品牌网站建设

品牌网站建设费用6000元

本套餐主要针对企业品牌型网站、中高端设计、前端互动体验...

成都商城网站建设

商城网站建设费用8000元

商城网站建设因基本功能的需求不同费用上面也有很大的差别...

成都微信网站建设

手机微信网站建站3000元

手机微信网站开发、微信官网、微信商城网站...

建站知识

当前位置:首页 > 建站知识

怎么重置mysql自增,mysql自增序列重置

如何才能让mysql自动递增的字段重新从1开始

alter table table_name auto_increment=n;

让客户满意是我们工作的目标,不断超越客户的期望值来自于我们对这个行业的热爱。我们立志把好的技术通过有效、简单的方式提供给客户,将通过不懈努力成为客户在信息化领域值得信任、有价值的长期合作伙伴,公司提供的服务项目有:域名注册、网络空间、营销软件、网站建设、永嘉网站维护、网站推广。

注意n只能大于已有的auto_increment的整数值,小于的值无效.

show table status like 'table_name' 可以看到auto_increment这一列是表现有的值.

如果曾经的数据都不需要的话,可以直接清空所有数据,并将自增字段恢复从1开始计数

truncate table 表名

怎么重置mysql的自增列AUTO

重建列

truancate 表

使用命令,如下:

Welcome to the MySQL monitor. Commands end with ; or \g.

Your MySQL connection id is 2

Server version: 5.5.41-log MySQL Community Server (GPL)

Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved.

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

alter table t2 auto_increment=10;

Query OK, 2 rows affected (0.17 sec)

Records: 2 Duplicates: 0 Warnings: 0

mysql insert into t2 values();

Query OK, 1 row affected (0.05 sec)

mysql select * from t2;

+----+

| id |

+----+

| 1 |

| 2 |

| 10 |

+----+

3 rows in set (0.00 sec)

mysql

修改mysql中自增序列的值,恢复初始值

两种方法修改或者重置mysql中的自增字段的值:autoIncrement;

其中方法二可以修改成任意值。


新闻标题:怎么重置mysql自增,mysql自增序列重置
网址分享:http://bjjierui.cn/article/heegge.html

其他资讯