Original: MySQL base character set and garbled
Mysql 's character set is very flexible
You can set the server default character set
Database default Character Set
Table Default Character Set
Column Character Set
If a certain level does not specify a character set , the upper level is inherited .
For example , declare UTF8 as a table:
The stored data is in the table , and finally the UTF8;
1: tell the server , What is the data I sent you encoded ? character_set_client
2: tell the converter what code to convert to ? Character_set_connection
3: What code is the result of the query ? Character_set_results
If all of the above 3 are character set N, you can shorthand for set names n
Inference : What will be garbled ?
1:client statement is inconsistent with the facts
2:results When the client page does not match .
What time will the data be lost ?
Connetion and the server's character set are more than client hours .
Proofing set : refers to the collation of a character set
A character set can have one or more collations .
Take Utf8 as an example , We default to make the utf8_general_ci rule , You can also sort by binary , Utf8_bin
How do I declare a proofing set ?
Create table () ... Charset UTF8 collate utf8_general_ci;
Note : The declared proofing set must be a valid collation set of character sets .
MySQL base character set and garbled