I want to delete all the data from one database but the structure of the table needs to be there. What will be the cleanest way to do that?
Asked
Active
Viewed 305 times
1 Answers
1
- Disable foreign key check.
- Truncate all tables.
- Enable foreign key check back.
Alternatively:
- Backup the database without data (only tables, functions, procedures, triggers).
- Restore into new database.

Akina
- 39,301
- 5
- 14
- 25
-
On backup - `mysqldump --no-data dbname` – danblack Jun 04 '21 at 05:27