Illegal mix of collations (utf8_unicode_ci,IMPLICIT) and (utf8_general_ci,IMPLICIT) for operation '=
2017-12-18 18:50
429 查看
今天在 mysql 中进行连表查询时提示:
错误代码: 1267
Illegal mix of collations (utf8_general_ci,IMPLICIT) and (utf8_unicode_ci,IMPLICIT) for operation ‘=’
创建数据库时选择的 COLLATION 是用在排序,大小比较上。一个字符集有一个或多种 collation,并且以_ci(大小写不敏感)、_cs(大小写敏感)或 _bin(二元)结束。在做比较时,应该确保两个表的字符排序相同。一般建表的时候不指定,可以走默认的,全是默认的就没什么问题了。
解决方法:
只要修改一下表的字符集就可以了,如下:
ALTER TABLE problem_order CONVERT TO CHARACTER SET utf8 COLLATE utf8_general_ci;
1.列出MYSQL支持的所有字符集:
SHOW CHARACTER SET;
2.当前MYSQL服务器字符集设置
SHOW VARIABLES LIKE ‘character_set_%’;
3.当前MYSQL服务器字符集校验设置
SHOW VARIABLES LIKE ‘collation_%’;
4.显示某数据库字符集设置
show create database 数据库名;
5.显示某数据表字符集设置
show create table 表名;
6.修改数据库字符集
alter database 数据库名default character set ‘utf8’;
7.修改数据表字符集
alter table 表名default character set ‘utf8’;
8.建库时指定字符集
create database 数据库名character set gbk collate gbk_chinese_ci;
9.建表时指定字符集
CREATE TABLE
) TYPE = MYISAM CHARACTER SET gbk COLLATE gbk_chinese_ci;
错误代码: 1267
Illegal mix of collations (utf8_general_ci,IMPLICIT) and (utf8_unicode_ci,IMPLICIT) for operation ‘=’
创建数据库时选择的 COLLATION 是用在排序,大小比较上。一个字符集有一个或多种 collation,并且以_ci(大小写不敏感)、_cs(大小写敏感)或 _bin(二元)结束。在做比较时,应该确保两个表的字符排序相同。一般建表的时候不指定,可以走默认的,全是默认的就没什么问题了。
解决方法:
只要修改一下表的字符集就可以了,如下:
ALTER TABLE problem_order CONVERT TO CHARACTER SET utf8 COLLATE utf8_general_ci;
1.列出MYSQL支持的所有字符集:
SHOW CHARACTER SET;
2.当前MYSQL服务器字符集设置
SHOW VARIABLES LIKE ‘character_set_%’;
3.当前MYSQL服务器字符集校验设置
SHOW VARIABLES LIKE ‘collation_%’;
4.显示某数据库字符集设置
show create database 数据库名;
5.显示某数据表字符集设置
show create table 表名;
6.修改数据库字符集
alter database 数据库名default character set ‘utf8’;
7.修改数据表字符集
alter table 表名default character set ‘utf8’;
8.建库时指定字符集
create database 数据库名character set gbk collate gbk_chinese_ci;
9.建表时指定字符集
CREATE TABLE
mysqlcode(
idTINYINT( 255 ) UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY ,
contentVARCHAR( 255 ) NOT NULL
) TYPE = MYISAM CHARACTER SET gbk COLLATE gbk_chinese_ci;
相关文章推荐
- Illegal mix of collations (utf8_unicode_ci,IMPLICIT) and (utf8_general_ci,IMPLICIT) for operation '=
- Illegal mix of collations (utf8_unicode_ci,IMPLICIT) and (utf8_general_ci,IMPLICIT) for operation '=
- Illegal mix of collations (utf8_unicode_ci,IMPLICIT) and (utf8_general_ci,IMPLICIT) for operation '=
- [Err]1267 - Illegal mix of collations(utf8_general_ci,IMPLICIT) and (utf8_unicode_ci,IMPLICIT) for operation ‘=’
- Illegal mix of collations (utf8_unicode_ci,IMPLICIT) and (utf8_general_ci,IMPLICIT) for operation '=
- Illegal mix of collations (utf8_unicode_ci,IMPLICIT) and (utf8_general_ci,IMPLICIT) for operation '
- Illegal mix of collations (utf8_unicode_ci,IMPLICIT) and (utf8_general_ci,IMPLICIT) for operation '=
- Illegal mix of collations (utf8_unicode_ci,IMPLICIT) and (utf8_general_ci,IMPLICIT) for operation '=
- Illegal mix of collations (utf8_unicode_ci,IMPLICIT) and (utf8_general_ci,IMPLICIT) for operation '=
- Illegal mix of collations (utf8_unicode_ci,IMPLICIT) and (utf8_general_ci,IMPLICIT) for operation '=
- Illegal mix of collations (utf8_unicode_ci,IMPLICIT) and (utf8_general_ci,IMPLICIT) for operation '=
- Illegal mix of collations (utf8_unicode_ci,IMPLICIT) and (utf8_general_ci,IMPLICIT) for operation '=
- Illegal mix of collations (gbk_chinese_ci,IMPLICIT) and (utf8_general_ci,COERCIBLE) for operation '='
- mysql: Illegal mix of collations (utf8_unicode_ci,IMPLICIT) and (utf8_general_ci,IMPLICIT) for operation '= 的解决
- 处理【Illegal mix of collations (utf8_general_ci,IMPLICIT) and (utf8_unicode_ci,IMPLICIT) for operatio】
- c#程序连接mysql,报"Illegal mix of collations (utf8_general_ci,IMPLICIT) and (utf8_unicode_ci,IMPLICIT) for operation '='"的解决方案
- 数据库 BUG:Illegal mix of collations (utf8_unicode_ci,IMPLICIT) and (utf8_general_ci,IMPLICIT) for operation '=
- Illegal mix of collations (utf8_general_ci,IMPLICIT) and (utf8_unicode_ci,IMPLIC神级解决方案
- Illegal mix of collations (latin1_swedish_ci,IMPLICIT) and (utf8_general_ci,COERCIBLE) for operation
- Illegal mix of collations (gbk_chinese_ci,IMPLICIT) and (utf8_unicode_ci,IMPLICIT) for operation '='