To see how to solve the garbled problem:
In MySQL, the default character set is Latin1,
If you want to set the character set to Uft-8, you can add the following settings in the My.cnf file:
[Client]
Default-character-set=utf8
[Mysqld]
Default-character-set=utf8
Skip-character-set-client-handshake #此处是忽略客户端的字符集, using the server's settings
(The Skip statement and the default in the client select one)
Of course you can set up a database in a defined character set:
1 CREATE DATABASE db_name default character set UTF8 Callate utf8-general-ci;
You can also set it before linking the database:
Set names ' UTF8 ';
Focus on the Scarlet Letter, add the skip-character-set-client-handshake,client inside will not add the default
Show variables like ' characte% ';
+--------------------------+----------------------------+
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/|
+--------------------------+----------------------------+
However, according to the above configuration, MySQL will not be able to boot, this is why? Look down:
In the 5.1 version, in order to solve the Chinese garbled problem set the default character set is UTF8, in the My.ini in the [MySQL] and [mysqld] entries are written:
Default-character-set=utf8
In the 5.5 version, [MySQL] entries can be written in this way, [mysqld] in this write in the start MySQL service will have 1067 errors, after the query found that this must be written:
Character-set-server=utf8
5.1 and 5.5 are now known to have such a difference and are seen in the auto-generated My.ini file from the 5.5 installation version. Further experimentation is required to configure the 5.5 version that is not installed.
Http://www.jianshu.com/p/d41ebad823b8
MySQL 5.5 version to solve the problem of Chinese garbled in My.ini [MYSQLD] Item can not be written Default-character-set=utf8