The sixth character, there is also a set
A character set is a collection of symbols and character encodings that are a set of character encodings.
UTF8MB4: Support UTF8 can support characters, it all supports, UTF8 character set is not supported, it also supports. Character set after mysql5.5
View the character sets supported by the current database
Show character set;
the proofing rules for display character sets can be used with show collation
Show collation like ' latin% ';
Create a database Specify a character set, and arrange the order
Create DATABASE test2 DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci;
The name of the proofing rule also has rules, usually starting with the character set that the collation rule belongs to, then the language it belongs to, and finally the simple form of the proofing rule type, in the following 3 formats
_CI: All referred to as case insensitive, this is a rule that is not sensitive to capitalization
_cs: All referred to as case sensitive, which indicates that this is a write-sensitive rule
_bin: And binary, said this is a two-dollar proofing rules, two yuan proofing rules must also be case sensitive rules
Set of character sets and proofing rules, from a large dimension. There are 2 levels:
1) First, connect the database, the character set used when performing the operation
2) The character set used to save the data next
Setting the default character set on the server
The character set is such an important property that we do not specify until we actually store the data. When the MySQL service starts, the set of character sets is in effect, and the character set and collation rules used by the system are acknowledged. And the character set and collation rules specified at startup are globally valid for the entire MySQL service, that is, if the character set and collation rules are not provisioned with the updated granularity, then all subsequent operations, whose character set is set to inherit the default character set and proofing rules that the global granularity sets
MySQL has a flexible way of specifying a character set, such as:
1) Specify when compiling and installing MySQL (source-only installation mode)
2) Start MySQL service is specified by parameters
3) in the parameter file configuration, the way to load the parameter file when starting the MySQL service to make it effective
4) Modify in real time while the MySQL service is running
1) When we compile and install the MySQL software, we set up the character set:
-ddefault_charset=utf8 \
-ddefault_collation=utf8_general_ci\
This parameter determines the MySQL service that the computer is running, and the default is the character set and proofing rules without any other character set settings, in the absence of other settings.
Compile time Specify default character set and proofing rules through Default_charset and default_collation two compilation parameters
2) Specify when starting the MySQL service
When starting the MySQL database service (mysqld command or MYSQLD_SAFE command) there are a bunch of parameters that can be set, with the following two system parameters associated with the character set:
--character_set_server: Specifies the default character set for global granularity
--collation_server: Specifies the default proofing rules for global granularity
Startup time did not find these 2 parameters, they are the default value, their default values will inherit the compilation of MySQL software default_charset and default_collation These two parameters specified values, if the MySQL database is not compiled by the source code installation, Their default values will be the LATINL character set and the Latinl_swedish_ci proofing rules ( nor absolute )
3) Parameter file configuration
When the MySQL service starts, you can simplify the options specified in the startup command by specifying the form of a parameter file (that is, the my.cnf file), and the correspondent can place the parameter settings for the character set and proofing rules in the parameter file. When these two parameters are placed in the parameter file, the parameter name is the same as the command line's option name, but the "--" character is not required when specifying the parameter, for example:
Character_set_server=utf8
Collation_server=utf8_general_ci
4) Modification of MySQL service during operation
There are 3 ways to specify the character set and proofing rules, but if you want to change the character set settings, the movement is too large to take effect to restart the MySQL service. In fact, there is no need to be so much trouble, these two parameters, while the MySQL service is running as a system variable exists, while the system variables in the MySQL service run, most of them can be modified in real time, the control character set and collation rules of the system variables belong to the category of modified
Mysql_ Smudge Notes--sixth chapter characters, and a set