Encoding: Computers are binary storage, so the display symbols need to be converted to binary numbers to be stored, and each character is converted into a binary number, which is the character encoding.
Character Set
Characters are used to display abstract symbols. a character set is a set of characters and character encodings.
Common character-set encodings:
ASCII character set, GB2312 character set, GBK character set, latin1 character set, Unicode character set, etc.
show character set;
You can get all the character sets supported by MySQL.
Modifying the database character set
alter database liguodong character set utf8;
MySQL can use multiple character sets to save data.
MySQL can set the character set for fields, tables, databases, servers, and also set the connection character set (when the client interacts with the server side).
meaning of the encoding related variables:
You can character-set-server=utf8
modify the encoding settings for the server in My.ini:
Server Character Set:
Connection Character Set:
Proofing Rules:
Each set of coded character sets has a collation rule associated with it. Proofing rules Refer to the comparison between characters within the current character set.
Each character set provides one or more proofing rules.
The usual naming conventions are:字符集_语言名_ci|cs|bin
Common CI is case insensitive. CS is case-sensitive and bin bytes are compared.
To view the proofing rules directives:
show collation;show collation like ‘gbk%‘;
When setting the character set, you can set the proofing rules that are used by the current character set. However, no proofing rules are set, so each character set has a default proofing rule.
Take GBK as an example to compare the differences between chinese_ci,bin
create table tab3(name varchar(10)) character set gbk collate gbk_chinese_ci;create table tab4(name varchar(10)) character set gbk collate gbk_bin;
The default is Gbk_chinese_ci, so the character set is not displayed.
show create table tab3\Gshow create table tab4\G
Insert into tab3 values(' a '); Insert into tab3 values(' B '); Insert into tab3 values(' C '); Insert into TAB4 values(' a '); Insert into TAB4 values(' B '); Insert into TAB4 values(' C ');
Affects the preservation of data, character sets.
Comparison of image data, proofing set.
Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.
MySQL Character set and proofing rules