Delete data from all tables in MYSQL

前端 未结 16 1772
自闭症患者
自闭症患者 2020-12-13 09:17

I have 100 tables, 40,000 rows in each table. I want to go into MySQL and delete all rows from all tables.

...in 1 statement, if p

16条回答
  •  旧时难觅i
    2020-12-13 10:04

    It's possible, but it has side-effects you might not like:

    drop database ;
    

    It means the tables' structures are deleted, as well as the indexes, stored procedures, etc., etc.

    The only other way would be to write a stored procedure which loops somehow with

    truncate table ;
    

提交回复
热议问题