MySQL 5.5 version to solve the problem of Chinese garbled in My.ini [MYSQLD] Item can not be written Default-character-set=utf8

Source: Internet
Author: User

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

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.