How can we reset the autoincrement value of primary key in a mysql table

Now while testing we keep on adding rows to tables. But once we need to put in some real data, the primary key index is no longer the initial value like an empty table.
Suppose we did 30 test entries. Even if we delete them, the next items being added start from index 31.

Here is the fix to make it start from 1 again.


We can actually set it to any value we require.

Hope it helps. Cheers!