2

想解决这个问题很久了……

SELECT MATCH(name) AGAINST('абраксас')

(俄语)不起作用,但是

SELECT MATCH(name) AGAINST('abraxas')

(英语)完美地工作。
我知道这是字符集的问题,但我尝试了所有类型的设置,但没有成功。
现在它是latin-1。
LIKE 作品
这是与show variables字符集相关的:

character_set_client - latin1
character_set_connection - latin1
character_set_database - latin1
character_set_filesystem - binary
character_set_results - latin1
character_set_server - latin1
character_set_system - utf8
character_sets_dir - /usr/share/mysql/charsets/
collation_connection - latin1_swedish_ci
collation_database - latin1_swedish_ci
collation_server - latin1_swedish_ci

/etc/my.cnf 的大块

default-character-set=latin1
skip-character-set-client-handshake

转储的大块:

/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8 */;
DROP TABLE IF EXISTS `scenes_raw`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `scenes_raw` (
`scene_name` varchar(40) DEFAULT NULL,
...blabla...
) ENGINE=MyISAM AUTO_INCREMENT=901 DEFAULT CHARSET=utf8;

(我也做了没有跳过字符集客户端握手的测试)

SHOW TABLE STATUS WHERE Name = 'scenes_raw'\G
Name: scenes_raw
Engine: MyISAM
Version: 10
Row_format: Dynamic
Index_length: 23552
Collation: utf8_general_ci
Checksum: NULL
Create_options:
4

2 回答 2

3

尝试将您的 character_set_client 设置为 UTF-8。我刚试了一下:

> mysql -u root -p charset_test --default-character-set=latin1
mysql> select * from scenes_raw where MATCH(scene_name) AGAINST('абраксас');
Empty set (0.00 sec)

> mysql -u root -p charset_test --default-character-set=utf8
mysql> select * from scenes_raw where MATCH(scene_name) AGAINST('абраксас');
+------------------+
| scene_name       |
+------------------+
| абраксас         | 
+------------------+
1 row in set (0.00 sec)

编辑:有关更多详细信息,请参阅此说明。“SHOW VARIABLES”输出中的“character_set_client”是 MySQL 客户端用来发送到服务器的字符集。当它是 Latin-1 时,它不支持 Cyrillic,但当它是 UTF-8 时,它应该可以正常工作。

于 2010-03-21T22:08:51.717 回答
0

打开与服务器的连接后,尝试调用集合名称“utf8” 。

于 2010-03-18T14:09:08.760 回答