1. Directly Reset Autoincrement Value
Alter table syntax provides a way to reset autoincrement column. Take a look at following example.
ALTER TABLE table_name AUTO_INCREMENT = 1;
Note that you cannot reset the counter to a value less than or equal to any that have already been used. For MyISAM, if the value is less than or equal to the maximum value currently in the AUTO_INCREMENT column, the value is reset to the current maximum plus one. For InnoDB, if the value is less than the current maximum value in the column, no error occurs and the current sequence value is not changed.
2. Truncate Table
Truncate table automatically reset the Autoincrement values to 0.
3. Drop & Recreate Table
This is another way of reseting autoincrement index.
- Board index
- Search
-
- It is currently Thu May 16, 2024 9:55 pm
- All times are UTC+05:30
How to reset autoincrement field in mySql
Jump to
- Programmable Electronics
- ↳ Arduino
- ↳ Raspberry Pi
- ↳ Microcontrollers
- ↳ FPGA
- ↳ Digital Signal Processors
- ↳ Other
- Programming
- ↳ Web programming
- ↳ PHP & MySQL
- ↳ ASP & ASP.Net
- ↳ .Net & Other Programming
- ↳ .NET Programming
- ↳ Visual Basic Programming
- ↳ Java Programming
- ↳ C/C++ Programming
- Engineering
- ↳ Electronics & Electrical Engineering
- ↳ Embedded Systems
- ↳ Computer Science
- ↳ Software Engineering
- ↳ Data Structures & Algorithms
- ↳ Programming Languages & Compiler Theory
- ↳ Operating Systems
- ↳ Cryptography
- ↳ Computer Networks
- ↳ SQL & Database
- ↳ Computer Architecture
- ↳ Graphics & Vision
- ↳ Artificial Intelligence
- ↳ Neural Networks
- ↳ Multimedia
- ↳ Mathematics
- ↳ Other
- ↳ Control Systems & Robotics
- ↳ Mechanical
- ↳ Thermodynamics
- ↳ Fluid Dynamics
- ↳ Aerodynamics
- ↳ Manufacturing
- ↳ Energy
- ↳ Dynamics
- ↳ Statics
- ↳ Automobile
- ↳ Other
- ↳ Other
- Operating Systems
- ↳ Windows
- ↳ Linux
- ↳ Mac OS
- ↳ Android
- ????? ????
- ↳ ???????? ?????
- ↳ ??????? ???? ?????
- ↳ ????? ?????? ???? (Buy Guide)
- ↳ ??????? ???? ??????? (Where to buy)
- ↳ ????????? ???????? (Recommend - Complain - Review)
- General
- ↳ News & Announcements
- ↳ General Discussions
- ↳ Viruses, Trojans, Spyware and Adware
- ↳ Computer & Network Security
- ↳ Web Related
- Members Zone
- ↳ Project Assistance
- ↳ Advertising
- ↳ Jobs & Investment Opportunities
- ↳ Introductions
- ↳ Presents & Donations
- ↳ Entertainment
- ↳ Music & Albums
- ↳ Movies
- ↳ Games