fbpx

Delete All Database Table Records and Reset Increment

In order to delete all rows, or records, from a Database table and reset the incrementing field, typically the id field, back to 0, you need to run the simple function below:

TRUNCATE users;

So, if I had 100 users in my users table, and then I ran the TRUNCATE users command above, I would have 0 users in my users table and any new user that I add to the table would start at 1.

If you aren’t sure where to enter this command, I suggest using a remote MySQL client like SequelPro or MySQL Workbench. If you’re using a database other than MariaDB or MySQL, you will likely need to use a different client and a different command than the one listed above.

Leave a Reply

Your email address will not be published. Required fields are marked *