Problem Description: When we load MySQL operation database on Linux system, there will be Chinese garbled problem, such as insert operation, found the data added to the database in Chinese, the following will solve the Linux MySQL Chinese garbled problem! :
Environmental centos6.5
1. Open the Linux window and start MySQL:
Mysql-uroot-proot
2. After connecting to MySQL, enter:
Show variables like '%char% ';
3. Configure the/ETC/MY.CNF as follows (if/ETC/MY.CNF does not exist, you can create a new/etc/my.cnf file):
[Client]default-character-set=UTF8 [Mysqld]datadir=/var/lib/Mysqlsocket=/var/lib/mysql/Mysql.sockuser=MySQL#disabling symbolic-links is recommended to prevent assorted security riskssymbolic-links=0#Default-character-set=utf8Character-set-server=Utf8init_connect='SET NAMES UTF8'[Mysql]no-auto-Rehashdefault-character-set=UTF8 [Mysqld_safe]log-error=/var/log/Mysqld.logpid-file=/var/run/mysqld/mysqld.pid
4. Restart MySQL
Service MySQL stop;
Service MySQL status;
Service MySQL start;
5. Connect MySQL, enter:
Show variables like '%char% ';
This means that the MySQL Chinese garbled has been resolved.
MySQL Chinese garbled in Linux