Hi Friends, Today i will tell you about Primary Id Auto Increment Problem in Mysql database. It is a very common problem every developer face once during his/her development time. Most of the time we think why primary id skip some number and start the increment of auto increment of it. We are commonly using primary id with auto increment and we see some ids are not there in our mysql database.
Most of the time we delete some rows and forget which rows are deleted and our database store our deleted value if we are using delete command.
When we are using delete command at that time our auto increment start greater than one that value.
You have to follow some steps to start again your proper auto increment of your primary id.
Step1: Open your Phpmyadmin
Step2: Click on your database and table in which you are facing problem.
Step3: Drop the table after selecting all the rows or by mysql command.
Step4: Now your table is empty with your structure. Click on mysql to run the command.
Step5: After that you have to alter command like below:
alter table users AUTO_INCREMENT = 1
alter table Your Table Name AUTO_INCREMENT = 1
Step6: Now insert the content in your rows using insert command or form and see your problem is solved without much coding.
Step7: Enjoy your database table id with proper auto increment.
Read About Other Interesting Things below.
If You like my blog, kindly Subscribe it.