mysql提示:Illegal mix of collations for operation ‘UNION’

http://www.111cn.net/database/mysql/56096.htm

show variables like "%char%";

show variables like "%coll%";

然后将数据库中所有编码方式改为统一:

 代码如下 复制代码


mysql> set character_set_database=utf8;

Query OK, 0 rows affected (0.00 sec)

mysql> set collation_database= utf8_general_ci

重新查看字符集及数据表字段编码字符是否一致:


总结

utf8_bin
utf8_general_ci
utf8_unicode_ci

utf8_bin 与 utf8_general_ci 可以

utf8_bin 与 utf8_unicode_ci 可以

utf8_general_ci 与 utf8_unicode_ci 不可以

原文地址:https://www.cnblogs.com/google4y/p/3687901.html