This question on the Internet to find a half-day, did not find a solution, and finally I used a small technique to solve.
Reprint please indicate the source:
http://blog.csdn.net/ouyida3/article/details/46606689
This article is from: "Ouyida3 's Blog"
Workaround, execute the command:
SET character_set_results = gbK;
For details, refer to:
Baidu knows the answer
In this answer,
SET character_set_client = gbK;SET character_set_results = gbK;SET character_set_connection = utf8;
Or
SET character_set_client = utf8;SET character_set_results = gb2312;SET character_set_connection = utf8;
can be tried. But actually I only set results as GBK. And the second part of what is said to set the font, in my new version there is no such setting.
This setting really does not garbled, but restart SQLyog and does not take effect.
Online also said set the server side of the MY.CNF configuration file in the Character-set-server parameter or default parameters, I see my servers are set up GBK.
[Aipaas@aipaas03/app]$moreMy.cnf[mysqld_multi]mysqld =/app/mysql/bin/mysqld_safemysqladmin =/app/mysql/bin/mysqladminuser = Mysqlpassword = Ailk@Aug[MYSQLD020]port =3020Socket =/tmp/mysql. Sock01pid-file =/app/data_01/db-app.pidbasedir =/app/mysqlDataDir =/app/data_01user = mysqlsymbolic-links=0character-set-server=gbkndbclusterndb-connectstring=130.51.23.24Explicit_defaults_for_timestampoptimizer_switch=engine_condition_pushdown=off
While I'm through the MySQL client command line on the host, the character set is no problem:
MySQL [portaldb]> SHOW VARIABLES like' char% '+--------------------------+--------------------------------------------------------------------+| variable_name | Value |+--------------------------+-------------------------- ------------------------------------------+| Character_set_Client | GBK | | Character_set_Connection | GBK | | Character_set_Database | GBK | | Character_set_FileSystem | binary | | Character_set_Results | GBK | | Character_set_Server | GBK | | Character_set_System | UTF8 || character_sets_dir |/app/mysql-cluster-gpl-7.4.6-linux-glibc2.5-x86_64/share/charsets/|+------------------ --------+--------------------------------------------------------------------+8 rows in Set (0.00 sec)
This note, the same server side, different clients are likely to produce different character sets, because I think there should be a way to modify the character set on the client.
SQLyog Character set (distinct from the command line client above):
At this point, the company's DBA asked me to use GBK when I built the table. I don't think it's a reliable. First of all, why is it mandatory to build a table GBK? Secondly, I did not garbled in the command line, just garbled in the SQLyog, I think it is not the problem of building a table character set.
SHOW CREATE TABLE sys_config;TableCreate Table------------------------Sys_configCREATE TABLE ' Sys_config '(' id ' int( One) not NULLAuto_increment,' Type_code ' varchar( -)COLLATEUtf8_binDEFAULT NULL,' Param_code ' varchar( -)COLLATEUtf8_binDEFAULT NULL,' Service_value ' varchar( -)COLLATEUtf8_binDEFAULT NULL,' Service_option ' varchar(255)COLLATEUtf8_binDEFAULT NULL,' DESCB ' varchar(255)COLLATEUtf8_binDEFAULT NULL,' state ' varchar(2)COLLATEUtf8_binDEFAULT ' 1 ',PRIMARY KEY(' id ') ) Engine=innodb auto_increment= $ DEFAULTCharset=utf8COLLATE=utf8_bin
I thought for a moment, as long as the login database, the default is to execute this command first:
Problem solved perfectly.
My Reference Links:
- about how MySQL modifies the character_set_client encoding problem
- http://blog.csdn.net/ACMAIN_CHM/article/details/4174186
- Http://www.itpub.net/thread-1806655-1-1.html
2015.6.23
SQLyog v11.24 Query MySQL5.6.24 The method of solving Chinese garbled characters