The modified character set encoding for MySQL 5.5 under Linux is UTF8

Source: Internet
Author: User
Tags mysql view

First, login MySQL view with show VARIABLES like ' character% '; The following character set, shown below:

+--------------------------+----------------------------+
| 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 |
| Character_sets_dir | /usr/share/mysql/charsets/|
+--------------------------+----------------------------+

The default character set for Character_set_database and Character_set_server is still latin1.

Two, the simplest perfect modification method, modifies the character set key value in the MySQL my.cnf file (Note the field details of the configuration):

1. Add Default-character-set=utf8 to the [client] field as follows:

[client]
port = 3306
socket = /var/lib/mysql/mysql.sock
default-character-set=utf8

2. Add Character-set-server=utf8 to the [mysqld] field as follows:

[mysqld]
port = 3306
socket = /var/lib/mysql/mysql.sock
character-set-server=utf8

3. Add Default-character-set=utf8 to the [MySQL] field as follows:

[mysql]
no-auto-rehash
default-character-set=utf8

After the modification is complete, service MySQL restart restart the MySQL services to take effect. Note: The [mysqld] field differs from the [MySQL] field. This is no one on the internet feedback.

Use show VARIABLES like ' character% '; view, found that the database encoding has been changed to UTF8.

+--------------------------+----------------------------+
| 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/|
+--------------------------+----------------------------+


This article from the "Technology is tossing" blog, please be sure to keep this source http://jamswu.blog.51cto.com/6391890/1554752

The modified character set encoding for MySQL 5.5 under Linux is 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.