Sign up ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Using MySQL CLI, how can I remove all data in a given MySQL database without changing any table's structures?

share|improve this question
This is in Linux by the way. –  superuser May 29 '12 at 17:48
Have you tried delete * from * just off the top of my head. –  Yitzchak May 29 '12 at 17:52

2 Answers 2

up vote 11 down vote accepted

truncate example:

truncate table friends

– will delete all records from the table and also rebuild the table, thus resetting the auto_increment counter.

share|improve this answer
can you truncate an entire database, or do you have to go table by table? –  Thufir Jun 20 '14 at 13:53

It sounds like you want TRUNCATE.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.