OpenFire connection to MySQL database character set problem resolution

Source: Internet
Author: User

OpenFire default configuration after connecting to MySQL database, Chinese garbled.

Workaround:

MySQL character set to UTF8


+ Set Global character sets


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 the current connection character set


SET @ @session. character_set_client = UTF8;
SET @ @session. character_set_results = UTF8;
SET @ @session. character_set_connection = UTF8;


Or:


SET names UTF8;


Modify the database connection string for OpenFire, and if it is a new openfire, set the following connection string in the database settings of the management side:


jdbc:mysql://[database]:3306/[databasename]?rewritebatchedstatements=true&useunicode=true& Characterencoding=utf8


If OpenFire is already set up, modify the connection string in ServerURL in the configuration file Conf/openfire.xml:


<database>
<defaultProvider>
<driver>com.mysql.jdbc.Driver</driver>
<serverurl>jdbc:mysql://[databaseip]:3306/[databasename]?rewritebatchedstatement
S=true&amp;useunicode=true&amp;characterencoding=utf8</serverurl>
</defaultProvider>
</database>



OpenFire connection to MySQL database character set problem resolution

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.