MySQL字符集不一致的解决办法总结

用SHOW   CREATE   TABLE   table_name;可以看出具体的字符集设置。 
错误代码: 1267
Illegal mix of collations (utf8mb4_unicode_ci,IMPLICIT) and (utf8mb4_general_ci,IMPLICIT) for operation '='

解决方法:

select * from user where mobile = in_mobile COLLATE utf8_unicode_ci;

#或者

select * from user where mobile COLLATE utf8_unicode_ci= in_mobile;

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

https://blog.csdn.net/davidiao/article/details/80161939

猜你喜欢

转载自www.cnblogs.com/shy1766IT/p/10682896.html