Solve the problem of MySQL Chinese garbled

Source: Internet
Author: User

Encountered Chinese garbled problem, first check the database configuration with the status command, as follows:

The information for the database configuration is displayed.

You can also use show create DATABASE XXX to display the encoding settings at the time you created the databases.

In general, to create a database when you specify the encoding of the database, in Chinese, to be designated as UTF8.

Created in such a way. The default encoding for this database is UTF8. However, you may see the following error at this point:

Incorrect string value: ' \XB1\XB1\XBE\XA9 ' for column ' B ' at;

You will need to check the script format you used to create the database at this point. In the case of Notepad, the default character encoding format is ANSI, so you have to save it again with UTF-8.

At this point the JDBC program should be able to read successfully, but the console will display

Such a mess, this time, you need to typed the following command:

Set character_set_results= ' gb2312 (or GBK) ';

can be displayed normally.

2. Commands for creating a database using scripting

>source file path \ file name. sql

Solve the problem of MySQL Chinese garbled

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.