Today to the MySQL database to add a table containing Chinese data, but always out of the exception, check the program did not find errors, helpless Ah, and then re-check the table found that the table is encoded latin1 and the original thought can be inserted in the Chinese field encoding is also latin1, Then again carefully observe the console output of the exception, further determined that the table and the table in the wrong field coding, then modify the table and the corresponding fields in the net for a while, you don't say there is really, after the execution of SQL script can be deposited in Chinese, although so still think it is necessary to summarize, The Ancients cloud: good memory is better than bad writing, oh ah.
Modify table Encoding: ALTER table ' Test ' DEFAULT CHARACTER SET UTF8; This command is used to change the encoding of the table test to UTF8;
To modify the encoding of a field: ALTER TABLE ' test ' change ' name ', ' name ' VARCHAR (CHARACTER) SET UTF8 not NULL; This command is used to change the encoding of the Name field in the table test to UTF8
Source: http://www.jb51.net/article/50091.htm
Ways to modify the encoding of fields in tables and tables in a MySQL database