How to modify MySQL character encoding

Source: Internet
Author: User

How to modify MySQL character encodingDescription: MySQL character encoding modification there are several ways to modify the configuration file directly, or through the way of the command, here only to modify the configuration file method. I. InspectionMysqlnumberaccordingLibraryof theCoding

lose into the following SQL language sentence Practice Line, and Get Knot Fruit

Mysql> Show variables like ' character\_set\_% ';

+--------------------------+--------+

| variable_name | Value |

+--------------------------+--------+

| character_set_client | UTF8 |

| character_set_connection | UTF8 |

| Character_set_database | Latin1 |

| Character_set_filesystem | binary |

| Character_set_results | UTF8 |

| Character_set_server | Latin1 |

| Character_set_system | UTF8 |

+--------------------------+--------+

7 rows in Set (0.01 sec)

Mysql> Show variables like ' collation_% ';

+----------------------+-------------------+

| variable_name | Value |

+----------------------+-------------------+

| collation_connection | Utf8_general_ci |

| Collation_database | Latin1_swedish_ci |

| Collation_server | Latin1_swedish_ci |

+----------------------+-------------------+

3 Rows in Set (0.00 sec)

Two.ModifyMysqlnumberaccordingLibrary Encoding

2.8 knot fruit code and utf8 need to modify number Library encoding please Follow the steps below line

Practice line The following command:

Service Mysqld Stop

Cp/usr/share/mysql/my-huge.cnf/etc/my.cnf

Vi/etc/my.cnf

above command, stop first. MySQL Service Services , and then Complex Making a a sample configuration file for to be with Households configuration.

in the my.cnf file found in the " [Client] " , under which you add the following language sentence

Default-character-set=utf8

in the my.cnf file found in the " [Mysqld] " , under which you add the following language sentence

Character-set-server=utf8

Collation-server=utf8_general_ci

init-connect= ' SET NAMES UTF8 '

Save and Close my.cnf

Heavy Kai MySQL , Practice Line

Service mysqld Start

after the modification is complete, Please again Practice Line in the first step of the Enquiry , and indeed recognize Modify an already by success.


This article is from the "Technical Achievement Dream" blog, please be sure to keep this source http://pizibaidu.blog.51cto.com/1361909/1701527

How to modify MySQL character 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.