其实根本上是以为在启动mysql前没有修改配置文件:
修改一下mysql配置文件
vim /etc/my.cnf //修改或增加如下内容
[mysql]
default-character-set = utf8
[mysqld]
character_set_server = utf8

如果是已经安装过zabbix,已经开始运行了,可以按照搜索文档配置下,下面贴:

zabbix是一个基于WEB界面的提供分布式系统监视以及网络监视功能的企业级的开源解决方案。 zabbix能监视各种网络参数,保证服务器系统的安全运营;并提供灵活的通知机制以让系统管理员快速定位/解决存在的各种问题。
本文为大家讲解的是Zabbix历史记录处出现问号乱码解决方法,感兴趣的同学参考下.

历史记录处出现问号乱码,如下图

http://img.phperz.com/data/img/20141106/1415270193_5832.png

这与zabbix数据库所使用的字符集有关,解决方法如下:

1.查看当前的默认字符集

mysql> show create database zabbix;
+----------+-------------------------------------------------------------------+
| Database | Create Database |
+----------+-------------------------------------------------------------------+
| zabbix | CREATE DATABASE zabbix /!40100 DEFAULT CHARACTER SET latin1 / |
+----------+-------------------------------------------------------------------+
1 row in set (0.00 sec)
#安装时在导入三个sql文件时,zabbix数据库中创建的表的字符集也是latin1
mysql> show variables like 'character%';
+--------------------------+----------------------------+
| Variable_name | Value |
+--------------------------+----------------------------+
| character_set_client | latin1 |
| character_set_connection | latin1 |
| character_set_database | latin1 |
| character_set_filesystem | binary |
| character_set_results | latin1 |
| character_set_server | latin1 |
| character_set_system | utf8 |
| character_sets_dir | /usr/share/mysql/charsets/ |
+--------------------------+----------------------------+
8 rows in set (0.00 sec)
2.这是由于字符集不是utf8引起的,现在的解决方法有两种:

当当前zabbix数据库中已存在一定的数据的解决办法

1)备份zabbix数据库

[root@zhu1 ~]# mysqldump -uroot -p123456 zabbix > zabbix.sql
2)修改备份文件

[root@zhu1 ~]# sed -i 's/latin1/utf8/g' zabbix.sql
3)删除zabbix数据库

mysql> drop database zabbix;

4)关闭mysql数据库,设置默认字符集

[root@zhu1 ~]# vim /etc/my.cnf
[mysqld]
log-bin
datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock
default-character-set = utf8 #添加该项
5)启动mysql并恢复zabbix数据库

[root@zhu1 ~]# mysql -uroot -p123456 zabbix < zabbix.sql
mysql> show create database zabbix;
+----------+-----------------------------------------------------------------+
| Database | Create Database |
+----------+-----------------------------------------------------------------+
| zabbix | CREATE DATABASE zabbix /!40100 DEFAULT CHARACTER SET utf8 / |
+----------+-----------------------------------------------------------------+
1 row in set (0.00 sec)
mysql> show variables like 'character%';
+--------------------------+----------------------------+
| Variable_name | Value |
+--------------------------+----------------------------+
| character_set_client | latin1 |
| character_set_connection | latin1 |
| character_set_database | utf8 |
| character_set_filesystem | binary |
| character_set_results | latin1 |
| character_set_server | utf8 |
| character_set_system | utf8 |
| character_sets_dir | /usr/share/mysql/charsets/ |
+--------------------------+----------------------------+
8 rows in set (0.00 sec)
6)访问页面

http://img.phperz.com/data/img/20141106/1415270193_2979.png

2.当安装后发现,则可以:

#1.删除zabbix数据库
#2.设置mysql数据库的默认字符集为utf8
#3.重新创建zabbix数据库并导入三个sql文件

总结:

--with-charset=CHARSET
Default character set, use one of:
binary
armscii8 ascii big5 cp1250 cp1251 cp1256 cp1257
cp850 cp852 cp866 cp932 dec8 eucjpms euckr gb2312 gbk geostd8
greek hebrew hp8 keybcs2 koi8r koi8u
latin1 latin2 latin5 latin7 macce macroman
sjis swe7 tis620 ucs2 ujis utf8
--with-extra-charsets=CHARSET,CHARSET,...
Use charsets in addition to default (none, complex,
all, or a list selected from the above sets)
#上面这两个是编译安装mysql事对字符集设置的参数,当不进行设置时默认便是latin1,