Run this statement and it will generate all table deletion statements for the specified database. Just take the result query and be sure to replace your database name
SELECT Group_concat(a.sql_truncate, a.sql_truncate, '') AS sql_truncate
FROM (SELECT Concat('truncate table ', table_name, ';') AS sql_truncate
FROM information_schema.tables
WHERE table_schema = '你的数据库名'
AND table_type = 'BASE TABLE') AS a
Run this statement and it will generate all table deletion statements for the specified database. Just take the result
query
and be sure to replace your database nametruncate table table_name
Write stored procedure
Read table name and execute delete in loop
delete from tablename;
Export the table structure and delete the database. Rebuild
drop user username cascade
Cascade delete all data under the user
Don’t use delete, use truncate