1. 设置数据库,表,字段的编码格式及排序规则
在此之前需要删除表的外键,因为在修改表的编码时用到了convert to,如果不用convert to就不需要删除外键了。convert to这个有待本人研究!
>alter table notice drop foreign key FK_notice;
>alter table notice drop foreign key FK_notice_menu;
>alter table roply drop foreign key FK_roply_notice;
>alter table roply drop foreign key FK_roply;
开始修改编码
>ALTER DATABASE zhxq CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
>ALTER TABLE notice CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
>ALTER TABLE notice CHANGEcontent content VARCHAR(2000) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
>ALTER TABLE roply CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
>ALTER TABLE roply CHANGEcontent content VARCHAR(2000) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
再加上外键
>alter table n