【mysql】【转发】[Err]1267 - Illegal mix of collations(utf8_general_ci,IMPLICIT) and (utf8_unicode_ci,I

时间:2023-01-06 11:49:26

[Err]1267 - Illegal mix of collations(utf8_general_ci,IMPLICIT) and (utf8_unicode_ci,IMPLICIT) for operation ‘=

今天想做个插入操作,就报这个。。特意记录下来
INSERT INTO keywordtemp (keywordid,keyword ) SELECT concat(substring(UUID(),1,8),substring(UUID(),10,4),substring(UUID(),15,4),substring(uuid(),20,4),substring(uuid(),25,12)) ,name 

FROM   t1 WHERE name NOT IN (SELECT keyword FROM temp)

其实解决是他得排序 
先将两个数据表的编码统一,如果 t1  的编码为utf8_general_ci,那么将这个表的编码修改下执行以下语句
ALTER TABLE temp CONVERT TO CHARACTER SET utf8 collate utf8_unicode_ci
以上就解决了,,你show create table 两个表看如果一样了,就好了。