+ 1

How to reset id in MySQL

I made a program with Python and link it with MySQL database ,and when I removed all date from MySQL id wasn't reset .

28th Aug 2020, 6:16 PM
Amr Khaled
Amr Khaled - avatar
2 Antworten
+ 2
Are you removing by deleting, dropping, or truncating? https://pynative.com/JUMP_LINK__&&__python__&&__JUMP_LINK-mysql-delete-data/
28th Aug 2020, 6:22 PM
Steven M
Steven M - avatar
+ 2
If you used Delete statement, u need to set the auto increment to 1 by altering the table, but that's not a good idea.. If you are certain that all the data should be removed, at that point u should use truncate statement, it is fast and it resets the autoincrement
28th Aug 2020, 6:54 PM
Мг. Кнап🌠
Мг. Кнап🌠 - avatar