Today to the MySQL database to add a table containing Chinese data, but always abnormal, check the program did not find errors, helpless Ah, and then re-examine the table found that the encoding of the table is latin1 and originally wanted to be able to insert the Chinese field encoding is also latin1, Then carefully observe the output of the console again, further determine that the table and table in the field of improper coding, then modify the table and the corresponding fields chant, online search for a while, you do not say that there is, after the execution of the SQL script can be stored in Chinese, although it is necessary to sum up, Ancient cloud: Good memory is not as bad as a pen, oh ah.
Modify the encoding of the table: ALTER TABLE ' Test ' DEFAULT CHARACTER SET UTF8, which is used to change the encoding of 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 table test to UTF8