Illegal mix of collations (utf8_german2_ci,IMPLICIT) and (utf8_general_ci,IMPLICIT) for operation ‘=

java.sql.SQLException: Illegal mix of collations (utf8_german2_ci,IMPLICIT) and (utf8_general_ci,IMPLICIT) for operation ‘=’
解决方法:
首先:jdbc:mysql://localhost:3306/ipanel?useUnicode=true&characterEncoding=UTF-8 ,这个连接要有字符集编码
最重要的是这个问题:
Illegal mix of collations (utf8_german2_ci,IMPLICIT) and (utf8_general_ci,IMPLICIT) for operation ‘=’
相信有很多人碰到,意思是说字符编码不一样,不能进行比较,也就是说数据库内部的编码都不一样,有的数据是utf8_german2_ci,有的数据是utf8_general_ci,因此解决此问题的核心就是将数据库所有的编码进行统一。

找到数据库中要查询的表,将表中要查询的字段的字符集编码修改为utf8_unicode_ci

猜你喜欢

转载自blog.csdn.net/weixin_42874924/article/details/109817281
今日推荐