MySQL illegal mix of collations error

Source: Internet
Author: User
Keywords Php mysql ubuntu
There was a problem with PHP even with MySQL:
PHP Fatal error:uncaught exception ' pdoexception ' with message ' sqlstate[hy000]: General error:1267 illegal mix of Colla tions (utf8_general_ci,implicit) and (utf8_unicode_ci,implicit) for operation ' = '

MySQL Status:

  show variables like ' colla% '; +----------------------+----------------- +| variable_name | Value |+----------------------+-----------------+| collation_connection | Utf8_general_ci | | Collation_database | Utf8_unicode_ci | | Collation_server | Utf8_unicode_ci |show variables like ' char% '; +--------------------------+----------------------------+| variable_name | Value |+--------------------------+----------------------------+| character_set_client | UTF8 | | character_set_connection | UTF8 | | Character_set_database | UTF8 | | Character_set_filesystem | binary | | Character_set_results | UTF8 | | Character_set_server | UTF8 | | Character_set_system | UTF8 | | Character_sets_dir | /usr/share/mysql/charsets/|  

Related stored procedure Code:

CREATE PROCEDURE `proc_str`(in strrr varchar(30) ,in useriid varchar(30))begindeclare i int;SET i=1;update imgupdate.bullentin set BoardPosition=replace(BoardPosition,concat(',',substring_index(strrr,',',1),','),',') where GroupUsers=useriid ;//replace过程出错while(select (length(strrr) -length(substring_index(strrr,',',i))) )>0 doset i=i+1;update imgupdate.bullentin set BoardPosition=replace(BoardPosition,concat(',',(substring(substring_index(strrr,',',i),length(substring_index(strrr,',',i-1))+2)),','),',') where GroupUsers=useriid ;end while;select 1;end;

Reply content:

There was a problem with PHP even with MySQL:
PHP Fatal error:uncaught exception ' pdoexception ' with message ' sqlstate[hy000]: General error:1267 illegal mix of Colla tions (utf8_general_ci,implicit) and (utf8_unicode_ci,implicit) for operation ' = '

MySQL Status:

  show variables like ' colla% '; +----------------------+----------------- +| variable_name | Value |+----------------------+-----------------+| collation_connection | Utf8_general_ci | | Collation_database | Utf8_unicode_ci | | Collation_server | Utf8_unicode_ci |show variables like ' char% '; +--------------------------+----------------------------+| variable_name | Value |+--------------------------+----------------------------+| character_set_client | UTF8 | | character_set_connection | UTF8 | | Character_set_database | UTF8 | | Character_set_filesystem | binary | | Character_set_results | UTF8 | | Character_set_server | UTF8 | | Character_set_system | UTF8 | | Character_sets_dir | /usr/share/mysql/charsets/|  

Related stored procedure Code:

CREATE PROCEDURE `proc_str`(in strrr varchar(30) ,in useriid varchar(30))begindeclare i int;SET i=1;update imgupdate.bullentin set BoardPosition=replace(BoardPosition,concat(',',substring_index(strrr,',',1),','),',') where GroupUsers=useriid ;//replace过程出错while(select (length(strrr) -length(substring_index(strrr,',',i))) )>0 doset i=i+1;update imgupdate.bullentin set BoardPosition=replace(BoardPosition,concat(',',(substring(substring_index(strrr,',',i),length(substring_index(strrr,',',i-1))+2)),','),',') where GroupUsers=useriid ;end while;select 1;end;

charset= ' UTF8 ' in Connect

  • Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.