Mysql Chinese insertion error: Incorrect string value: & #39; \ xE7 \ xA8 \ x8B \ xE5 \ xBA \ x8F... & #39; for column & #39; course & #39; at row 1, xe5x8cx97

Source: Internet
Author: User
Tags mysql insert

[Switch] Mysql insert Chinese error: Incorrect string value: '\ xE7 \ xA8 \ x8B \ xE5 \ xBA \ x8F... for column 'Course' at row 1, what is xe5x8cx97?

Incorrect string value: '\ xE7 \ xA8 \ x8B \ xE5 \ xBA \ x8F...' for column 'Course' at row 1

The cause of this error is that the encoding format of the database is latin1, And I want to insert utf8 Chinese into the database.

Modify the database encoding at the beginning

[SQL]View plain copy
  1. Alter table score default character set utf8;
However, an error still occurred while inserting Chinese characters.

 

Then, you can view the data table Encoding

 

[SQL]View plain copy
  1. Show create table score;

As shown below:

Note that the course encoding is still latin1. Although the table encoding is utf8, I don't know why the column encoding hasn't changed.

The following is how to change the column encoding.

 

[SQL]View plain copy
  1. Alter table score change score varchar (50) character utf8;

After modification is successful

 

The result is that the column encoding has been modified successfully.

 

Next, insert utf8 to the Chinese language.

Http://blog.csdn.net/ch717828/article/details/41357431

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.