5
1
Using MySQL CLI, how can I remove all data in a given MySQL database without changing any table's structures?
5
1
Using MySQL CLI, how can I remove all data in a given MySQL database without changing any table's structures?
11
truncate
example:
truncate table friends
– will delete all records from the table and also rebuild the table, thus resetting the auto_increment counter.
can you truncate an entire database, or do you have to go table by table? – Thufir – 2014-06-20T13:53:36.880
1http://stackoverflow.com/questions/1912813/truncate-all-tables-in-a-mysql-database-in-one-command – Logman – 2014-06-20T15:38:43.790
That works for a single table, not all – Mawg says reinstate Monica – 2017-01-15T10:43:58.757
11
It sounds like you want TRUNCATE.
That works for a single table, not all – Mawg says reinstate Monica – 2017-01-15T10:44:04.443
That works for a single table, not all – Mawg says reinstate Monica – 2017-01-15T10:43:31.840
This is in Linux by the way. – superuser – 2012-05-29T17:48:20.927
1Have you tried
delete * from *
just off the top of my head. – Yitzchak – 2012-05-29T17:52:05.683