1. First check whether the value passed in from the front-end interface is garbled 2. View the character set in the MySQL database 2.1 cmd into the MySQL installation directory: D:\Program files\mysql\mysql Server 5.5\bin2.2 into the database: MySQL -U root-proot2.3 View database encoding format: Show variables like '%character% '; 2.4 The following interface appears:
3.: If the encoding format is not UTF8 or is different from the page character format. Locate the My.ini configuration file in the database installation directory. Change configuration parameters to: [Mysql]default-character-set=utf8 (Modify encoding format) [mysqld]character-set-server= UTF8 (Modify encoding format) 4. Restart the database 5. Note: 1. You can also set the encoding format in cmd: set names GBK; however, the encoding format will be changed back to the previous encoding format, that is, the encoding format of the configuration file, after the cmd restart. 2. The encoding format of the foreground must be the same as the encoding format of the database. Reference excerpt: http://www.blogjava.net/wldandan/archive/2007/09/04/142669.htmlhttp://www.cnblogs.com/sunzn/archive/2013/ 03/14/2960248.htmlhttp://www.cnblogs.com/sunzn/archive/2013/03/14/2960248.html
MySQL database input data garbled problem