Bug #103171 Index of character utf8 is wrong
Submitted: 1 Apr 2021 10:10 Modified: 1 Apr 2021 11:47
Reporter: Guo Wenxuan Email Updates:
Status: Verified Impact on me:
None 
Category:MySQL Server: DML Severity:S2 (Serious)
Version:8.0./5.7 OS:Any
Assigned to: CPU Architecture:Any

[1 Apr 2021 10:10] Guo Wenxuan
Description:
correct:
mysql> select * from t1 where col1 like "amysql%";
+--------+------+
| col1   | col2 |
+--------+------+
| amysql
 | b    |
+--------+------+
1 row in set (0.04 sec)

incorrect:
mysql> select * from t1 where col1 like "amysql%";
Empty set
 

How to repeat:
create table t1(col1 varchar(255) COLLATE utf8_bin DEFAULT NULL, col2 varchar(255) COLLATE utf8_bin DEFAULT NULL, KEY `Idx_col1` (col1))ENGINE=InnoDB AUTO_INCREMENT=9 DEFAULT CHARSET=utf8 COLLATE=utf8_bin;

insert into t1 values("a","b");

update t1 set col1 = "amysql\r\n" where col2 = "b";
[1 Apr 2021 11:47] MySQL Verification Team
Thank you for the bug report.