正常的名字都没错误。同事有emoji表情的名字查询炸了。
如下错误
Cause: java.sql.SQLException: Illegal mix of collations (utf8_general_ci,IMPLICIT) and (utf8mb4_unicode_ci,COERCIBLE) for operation 'like'\n; uncategorized SQLException for SQL []; SQL state [HY000]; error code [1267]; Illegal mix of collations (utf8_general_ci,IMPLICIT) and (utf8mb4_unicode_ci,COERCIBLE) for operation 'like'; nested exception is java.sql.SQLException: Illegal mix of collations (utf8_general_ci,IMPLICIT) and (utf8mb4_unicode_ci,COERCIBLE) for operation 'like'",
查询中
AND (ui.nick_name like CONCAT(CONCAT('%', #{keyword}),'%') OR ui.phone like CONCAT(CONCAT('%', #{keyword}),'%') OR ui.person_name like CONCAT(CONCAT('%', #{keyword}),'%'))
nick_name 和person_name 为utf8mb4_unicode_ci格式。而phone 为utf8_general_ci格式。
经过3个小时百度= =,喵咪的。我就傻缺了
phone 列改为utf8mb4_unicode_ci问题解决。
原来utf8mb4_unicode_ci和utf8_general_ci列不能混合查询!!!!