Every time you use the terminal When creating a database or table , All character sets are latin1( When you don't specify a character set ) as follows :
View the character set of the current database
character_set_client: The client requests the character set of the data
character_set_connection: The client / Server connected character set
character_set_database: The character set of the default database , No matter how the default database changes , It's all this character set ; If there is no default database , Use it character_set_server The specified character set , This variable is recommended to be managed by the system itself , Don't artificially define .
character_set_filesystem: hold os The upper filename is converted to this character set , Namely the character_set_client transformation character_set_filesystem, Default binary There is no conversion
character_set_results: Result set , The character set returned to the client
character_set_server: The default character set for the database server
character_set_system: System character set , This value is always utf8, You don't have to set it . This character set is used for database objects ( See table and column ) Name , Also used for the names of functions stored in the table of contents .
View the proofing rules of the current database
show variables like 'collation%';
In the parameter file ,client,mysql as well as mysqld It's all set up in utf8mb4 Character set , But it's not set collation Related parameters
collation_connection The character set of the current connection .
collation_database Default proofreading for the current date , Each time USE Statement to “ Jump ” When it comes to another database , The value of this variable will change . If there is no current database , The value of this variable is collation_server The value of the variable .
collation_server The server's default proofreading .
The naming rule for sorting methods is : Character set name _ Language _ suffix , The meanings of the typical suffixes are as follows :
1)_ci: Case insensitive sorting
2)_cs: Case sensitive sorting
3)_bin: Binary sort mode , The size comparison will be based on character encoding , It's not about human language , therefore _bin The order of human languages does not include human languages
create database rommel default charset utf8 collate utf8_romanian_ci;
In the parameter file [mysqld] Add the following
[mysqld]
character-set-server=utf8mb4
collation-server=utf8mb4_general_ci
Test the database after restart .
A series of tests , Modification successful .
So during the installation , We need to modify the parameters , It's impossible to compile the database after installation ,
A temporary designation :
SET character_set_client = utf8mb4;
SET character_set_connection = utf8mb4;
SET character_set_database = utf8mb4;
SET character_set_results = utf8mb4;
SET character_set_server = utf8mb4;
更多推荐
use mysql character set_MySQL character set setting (terminal character set)
发布评论