mysql存储过程执行时发生Error Code: 1267. Illegal mix of collations (utf8_unicode_ci,IMPLICIT) and (utf8_gener

来源:互联网 发布:网络言情小说作家 编辑:程序博客网 时间:2024/05/21 09:14

很明显这是字符编码冲突导致的问题,在网上找了很多资料,都说是这个问题,然后就所要修改字符编码云云,一堆的修改数据库的编码的方法、修改mysql配置文件,修改数据库表的字符编码、修改数据表字段的字符编码等等方法,有一mysql版本的不同,修改配置文件如my.ini(windows),my.cnf(linux)可能应为方法较就导致不生效甚至出错的问题,其他修改操作(alter表)又麻烦,下面是行之有效的方法from appxp.com:

DELIMITER $$
CREATE DEFINER=`root`@`%` PROCEDURE `getmembermobile`(
in_mobile varchar(30) charset utf8

)
begin

select * from members where mobile = in_mobile COLLATE utf8_unicode_ci;

#或者

select * from members where mobile COLLATE utf8_unicode_ci= in_mobile;

#也就是所 COLLATE utf8_unicode_ci放在等号的哪一边都是可以的

end$$
DELIMITER ;

转载请注明:应用享评 » mysql存储过程执行时发生Error Code: 1267. Illegal mix of collations (utf8_unicode_ci,IMPLICIT) and (utf8_general_ci,IMPLICIT) for operation ‘=’

阅读全文
0 0
原创粉丝点击