Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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
1  
Have you tried delete * from * just off the top of my head. – Yitzchak May 29 '12 at 17:52
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
1  

It sounds like you want TRUNCATE.

http://dev.mysql.com/doc/refman/5.0/en/truncate-table.html

share|improve this answer

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .