Solve MySQL Chinese garbled characters in RHEL6.3

Source: Internet
Author: User
To save the trouble in the future, we can modify the mysql garbled characters in the configuration file under RHEL6.3. My mysql configuration file is/etc/my. cnf1. first find [mysqld] in the configuration file and add the following line: [mysqld] character_set_server = utf82. then find the [mysql] option. I do not have this option here, some do not need to be added. I added the following: [mysql] default-char

To save the trouble in the future, we can modify the mysql garbled characters in the configuration file under RHEL6.3. My mysql configuration file is/etc/my. cnf

1. First find [mysqld] in the configuration file and add the following line:

[Mysqld]

Character_set_server = utf8

2. Find the [mysql] option. I do not have this option here, and some do not need to be added. I added the following:

[Mysql]

Default-character-set = utf8

3. Restart the mysql service.

[Root @ mysql ~] #/Etc/init. d/mysqld restart

Stop mysqld: [OK]

Starting mysqld: [OK]

4. Go to mysql to view the Encoding

Mysql> show variables like 'character % ';

+--------------------------+----------------------------+ | 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/ | +--------------------------+----------------------------+ 8 rows in set (0.00 sec)

5. If you still cannot set it manually, the setting command is as follows:

Mysql> SET character_set_client = utf8;
Mysql> SET character_set_connection = utf8;
Mysql> SET character_set_database = utf8;
Mysql> SET character_set_results = utf8;
Mysql> SET character_set_server = utf8;
Mysql> SET collation_connection = utf8;
Mysql> SET collation_database = utf8;
Mysql> SET collation_server = utf8;

Related reading:

MySQL garbled http://www.linuxidc.com/Linux/2012-11/74400.htm in CentOS (Linux)

Http://www.linuxidc.com/Linux/2011-10/45187.htm for MySQL garbled problem under Fedora 15

For more information about RedHat, see RedHat topic page http://www.linuxidc.com/topicnews.aspx? Tid = 10

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.