查找MySQL数据库中的所有表的名称并清空数据表

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/toume/article/details/80360333

mysql> select CONCAT('truncate TABLE ',table_schema,'.',TABLE_NAME, ';') from INFORMATION_SCHEMA.TABLES where  table_schema in ('dd');

mysql>    truncate TABLE dd.zyx_admin;                               
                truncate TABLE dd.zyx_admin_issued;                        
                truncate TABLE dd.zyx_band;                                
                truncate TABLE dd.zyx_baodansq;                            
                truncate TABLE dd.zyx_baodanzx;                            

                truncate TABLE dd.zyx_buy_stocks; 

数据库(dd)中表就被清空了

猜你喜欢

转载自blog.csdn.net/toume/article/details/80360333
今日推荐