From 3007b73415635ac44bd536e6cace50e1c6229cac Mon Sep 17 00:00:00 2001 From: Marc Delisle Date: Mon, 27 Apr 2015 14:40:19 -0400 Subject: [PATCH] New FAQ 6.38 How can I reassign auto-incremented values? Signed-off-by: Marc Delisle --- doc/faq.rst | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/doc/faq.rst b/doc/faq.rst index 6f5b5fa125..29f2e35a56 100644 --- a/doc/faq.rst +++ b/doc/faq.rst @@ -2011,6 +2011,34 @@ Which says, OwnerEmail depends on OwnerLastName and OwnerFirstName. OwnerPhone depends on OwnerLastName and OwnerFirstName. PetType depends on PetBreed. +.. _faq6_38: + +6.38 How can I reassign auto-incremented values? +------------------------------------------------ + +Some users prefer their AUTO_INCREMENT values to be consecutive; this is not +always the case after row deletion. + +Here are the steps to accomplish this. These are manual steps because they +involve a manual verification at one point. + +* Ensure that you have exclusive access to the table to rearrange + +* On your primary key column (i.e. id), remove the AUTO_INCREMENT setting + +* Delete your primary key in Structure > indexes + +* Create a new column future_id as primary key, AUTO_INCREMENT + +* Browse your table and verify that the new increments correspond to what + you're expecting + +* Drop your old id column + +* Rename the future_id column to id + +* Move the new id column via Structure > Move columns + .. _faqproject: phpMyAdmin project