Mysql更新插入编码问题

22. August 2019 DataBase 0

数据插入更新,尤其是遇到遗留系统时,编码不一致可能会报错,如Illegal mix of collations (utf8mb4_unicode_ci,IMPLICIT) and (utf8mb4_general_ci,IMPLICIT) for operation ‘=’

解决方式代码如下:

UPDATE college_video a,

colleges b 

SET a.college_id = b.id 

WHERE

a.college_name_cn COLLATE utf8mb4_unicode_ci = b.name_cn

Leave a Reply

Your email address will not be published. Required fields are marked *