MySQL cannot insert Chinese characters to resolve

Source: Internet
Author: User

1. Based on the maintenance of the angle, although latin1 is not a problem, but still try to switch to UTF8 or GB series

2. When garbled:

SHOW VARIABLES like ' character% '
SHOW VARIABLES like ' collation_% ';

Set character_set_xxx = UTF8

Modify the Encoding

A, to ensure that the data stored in the database and database encoding consistent, that is, the data encoding and character_set_database consistent;
b, to ensure that the character set of communications with the database character set consistent, that is character_set_client, character_set_connection and character_set_database consistent;
C, to ensure that the return of select is consistent with the coding of the program, that is, the character_set_results is consistent with the program coding;
D, to ensure that the program code and browser, terminal code consistent

3. To be simple, set each character set to a consistent, write to the MySQL configuration file, each time with the client set the character set (set names ' xxx '), write and read remember to ensure that the byte stream encoding is OK

MySQL cannot insert Chinese characters to resolve

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.