一、单个表修改
alter table 表名 convert to character set utf8mb4 collate utf8mb4_general_ci; #表内varchar字符集也会变化
二、查询出所需要修改的所有表
SELECT
CONCAT( 'alter table ', table_schema, '.', TABLE_NAME, ' convert to character set utf8mb4 collate utf8mb4_general_ci;' )
FROM
INFORMATION_SCHEMA.TABLES
WHERE
table_schema IN ( '数据库1', '数据库2' );