"Error 1366 (HY000): incorrect string value: '\ XE5 \ XBC \ xa0 \ xe4 \ xb8 \ x89' for column 'name“

chnhbhndchngn 2022-02-13 08:24:55 阅读数:835

error hy000 hy incorrect string

stay linux The system is sending mysql An error will be reported when inserting Chinese data into

ERROR 1366 (HY000): Incorrect string value: '\xE5\xBC\xA0\xE4\xB8\x89' for column 'name' at row 1

This is mainly caused by coding , Let's just modify the code

The first method :

Only modify the encoding format of this table :

> alter table user convert to charset utf8;

Here's the picture :

The second method :

modify mysql Default encoding format

Let's first check the default encoding format of the database :

> show  variables  like '%char%';

You can see that the default is Latin format (latin1)

copyright:author[chnhbhndchngn],Please bring the original link to reprint, thank you. https://en.javamana.com/2022/02/202202130824533207.html