问题标签 [mysql-error-1267]

For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.

0 投票
4 回答
34360 浏览

mysql - MYSQL 区分大小写搜索 utf8_bin 字段

我创建了一个表并将排序规则设置为utf8,以便能够向字段添加唯一索引。现在我需要进行不区分大小写的搜索,但是当我使用 collat​​e 关键字执行一些查询时,我得到了:

错误 1253 (42000): COLLATION 'utf8_general_ci' 对 CHARACTER SET 'latin1' 无效

错误 1267 (HY000): 非法混合排序规则 (utf8_bin,IMPLICIT) 和 (latin1_general_ci,EXPLICIT) 用于操作 '='

我对 SQL 很陌生,所以我想知道是否有人可以提供帮助。

0 投票
10 回答
205520 浏览

mysql - 排序规则的非法混合 MySQL 错误

我在处理大量数据时遇到了这个奇怪的错误......

我能做些什么来解决这个问题?我可以以某种方式转义字符串以便不会发生此错误,还是我需要以某种方式更改我的表编码,如果是这样,我应该将其更改为什么?

0 投票
3 回答
9926 浏览

mysql - django character set with MySQL weirdness

I'm seeing

It looks like some of my variables are UTF8 strings

'name': 'p\xc7\x9d\xca\x87\xc9\x9f\xc4\xb1\xc9\xa5s Badge'

Is this a configuration issue? If so, how can i solve it? I'd like to handle everything in Unicode (I think).

0 投票
20 回答
134493 浏览

mysql - MySql 中的非法混合排序规则错误

刚刚从上一个问题中得到了这个答案,它很有效!

但是当我把这个额外的位插入时,它会给出这个错误:

文档 #1267 - 非法混合排序规则 (latin1_swedish_ci,IMPLICIT) 和 (latin1_general_ci,IMPLICIT) 用于操作 '='

表格是:

id, username, rating, month

0 投票
3 回答
3531 浏览

mysql - mysql select concat(charfield, format(doublefield,8)) 给出错误 1267

这在两个方面具有讽刺意味,1)因为 concat(charfield, doublefield) 有效(它不介意要连接的字段之一是数字)和 2)因为 mysql 参考显示了这一点: CONCAT(str1,str2, ...) 作为 CONCAT 和 FORMAT 的原型:“FORMAT(X,D) 将数字 X 格式化为类似 '#,###,###.##' 的格式,四舍五入到 D 小数位,并将结果作为字符串".

绝望中我尝试select concat(symbol, cast(format(closeprice,8) as char))了,它奏效了。所以你可能会想,“为什么这家伙浪费我们的时间,他发现了一些有用的东西”,这是真的。但这对我来说没有意义,所以我想知道是否有人可以清除它?

0 投票
1 回答
5095 浏览

mysql - 跨数据库的 MySQL COLLATE 错误不一致

我有两个物理上独立的 MySQL 数据库,我必须在其上运行一个查询。

该查询有一段 SQL,如下所示:

它在数据库 A 上运行良好,但在数据库 BI 上出现此错误:

如果我删除排序规则,它在数据库 B 上运行良好,但在数据库 AI 上会出现此错误:

是否有可以在两个数据库上运行的查询版本?

或者,我可以在任一数据库上更改配置以使两个地方的查询都满意吗?

更新:

数据库 A 是 5.1.38 版本,数据库 B 是 5.1.34 版本

0 投票
1 回答
4340 浏览

mysql - mysql 非法混合排序规则 (latin1_swedish_ci,IMPLICIT)

当我执行这个查询

我不断收到此错误。

#1267 - 非法混合排序规则 (latin1_swedish_ci,IMPLICIT) 和 (utf8_general_ci,COERCIBLE) 用于操作 '='

提前感谢您的帮助

0 投票
1 回答
511 浏览

mysql - Efficient way to index MySQL table column with utf8 charset

This is one of the tables in database that is entirely in utf8 charset. The problem is here (and I didn't new about it until now) that index for pc_name column will triple times bigger, because MySQL reserves 3 bites for every char. In this case indexes will take much more space.

I cannot make shorter index, because I need this value to be unique. One of the solutions could be set pc_name char(255) CHARSET latin1 NOT NULL, but I dont't know if this is a problem or not. Is this is a good Idea, or are there any solutions that I don't know ?

Update: the pc_name column is validated in application to be valid utf8. And it allows non western characters. But in this case I can just make a trade of and allow only /[_A-Za-z]/ if the case is worth it.

Update 2: I tried to set pc_name to latin1 charset, but now I get exceptions like: Zend_Db_Statement_Exception: SQLSTATE[HY000]: General error: 1267 Illegal mix of collations (latin1_swedish_ci,IMPLICIT) and (utf8_general_ci,COERCIBLE) for operation '='

0 投票
2 回答
12445 浏览

mysql - 在 MySQL 中加入查询

我有两张表:会员和续订

这两个表有一个名为 memberid 的字段,它将两个数据表链接在一起。我正在尝试构建一个查询,该查询将从成员表中提取名字和姓氏,以获取更新表中保存的数据。我尝试使用下面的查询,该查询基于我查找的一些示例。

尝试在 phpMyAdmin 中运行时遇到的错误:

替代文字

0 投票
2 回答
100 浏览

mysql - 连接2个表时mysql中的错误

当我尝试朗姆酒查询时,我发现错误如下

#1267 - Illegal mix of collations (latin1_general_ci,IMPLICIT) and (latin1_swedish_ci,IMPLICIT) for operation '='

我的表结构是

和其他表是