For mysqlIllegalmixofcollations (gbk_chinese_ci, IMPLICIT) and (gb2312_chinese_ci, I solves bitsCN.com
Solutions for mysql Illegal mix of collations (gbk_chinese_ci, IMPLICIT) and (gb2312_chinese_ci, I
Some common garbled problems are found to be garbled when the database itself is gbk or gb2312. this is because mysql still has a channel encoding during connection, therefore, set the connection encoding to gb2312 or UTF-8.
You can, such:
Jdbc: mysql: // localhost: 3306/ipanel? UseUnicode = true & characterEncoding = UTF-8
The parameter settings of hibernate and jdbc are different, but they are basically the same. There are many similar materials on the Internet.
The most important question is:
Illegal mix of collations (gbk_chinese_ci,IMPLICIT) and (gb2312_chinese_ci,IMPLICIT) for operation '='
I believe many people have come across it, which means the character encoding is different and cannot be compared. that is to say, the encoding in the database is different, and some data is
Gbk_chinese_ci, some data is gb2312_chinese_ci, so the core to solve this problem is to unify all the database codes.
Enter the 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.
BitsCN.com