本篇文章给大家谈谈非法混合排序规则(utf8_unicode_ci,IMPLICIT)和(utf8_general_ci,IMPLICIT)用于操作'=',同时本文还将给你拓展Illegalmixof
本篇文章给大家谈谈非法混合排序规则 (utf8_unicode_ci,IMPLICIT) 和 (utf8_general_ci,IMPLICIT) 用于操作 '=',同时本文还将给你拓展Illegal mix of collations (utf8_general_ci,IMPLICIT) and (utf8_unicode_ci,IMPLICIT) for operation 异常、Illegal mix of collations (utf8_unicode_ci,IMPLICI、Illegal mix of collations (utf8_unicode_ci,IMPLICIT) and (gbk_chinese_ci,COERCIB解决思路、mysql join 表 报错 Illegal mix of collations (utf8_general_ci,IMPLICIT) .......等相关知识,希望对各位有所帮助,不要忘了收藏本站喔。
本文目录一览:- 非法混合排序规则 (utf8_unicode_ci,IMPLICIT) 和 (utf8_general_ci,IMPLICIT) 用于操作 '='
- Illegal mix of collations (utf8_general_ci,IMPLICIT) and (utf8_unicode_ci,IMPLICIT) for operation 异常
- Illegal mix of collations (utf8_unicode_ci,IMPLICI
- Illegal mix of collations (utf8_unicode_ci,IMPLICIT) and (gbk_chinese_ci,COERCIB解决思路
- mysql join 表 报错 Illegal mix of collations (utf8_general_ci,IMPLICIT) .......
非法混合排序规则 (utf8_unicode_ci,IMPLICIT) 和 (utf8_general_ci,IMPLICIT) 用于操作 '='
MySql 上的错误信息:
Illegal mix of collations (utf8_unicode_ci,IMPLICIT) and (utf8_general_ci,IMPLICIT) for operation ''=''
我已经浏览了其他几个帖子,但无法解决这个问题。受影响的部分与此类似:
CREATE TABLE users ( userID INT UNSIGNED NOT NULL AUTO_INCREMENT, firstName VARCHAR(24) NOT NULL, lastName VARCHAR(24) NOT NULL, username VARCHAR(24) NOT NULL, password VARCHAR(40) NOT NULL, PRIMARY KEY (userid)) ENGINE = INNODB CHARACTER SET utf8 COLLATE utf8_unicode_ci;CREATE TABLE products ( productID INT UNSIGNED NOT NULL AUTO_INCREMENT, title VARCHAR(104) NOT NULL, picturePath VARCHAR(104) NULL, pictureThumb VARCHAR(104) NULL, creationDate DATE NOT NULL, closeDate DATE NULL, deleteDate DATE NULL, varPath VARCHAR(104) NULL, isPublic TINYINT(1) UNSIGNED NOT NULL DEFAULT ''1'', PRIMARY KEY (productID)) ENGINE = INNODB CHARACTER SET utf8 COLLATE utf8_unicode_ci;CREATE TABLE productUsers ( productID INT UNSIGNED NOT NULL, userID INT UNSIGNED NOT NULL, permission VARCHAR(16) NOT NULL, PRIMARY KEY (productID,userID), FOREIGN KEY (productID) REFERENCES products (productID) ON DELETE RESTRICT ON UPDATE NO ACTION, FOREIGN KEY (userID) REFERENCES users (userID) ON DELETE RESTRICT ON UPDATE NO ACTION) ENGINE = INNODB CHARACTER SET utf8 COLLATE utf8_unicode_ci;
我正在使用的存储过程是这样的:
CREATE PROCEDURE updateProductUsers (IN rUsername VARCHAR(24),IN rProductID INT UNSIGNED,IN rPerm VARCHAR(16))BEGIN UPDATE productUsers INNER JOIN users ON productUsers.userID = users.userID SET productUsers.permission = rPerm WHERE users.username = rUsername AND productUsers.productID = rProductID;END
我正在使用 php 进行测试,但 SQLyog 给出了相同的错误。我还测试过重新创建整个数据库,但效果不佳。
任何帮助都感激不尽。
答案1
小编典典存储过程参数的默认排序规则是utf8_general_ci
并且您不能混合排序规则,因此您有四个选项:
选项 1 :添加COLLATE
到您的输入变量:
SET @rUsername = ‘aname’ COLLATE utf8_unicode_ci; -- COLLATE addedCALL updateProductUsers(@rUsername, @rProductID, @rPerm);
选项 2 :添加COLLATE
到WHERE
子句:
CREATE PROCEDURE updateProductUsers( IN rUsername VARCHAR(24), IN rProductID INT UNSIGNED, IN rPerm VARCHAR(16))BEGIN UPDATE productUsers INNER JOIN users ON productUsers.userID = users.userID SET productUsers.permission = rPerm WHERE users.username = rUsername COLLATE utf8_unicode_ci -- COLLATE added AND productUsers.productID = rProductID;END
选项 3 :将其添加到IN
参数定义中(MySQL 5.7 之前):
CREATE PROCEDURE updateProductUsers( IN rUsername VARCHAR(24) COLLATE utf8_unicode_ci, -- COLLATE added IN rProductID INT UNSIGNED, IN rPerm VARCHAR(16))BEGIN UPDATE productUsers INNER JOIN users ON productUsers.userID = users.userID SET productUsers.permission = rPerm WHERE users.username = rUsername AND productUsers.productID = rProductID;END
选项 4 :更改字段本身:
ALTER TABLE users CHARACTER SET utf8 COLLATE utf8_general_ci;
除非您需要按 Unicode
顺序对数据进行排序,否则我建议您更改所有表以使用utf8_general_ci
排序规则,因为它不需要更改代码,并且会稍微加快排序速度。
更新 :utf8mb4/utf8mb4_unicode_ci 现在是首选的字符集/整理方法。建议不要使用
utf8_general_ci,因为性能提升可以忽略不计。见https://codingdict.com/questions/ 19216
Illegal mix of collations (utf8_general_ci,IMPLICIT) and (utf8_unicode_ci,IMPLICIT) for operation 异常
ALTER TABLE users CONVERT TO CHARACTER SET utf8 COLLATE utf8_general_ci;
Illegal mix of collations (utf8_unicode_ci,IMPLICI
Illegal mix of collations (utf8_unicode_ci,IMPLICIT) and (utf8_general_ci,IMPLICIT) for operation ''='';
当对数据进行操作时,发生如上错误
则因为数据库关联行 编码格式不同造成, utf8_unicode_ci, utf8_general_ci, 更改统一即可
Illegal mix of collations (utf8_unicode_ci,IMPLICIT) and (gbk_chinese_ci,COERCIB解决思路
Illegal mix of collations (utf8_unicode_ci,IMPLICIT) and (gbk_chinese_ci,COERCIB
我的php文件设置的是utf8的,数据库连接过程也都是utf8。数据库用的校对编码及字符编码是utf8_unicode_ci。但是我在执行查询句 $sql = "select * from commodity where commodity_name like ''%$newstr[0]%'' or Sale_Address like ''%$newstr[0]%'' order by id desc ";时出现了Illegal mix of collations (utf8_unicode_ci,IMPLICIT) and (gbk_chinese_ci,COERCIBLE) for operation ''like''的报错。请问谁能猜到怎么回事,该怎么解决?
------解决方案--------------------
肯能输入字符是全角或半角的问题
------解决方案--------------------
$newstr[0]里地内容改变,造成编码不统一,你可以找一种出错的情况,把$sql输出看一下
mysql join 表 报错 Illegal mix of collations (utf8_general_ci,IMPLICIT) .......
在做mysql多表join查询时候发现错误如下:
报错:Illegal mix of collations (utf8_general_ci,IMPLICIT) and (utf8_unicode_ci,IMPLICIT) for operation ''=''
原因:两个表的校验编码不一致
解决:使用squel pro 修改两个表的的编码一直,依然报错,最后运行sql:
alter table ****** convert to character set utf8 collate utf8_unicode_ci
问题解决
今天关于非法混合排序规则 (utf8_unicode_ci,IMPLICIT) 和 (utf8_general_ci,IMPLICIT) 用于操作 '='的讲解已经结束,谢谢您的阅读,如果想了解更多关于Illegal mix of collations (utf8_general_ci,IMPLICIT) and (utf8_unicode_ci,IMPLICIT) for operation 异常、Illegal mix of collations (utf8_unicode_ci,IMPLICI、Illegal mix of collations (utf8_unicode_ci,IMPLICIT) and (gbk_chinese_ci,COERCIB解决思路、mysql join 表 报错 Illegal mix of collations (utf8_general_ci,IMPLICIT) .......的相关知识,请在本站搜索。
本文标签: