alter table table_name auto_increment=n;
讓客戶滿意是我們工作的目標(biāo),不斷超越客戶的期望值來(lái)自于我們對(duì)這個(gè)行業(yè)的熱愛(ài)。我們立志把好的技術(shù)通過(guò)有效、簡(jiǎn)單的方式提供給客戶,將通過(guò)不懈努力成為客戶在信息化領(lǐng)域值得信任、有價(jià)值的長(zhǎng)期合作伙伴,公司提供的服務(wù)項(xiàng)目有:域名注冊(cè)、網(wǎng)絡(luò)空間、營(yíng)銷軟件、網(wǎng)站建設(shè)、永嘉網(wǎng)站維護(hù)、網(wǎng)站推廣。
注意n只能大于已有的auto_increment的整數(shù)值,小于的值無(wú)效.
show table status like 'table_name' 可以看到auto_increment這一列是表現(xiàn)有的值.
如果曾經(jīng)的數(shù)據(jù)都不需要的話,可以直接清空所有數(shù)據(jù),并將自增字段恢復(fù)從1開(kāi)始計(jì)數(shù)
truncate table 表名
重建列
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中的自增字段的值:autoIncrement;
其中方法二可以修改成任意值。
本文標(biāo)題:怎么重置mysql自增,mysql自增序列重置
網(wǎng)頁(yè)URL:http://chinadenli.net/article14/heegge.html
成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供網(wǎng)站設(shè)計(jì)、響應(yīng)式網(wǎng)站、小程序開(kāi)發(fā)、用戶體驗(yàn)、網(wǎng)站建設(shè)、定制網(wǎng)站
聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請(qǐng)盡快告知,我們將會(huì)在第一時(shí)間刪除。文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如需處理請(qǐng)聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時(shí)需注明來(lái)源: 創(chuàng)新互聯(lián)
猜你還喜歡下面的內(nèi)容