[ZBX-4259] potential mysql upgrade patch issue with collations Created: 2011 Oct 20  Updated: 2017 May 30  Resolved: 2012 Aug 27

Status: Closed
Project: ZABBIX BUGS AND ISSUES
Component/s: Installation (I)
Affects Version/s: 1.9.6 (beta)
Fix Version/s: None

Type: Incident report Priority: Trivial
Reporter: richlv Assignee: Unassigned
Resolution: Won't fix Votes: 0
Labels: mysql, upgrade
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

mysql 5.1.46


Issue Links:
Duplicate
is duplicated by ZBX-5056 Database upgrade fails on 2.0.0 Closed

 Description   

just documenting here for now.

upgrading db might error out like this :

ERROR 1267 (HY000) at line 779: Illegal mix of collations (utf8_unicode_ci,IMPLICIT) and (utf8_general_ci,IMPLICIT) for operation '='

that happens even if global, connection and database collations are set to 'general' one - somehow, somewhere 'unicode' still appears.

a similar case was reported as http://bugs.mysql.com/bug.php?id=24690 - but that seemed to cover exactly the opposite...

so far the only solution i've found is to modify collation for the database (which might not be always possible/desirable) :
alter database zabbix collate utf8_unicode_ci;



 Comments   
Comment by Siert Z. [ 2012 Feb 28 ]

I am having the same issue when upgrading from 1.8.9 to 1.9.9. The solution found does not work in my situation.

5482:20120228:113543.823 [Z3005] query failed: [1267] Illegal mix of collations (utf8_general_ci,IMPLICIT) and (utf8_unicode_ci,IMPLICIT) for operation '=' [select distinct h.hostid,h.proxy_hostid from hosts h,interface i,dservices ds where h.hostid=i.hostid and i.ip=ds.ip and ds.dhostid=277 and h.hostid between 0 and 99999999999999 order by h.hostid]
5482:20120228:113629.877 [Z3005] query failed: [1267] Illegal mix of collations (utf8_general_ci,IMPLICIT) and (utf8_unicode_ci,IMPLICIT) for operation '=' [select distinct h.hostid,h.proxy_hostid from hosts h,interface i,dservices ds where h.hostid=i.hostid and i.ip=ds.ip and ds.dhostid=278 and h.hostid between 0 and 99999999999999 order by h.hostid]
5482:20120228:113630.017 [Z3005] query failed: [1267] Illegal mix of collations (utf8_general_ci,IMPLICIT) and (utf8_unicode_ci,IMPLICIT) for operation '=' [select distinct h.hostid,h.proxy_hostid from hosts h,interface i,dservices ds where h.hostid=i.hostid and i.ip=ds.ip and ds.dhostid=498 and h.hostid between 0 and 99999999999999 order by h.hostid]
5482:20120228:113630.116 [Z3005] query failed: [1267] Illegal mix of collations (utf8_general_ci,IMPLICIT) and (utf8_unicode_ci,IMPLICIT) for operation '=' [select distinct h.hostid,h.proxy_hostid from hosts h,interface i,dservices ds where h.hostid=i.hostid and i.ip=ds.ip and ds.dhostid=499 and h.hostid between 0 and 99999999999999 order by h.hostid]
5482:20120228:113630.233 [Z3005] query failed: [1267] Illegal mix of collations (utf8_general_ci,IMPLICIT) and (utf8_unicode_ci,IMPLICIT) for operation '=' [select distinct h.hostid,h.proxy_hostid from hosts h,interface i,dservices ds where h.hostid=i.hostid and i.ip=ds.ip and ds.dhostid=500 and h.hostid between 0 and 99999999999999 order by h.hostid]

If you need any information, don't hestitate to request...

Comment by Siert Z. [ 2012 Feb 28 ]

Correcting the query executed by the Zabbix server from:

mysql> select distinct h.hostid,h.proxy_hostid from hosts h,interface i,dservices ds where h.hostid=i.hostid and i.ip=ds.ip and ds.dhostid=390 and h.hostid between 0 and 99999999999999 order by h.hostid;
ERROR 1267 (HY000): Illegal mix of collations (utf8_general_ci,IMPLICIT) and (utf8_unicode_ci,IMPLICIT) for operation '='

To:

mysql> select distinct h.hostid,h.proxy_hostid from hosts h,interface i,dservices ds where h.hostid="i.hostid" and i.ip="ds.ip" and ds.dhostid="390" and h.hostid between 0 and 99999999999999 order by h.hostid;
Empty set (0.00 sec)

Returns nothing, but seem to work. Perhaps this needs changing somewhere in de code?

Comment by Siert Z. [ 2012 Feb 28 ]

This also happens in 'Administration/Discovery' (discovery.php)

Error in query [SELECT DISTINCT h.hostid,h.name,h.status,ds.dserviceid FROM hosts h,dservices ds,interface i WHERE 1=0 AND ds.ip=i.ip AND h.hostid=i.hostid AND h.hostid BETWEEN 000000000000000 AND 099999999999999 AND h.status IN (0,1) ORDER BY h.status] [Illegal mix of collations (utf8_unicode_ci,IMPLICIT) and (utf8_general_ci,IMPLICIT) for operation '=']
mysql_fetch_assoc() expects parameter 1 to be resource, boolean given [include/db.inc.php:560]
mysql_free_result() expects parameter 1 to be resource, boolean given [include/db.inc.php:561]

Comment by Siert Z. [ 2012 Feb 28 ]

If the character set and collation's are all the same the issue is fixed.

This is not caused by the upgrade SQL scripts, but caused by configuration differences in old and new setups.
So, make sure the existing and default charset/collation in old and new environments are exactly the same.

I think this call can be closed.

Comment by richlv [ 2012 Feb 29 ]

the last issue you listed is coming from the frontend, so that's indeed a different thing. the original problem with the patch seems to remain

Comment by richlv [ 2012 Aug 27 ]

this didn't affect too many users, so closing it

Generated at Wed May 07 06:07:48 EEST 2025 using Jira 9.12.4#9120004-sha1:625303b708afdb767e17cb2838290c41888e9ff0.