If the front-end data, the back-end data are UFT-8 encoding, the program can not find any problems, but still appear to insert the database garbled, it is possible that the MySQL database server itself character set encoding problems
Use Mysql-front to connect to the database after execution: show variables like ' character% ';
It can be found that the character set encoding character_set_server here is Latin1
Modify the/etc/my.cnf file, modify the line to add Character-set-server=utf8
[Email protected] ~]# CAT/ETC/MY.CNF [mysqld]datadir=/var/lib/mysqlsocket=/var/lib/mysql/mysql.sockuser= mysqldefault-storage-engine=innodbcharacter-set-server=utf8# disabling symbolic-links is recommended to prevent Assorted Security riskssymbolic-links=0[mysqld_safe]log-error=/var/log/mysqld.logpid-file=/var/run/mysqld/ Mysqld.pid
Restarting the MySQL server
Service mysqld Restart
View MySQL server character encoding set
In this way, there will be no garbled.
MySQL Chinese garbled problem under Linux