Can be used TRUNCATE Use the `TRUNCATE` command to clear a table; if you need to clear the entire database, you must truncate each table individually.
Here is an example SQL statement for clearing the entire database:
SET foreign_key_checks = 0;
SELECT CONCAT('TRUNCATE TABLE `', table_name, '`;')
FROM information_schema.tables
WHERE table_schema = 'database_name';
SET foreign_key_checks = 1;among database_name This is the name of the database that needs to be cleared; you can replace it with the actual database name. This statement will generate a series of operations. TRUNCATE TABLE This statement is used to truncate each table. Note that you should disable foreign key constraints before truncating the tables to prevent errors from occurring during the truncation process. After truncation is complete, re-enable the foreign key constraints.