Created
September 5, 2019 16:24
-
-
Save meysampg/0f8458ebd36ee99c2aa63bb6b2b12656 to your computer and use it in GitHub Desktop.
Reset Primary Key of a table
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ALTER TABLE `test` DROP `id`; | |
ALTER TABLE `test` AUTO_INCREMENT = 1; | |
ALTER TABLE `test` ADD `id` BIGINT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY FIRST; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Also, this bash file generate a query which reset the PK by a cross join: