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