Saj*_*v C 4 mysql collation utf-8
表名:xyz类型:InnoDB排序规则:latin1_swedish_ci
领域:
---------------------------------------------------------------------------
Field | Type | Collation | Extra |
---------------------------------------------------------------------------
id | int | | Primary Key |
---------------------------------------------------------------------------
name | varchar | latin1_swedish_ci | |
---------------------------------------------------------------------------
Run Code Online (Sandbox Code Playgroud)
这是我的数据库表.当我试图为这样的名称插入一个值
If T?, T?, T? . . . . . . . Tn represent the terms in the expansion of (x + a)n, then (T? - T? + T? - . . )2 + (T? - T? + T? - . . )2
Run Code Online (Sandbox Code Playgroud)
我收到以下错误:
Error Number: 1267Illegal mix of collations (latin1_swedish_ci,IMPLICIT) and (utf8_general_ci,COERCIBLE) for operation '='
Run Code Online (Sandbox Code Playgroud)
我做了一个快速的研究,发现了很多提出解决方案的SO问题和文章,但没有一个能为我工作.
我的参考:访问
我尝试使用如下查询更改表的排序规则:
ALTER TABLE xyz CHARACTER SET utf8 COLLATE utf8_general_ci;
Run Code Online (Sandbox Code Playgroud)
但错误仍然存在.
我也试过使用,utf8_unicode_ci但也没用.
原因是什么?解决方案?格拉西亚斯.
感谢@vhu将此标记为重复.
回答礼貌:@Marvin W
我修改了我的表,这解决了我的问题.
ALTER TABLE xyz CONVERT TO CHARACTER SET utf8;
Run Code Online (Sandbox Code Playgroud)