Data truncation: data too long for column 'xxxxx' at Row 1

Source: Internet
Author: User

MySQL uses Latin1 by default and does not support Chinese characters, so garbled characters may occur.

Later, I changed Latin1 in my. ini to utf8.

[MySQL]

Default-character-set = utf8

[Mysqld]

Default-character-set = utf8

Data truncation: data too long for column 'xxxxx' at Row 1 appears.

Then I try to modify the varchar size.

Alter table xxx modify XXXXX varchar (30 );

In this way, you can put up to 15 characters.

Still data truncation: data too long for column 'xxxxx' at Row 1

Then I tried to find a solution on the Internet. At least I did not try it. I was too lazy to try it if it was too complicated.

I was wondering if the database was already MySQL's default code Latin1 when it was created, so I should simply change the encoding and recreate the table.

I used GBK to insert Chinese characters normally.

I want to change the default encoding to utf8 and insert it normally.

Enter status to see the data encoding. The database is GBK, and the others are utf8,

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.