自定义排序规则似乎是最合适的,但如果不可能,也许您可以定制搜索以使用正则表达式。它并不完全理想,但在某些情况下可能有用。至少它允许您以正确的格式存储数据(无需替换引号),并且只需对搜索查询本身进行替换:
INSERT INTO mytable VALUES
(1, 'Though this be madness, yet there is method in ''t'),
(2, 'Though this be madness, yet there is method in ’t'),
(3, 'There ’s daggers in men’s smiles'),
(4, 'There ’s daggers in men''s smiles');
SELECT * FROM mytable WHERE data REGEXP 'There [\'’]+s daggers in men[\'’]+s smiles';
+----+--------------------------------------+
| id | data |
+----+--------------------------------------+
| 3 | There ’s daggers in men’s smiles |
| 4 | There ’s daggers in men's smiles |
+----+--------------------------------------+
SELECT * FROM mytable WHERE data REGEXP 'Though this be madness, yet there is method in [\'’]+t';
+----+-----------------------------------------------------+
| id | data |
+----+-----------------------------------------------------+
| 1 | Though this be madness, yet there is method in 't |
| 2 | Though this be madness, yet there is method in ’t |
+----+-----------------------------------------------------+