错误号码:1267非法混合排序(latin1_swedish_ci,IMPLICIT)和(utf8_general_ci,COERCIBLE)操作' ='

时间:2015-06-30 06:11:07

标签: mysql utf-8 collation

表名:xyz     类型:InnoDB     归类:latin1_swedish_ci

字段

---------------------------------------------------------------------------
            Field        | Type        | Collation         | Extra        |
---------------------------------------------------------------------------
            id           | int         |                   | Primary Key  |
---------------------------------------------------------------------------
            name         | varchar     | latin1_swedish_ci |              |
---------------------------------------------------------------------------

这是我的数据库表。当我试图为这样的名称插入一个值

If T₀, T₁, T₂ . . . . . . . Tn represent the terms in the expansion of (x + a)n, then (T₀ - T₂ + T₄ - . . )2 + (T₁ - T₃ + T₅ - . . )2 

我收到以下错误:

Error Number: 1267Illegal mix of collations (latin1_swedish_ci,IMPLICIT) and (utf8_general_ci,COERCIBLE) for operation '='

我做了一个快速的研究和发现许多S.O问题和文章提供了解决方案,但没有一个能为我工作。

我的参考:Visit

我尝试使用如下查询更改表的排序规则:

ALTER TABLE xyz CHARACTER SET utf8 COLLATE utf8_general_ci;

但错误仍然存​​在。

我也尝试使用utf8_unicode_ci,但这也没有用。

原因?解决方案?格拉西亚斯。

1 个答案:

答案 0 :(得分:6)

感谢@vhu将此标记为重复。

回答礼貌:@Marvin W

我修改了我的表,这解决了我的问题。

ALTER TABLE xyz CONVERT TO CHARACTER SET utf8;