Delete all records in a table of MYSQL in phpMyAdmin

Amirhosein Heydari picture Amirhosein Heydari · Aug 16, 2013 · Viewed 474.2k times · Source

I use wampserver 2.2. When I want to delete all records of a table in phpMyAdmin (select all) it deletes only one record not all records. Why it does not delete all records?

Answer

Sashi Kant picture Sashi Kant · Aug 16, 2013

You have 2 options delete and truncate :

  1. delete from mytable

    This will delete all the content of the table, not reseting the autoincremental id, this process is very slow. If you want to delete specific records append a where clause at the end.

  2. truncate myTable

    This will reset the table i.e. all the auto incremental fields will be reset. Its a DDL and its very fast. You cannot delete any specific record through truncate.