mysql自增id 重置
生活随笔
收集整理的這篇文章主要介紹了
mysql自增id 重置
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
tableName(表名稱),columnName(自增列名稱)
1、刪除自增列
alter table tableName drop columnName;--刪除自增列?2、添加自增列
alter table tableName add columnName int(0) not null first;--添加自增列3、設置為主鍵并自增
alter table tableName modify column columnName int(0) not null auto_increment,add primary key(columnName); --設置為主鍵并自增測試發現如果表的主鍵字段不止一個時第三個步驟會執行失敗。解決方法是先取消掉其他字段的主鍵標識。
總結
以上是生活随笔為你收集整理的mysql自增id 重置的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: centos 零碎学习小记 2.
- 下一篇: mysql如何用alter创建索引_My