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,