select CONCAT('truncate table ',table_schema,'.',TABLE_NAME, ';') from INFORMATION_SCHEMA.TABLES where table_schema in ('数据库1','数据库2');
或者
select CONCAT('truncate table ',TABLE_NAME, ';') from INFORMATION_SCHEMA.TABLES where table_schema in ('数据库1','数据库2');
mysql -N -s information_schema -e "SELECT CONCAT('TRUNCATE TABLE ',TABLE_NAME,';') FROM TABLES WHERE TABLE_SCHEMA=数据库'"