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

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

0 Answers0