Resolved that mysql could not insert Chinese Incorrect string value

  • 2020-05-07 20:34:35
  • OfStack

Option default charaset - set = utf8;

Then create a data table create table a_table(b varchar(255) not null);

insert into a_table values (' Beijing ');

This time is inserted in Chinese, the system will report an error: Incorrect string value: '\xB1\xB1\xBE\xA9' for column 'b' at;

This cannot be inserted into Chinese. If the statement is written in a text file for batch operation, this error will also occur if the saved encoding is the default.

Solution: save the text file as utf-8 to execute correctly.

Related articles: