0

How can I change the value of the ID in a MySQL table, for example, to "9999," while keeping the remaining IDs (1-315) unchanged and ensuring that the next autoincrement value is actually set to "316" and not "10000"?

First I made this command: UPDATE table SET id = 9999 WHERE id = 5;

Then I made this command: ALTER TABLE table AUTO_INCREMENT = 316;

But the next autoincrement was again 10000

3
  • 2
    Why on earth would you want to?? P.S. This has nothing to do with PHP, I changed your tags. Commented May 23, 2023 at 13:10
  • Why not just keep the next ID as 1000? What's the issue with that? It's just an arbitrary number. Commented May 23, 2023 at 13:29
  • As explained in one of the linked questions, you can only do that if you remove the large IDs first: dbfiddle.uk/Y2MgUApP - Otherwise, you'll eventually break future inserts. Commented May 23, 2023 at 13:50

0

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.