: This article mainly introduces the character set in MySQL. if you are interested in the PHP Tutorial, you can refer to it. Character set: it is the encoding used to describe graphics or text during transmission.
Relationship between graphics or text and encoding:
It is like the following:
"Word" => 10010001 110000111
Data storage encoding:
Which encoding method is used to store data on the server?
Constraint is ultimately mapped to the field level, so the encoding should be a field,
Data encoding is determined by the following scheme:
1. if encoding is specified for a field, it is determined by the field,
2. if the field is not specified, check the table and confirm the encoding if it is specified.
3. if no encoding is specified in the table, check the database. If encoding is determined
4. if the library is not encoded, it is determined by the server itself.
Are you sure you want to encode the server:
Typical encoding: gbk and utf8
Client operation, query encoding:
When the client interacts with the server, there are two important codes:
1. encoding of data sent by the client
2. the client accepts the server code.
You can use "show variables like" character_set _ % "; to display variables with the beginning of set with the above two values,
The command line client can only be in the gbk format
Use set variable name = variable value to change the value
Set names gbk is a quick operation, which changes the above two configurations to the target encoding at the same time!
Set names gbk | utf8 depends on the encoding that the client can accept!
The overall process is:
Setnames gbk | utf8
The above introduces the character set in MySQL, including some content, and hopes to help those who are interested in the PHP Tutorial.