SELECT CONCAT('ALTER TABLE `', table_name, '` MODIFY `', column_name, '` ', DATA_TYPE, '(', CHARACTER_MAXIMUM_LENGTH, ') CHARACTER SET UTF8 COLLATE utf8_unicode_ci', (CASE WHEN IS_NULLABLE = 'NO' THEN ' NOT NULL' ELSE '' END), ';') FROM information_schema.COLUMNS WHERE TABLE_SCHEMA = 'database' AND DATA_TYPE = 'text' AND (CHARACTER_SET_NAME != 'utf8' OR COLLATION_NAME != 'utf8_unicode_ci') into outfile "D:/a.txt";
数据库名称 database 和 类型 text 文件导出位置换成自己想要的