Common utf8mb4 sorting rules in MySQL are:
When the default character set of a table is set to utf8mb4 but the collation is not explicitly specified:
Because the utf8mb4_0900_ai_ci collation is the collation introduced in MySQL 8.0, when you import a MySQL 8.0 table into MySQL 5.7 or MySQL 5.6, the character set may not be recognized.
Parameter ControlIn MySQL version 5.6, the collation_server parameter is used to set the default collation at the server level.
The character_set_database and collation_database parameters are deprecated in MySQL 5.7 and will be removed in a subsequent version.
Comparison between utf8mb4_unicode_ci and utf8mb4_general_ci1. Accuracy
2. Performance
Supplement: MySQL--utf8mb4 and equal value query test Test Scripts ## Delete the test table DROP TABLE IF EXISTS tb2001; DROP TABLE IF EXISTS tb2002; DROP TABLE IF EXISTS tb2003; ## Create a test table CREATE TABLE tb2001( id INT AUTO_INCREMENT PRIMARY KEY, c1 VARCHAR(100) COLLATE utf8mb4_unicode_ci, c2 VARCHAR(100) COLLATE utf8mb4_bin )ENGINE=INNODB DEFAULT CHARSET=utf8mb4 ; CREATE TABLE tb2002( id INT AUTO_INCREMENT PRIMARY KEY, c1 VARCHAR(100) COLLATE utf8mb4_general_ci, c2 VARCHAR(100) COLLATE utf8mb4_bin )ENGINE=INNODB DEFAULT CHARSET=utf8mb4; CREATE TABLE tb2003( id INT AUTO_INCREMENT PRIMARY KEY, c1 VARCHAR(100) COLLATE utf8mb4_0900_ai_ci, c2 VARCHAR(100) COLLATE utf8mb4_bin )ENGINE=INNODB DEFAULT CHARSET=utf8mb4; ## Insert test data INSERT INTO tb2001(c1,c2) ββVALUES(0xF09F8D83,0xF09F8D83),(0xF09FA68A,0xF09FA68A),(0xF09F8CA0,0xF09F8CA0); INSERT INTO tb2002(c1,c2)VALUES(0xF09F8D83,0xF09F8D83),(0xF09FA68A,0xF09FA68A),(0xF09F8CA0,0xF09F8CA0); INSERT INTO tb2003(c1,c2)VALUES(0xF09F8D83,0xF09F8D83),(0xF09FA68A,0xF09FA68A),(0xF09F8CA0,0xF09F8CA0); ## Equivalence query test SELECT * FROM tb2001 WHERE c1=0xF09F8D83; SELECT * FROM tb2002 WHERE c1=0xF09F8D83; SELECT * FROM tb2003 WHERE c1=0xF09F8D83; SELECT * FROM tb2001 WHERE c2=0xF09F8D83; SELECT * FROM tb2002 WHERE c2=0xF09F8D83; SELECT * FROM tb2003 WHERE c2=0xF09F8D83; Test Results mysql> SELECT * FROM tb2001 WHERE c1=0xF09F8D83; +----+------+------+ | id | c1 | c2 | +----+------+------+ | 1 | π | π | | 2 | π¦ | π¦ | | 3 | π | π | +----+------+------+ 3 rows in set (0.00 sec) mysql> SELECT * FROM tb2002 WHERE c1=0xF09F8D83; +----+------+------+ | id | c1 | c2 | +----+------+------+ | 1 | π | π | | 2 | π¦ | π¦ | | 3 | π | π | +----+------+------+ 3 rows in set (0.01 sec) mysql> SELECT * FROM tb2003 WHERE c1=0xF09F8D83; +----+------+------+ | id | c1 | c2 | +----+------+------+ | 1 | π | π | +----+------+------+ 1 row in set (0.00 sec) mysql> mysql> SELECT * FROM tb2001 WHERE c2=0xF09F8D83; +----+------+------+ | id | c1 | c2 | +----+------+------+ | 1 | π | π | +----+------+------+ 1 row in set (0.00 sec) mysql> SELECT * FROM tb2002 WHERE c2=0xF09F8D83; +----+------+------+ | id | c1 | c2 | +----+------+------+ | 1 | π | π | +----+------+------+ 1 row in set (0.00 sec) mysql> SELECT * FROM tb2003 WHERE c2=0xF09F8D83; +----+------+------+ | id | c1 | c2 | +----+------+------+ | 1 | π | π | +----+------+------+ 1 row in set (0.00 sec) Test Summary
This is the end of this article about utf8mb4 sorting rules in MySQL. For more information about MySQL utf8mb4 sorting, please search for previous articles on 123WORDPRESS.COM or continue to browse the following related articles. I hope you will support 123WORDPRESS.COM in the future! You may also be interested in:
|
<<: Perfect solution for JavaScript front-end timeout asynchronous operation
>>: How to modify the default submission method of the form
1. Target environment Windows 7 64-bit 2. Materia...
Table of contents No slots Vue2.x Slots With slot...
The mysql 5.7.18 zip version of MySQL is not like...
Table of contents What is Express middleware? Req...
Table of contents 1. Overview 1.1 Usage of queryS...
This article example shares the specific code of ...
To obtain the calculated style in a CSS element (t...
Recently, our small team needs to share a shared ...
Basic Concepts Before operation, you must first u...
Table of contents 1. Page Rendering 2. Switch tag...
An at-rule is a declaration that provides instruc...
Table of contents Function call optimization Func...
Welcome to the previous canvas game series: γVUE ...
background When we want to log in to the MySQL da...
tomcat official website tomcat is equivalent to a...