-- 修改数据库排序规则
alter database 数据库名称 character set=utf8mb4 collate=utf8mb4_general_ci;
-- 执行sql得到修改表的排序规则命令
SELECT
concat( "alter table `", TABLE_SCHEMA,'`.',TABLE_NAME, " CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci;" ) AS target_tables
FROM
information_schema.TABLES
WHERE
table_schema = "数据库名称"
AND table_type = "BASE TABLE";
执行第二条命令
然后直接执行就行了
下班回家