标签:
openfire默认配置连接mysql数据库后,中文出现乱码。
解决办法:
mysql字符集设置为utf8
+ 设置全局的字符集
SET @@global.character_set_client = utf8;
SET @@global.character_set_results = utf8;
SET @@global.character_set_connection = utf8;
SET @@global.character_set_server = utf8;
+ 设置当前连接字符集
SET @@session.character_set_client = utf8;
SET @@session.character_set_results = utf8;
SET @@session.character_set_connection = utf8;
或者:
SET names utf8;
修改openfire的数据库连接字符串,如果是新建的openfire,在管理端的数据库设置中设置下面连接字符串:
jdbc:mysql://[Database]:3306/[DatabaseName]?rewriteBatchedStatements=true&useUnicode=true&characterEncoding=utf8
如果openfire已经搭建好了,在配置文件 conf/openfire.xml 中修改 serverURL 中的连接字符串 :
<database>
<defaultProvider>
<driver>com.mysql.jdbc.Driver</driver>
<serverURL>jdbc:mysql://[DataBaseIP]:3306/[DataBaseName]?rewriteBatchedStatement
s=true&useUnicode=true&characterEncoding=utf8</serverURL>
</defaultProvider>
</database>
标签:
原文地址:http://blog.csdn.net/kl222/article/details/43083457