+1 vote
in Databases by (64.6k points)
How can I set the value of an autoincrement column in MySQL table to 1. It contains some values. Should I delete the table?

1 Answer

+3 votes
by (86.3k points)
selected by
 
Best answer

If the table is empty or you are okay with deleting the data, you can truncate it. Truncating automatically resets the auto-increment value. Use the following SQL to delete all rows in the table and reset the auto-increment counter to 1.

TRUNCATE TABLE table_name;


...