For mysql Illegal mix of collations (gbk_chinese_ci, IMPLICIT)

Source: Internet
Author: User

For mysql Illegal mix of collations (gbk_chinese_ci, IMPLICIT) and (gb2312_chinese_ci, I solves common garbled issues, some when the database itself is gbk or gb2312, however, the query results are garbled. This is because mysql still has a channel encoding during the connection process. Therefore, set the connection encoding to gb2312 or UTF-8, for example, jdbc: mysql: // localhost: 3306/ipanel? UseUnicode = true & amp; characterEncoding = UTF-8 hibernate and jdbc parameter settings are not the same, but roughly the same, a lot of similar online information. The most important question is:

Illegal mix of collations (gbk_chinese_ci,IMPLICIT) and (gb2312_chinese_ci,IMPLICIT) for operation '='

 

I believe many people may encounter this problem, which means that the character encoding is different and cannot be compared. That is to say, the encoding in the database is different. Some data is gbk_chinese_ci, and some data is gb2312_chinese_ci, therefore, the core of solving this problem is to unify all the database codes. In command line mode, if the MySQL database has been installed, you can use the following SQL command to view the current character set settings of MySQL:
mysql> SHOW VARIABLES LIKE 'character_set_%'; +--------------------------+----------------------------+ | Variable_name | Value | +--------------------------+----------------------------+ | character_set_client | latin1 | | character_set_connection | latin1 | | character_set_database | latin1 | | character_set_results | latin1 | | character_set_server | latin1 | | character_set_system | utf8 | | character_sets_dir | /usr/share/mysql/charsets/ | +--------------------------+----------------------------+ 7 rows in set (0.00 sec) mysql> SHOW VARIABLES LIKE 'collation_%'; +----------------------+-------------------+ | Variable_name | Value | +----------------------+-------------------+ | collation_connection | latin1_swedish_ci | | collation_database | latin1_swedish_ci | | collation_server | latin1_swedish_ci | +----------------------+-------------------+ 3 rows in set (0.00 sec) 

 

Run the following commands in sequence:
Set character = gb2312; set character_set_connection = gb2312; set character_set_database = gb2312; set character = gb2312; set character = gb2312; set character_set_system = gb2312; -- UTF-8 can also be used here

 

Then execute:
SET collation_server = gb2312_chinese_ciSET collation_database = gb2312_chinese_ciSET collation_connection =gb2312_chinese_ci

 

After the execution, check whether all the databases, tables, and fields in mysql are gb2312. If not, change the fields so that they do not appear.
Illegal mix of collations (gbk_chinese_ci,IMPLICIT) and (gb2312_chinese_ci,IMPLICIT) for operation '='
This error occurs. I have information on the Internet that I want to reinstall it. In fact, it is not necessary to change its encoding.

Related Article

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.