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