---
title: "Mysql 插入中文错误：Incorrect string value: '\\xE5\\x88\\x9B\\xE5\\xBB\\xBA...' for column"
author: "HUS2013"
date: "2015-07-08T22:25:42Z"
tags: ["MySQL", "中文乱码"]
categories: ["数据库"]
slug: "mysql-incorrect-string-value-xe5-x88-x9b-xe5-xbb-xba-for-column"
draft: false
lastmod: "2015-07-08T22:25:42Z"
id: 2225492
url: "https://hus2013.iteye.com/blog/2225492"
---

转自 : http://www.th7.cn/db/mysql/201411/81407.shtml

 

出现这个错误的原因是，数据库的编码格式为latin1 而我要将utf8的中文插入到数据库中。

一开始修改  修改数据库的编码

```
alter table score default character set utf8;
```

但是插入中文依然出现错误。

然后通过查看数据表编码

```
show create table score;
```

发现如下所示

 

注意  course 的编码仍然为 latin1 ，虽然此时表的编码已经是 utf8 , 但是不知道为什么 列的编码没有更改过来

下面就是更改列的编码即可

```
 alter table score change score score varchar(50) character utf8;
```

修改成功之后

结果是列的编码已经修改成功

接下来插入中文就没有问题了