報錯內容:mysql
mysql> insert into person values (1,22,'小明');
ERROR 1366 (HY000): Incorrect string value: '\xE5\xB0\x8F\xE6\x98\x8E' for column 'name' at row 1sql
解決方法:blog
一、查看建表語句string
二、表字符集修改,chartset爲utf8table
alter table person default character set utf8;方法
三、字段字符集修改im
alter table person change name name varchar(255) character set utf8;數據
再次插入數據:img
mysql> insert into person values (1,22,'小明');
Query OK, 1 row affected (0.01 sec)tab
執行成功。