当我在zabbix中插入一个包含中文的条目时,浏览器显示:
Error cannot update item
Error in query [SELECT i.key_,h.host FROM items i,hosts h WHERE i.hostid=h.hostid AND ((i.hostid=10085 AND i.key_='logrt['"/home/test/event.*.log'",'"失败'",'"GBK'",,]')) AND i.itemid!='23439' LIMIT 1 OFFSET 0] [Illegal mix of collations (latin1_swedish_ci,IMPLICIT) and (utf8_general_ci,COERCIBLE) for operation '=']
mysql_fetch_assoc() expects parameter 1 to be resource, boolean given
[include/db.inc.php:572] mysql_free_result() expects parameter 1 to be resource, boolean given
[include/db.inc.php:573]
我认为它失败了,因为zabbix不能接受除了UTF-8以外的其他编码,但我不知道如何改变它。由于
好的,我找到问题了。当我创建zabbix数据库时,我似乎使用了默认的字符集,它是latin1_swedish_ci,但实际上它应该是utf8。因此,我用以下sql重新创建数据库:
create database zabbix character set utf8
那么一切都很好!