Illegal mix of collations (utf8_general_ci,IMPLICIT) and (utf8_unicode_ci,IMPLICIT)--异常3

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/seeker_lqq/article/details/85243000

情景:在迁移数据库部分表后,报了如下字符集错误:

java.sql.SQLException: Illegal mix of collations (utf8_general_ci,IMPLICIT) and (utf8_unicode_ci,IMPLICIT)for operation '='

 分析原因:

utf8_general_ci和utf8_unicode_ci是字符的校对规则比较,原先表使用的是utf8_general_ci,迁移过来成utf8_unicode_ci,所以查询时报错啦。

解决办法:

既然是字符集问题,只需修改一下表的字符集就可以了如下:

alter table sys_user convert to character set utf8 collate utf8_general_ci;

猜你喜欢

转载自blog.csdn.net/seeker_lqq/article/details/85243000