我有点迷失,这看起来像一些愚蠢的错误 – 但我不知道这可以是什么.这是测试会话:
mysql> drop table articles;
Query OK, 0 rows affected (0.02 sec)
mysql> CREATE TABLE articles (body TEXT, title VARCHAR(250), id INT NOT NULL auto_increment, PRIMARY KEY(id)) ENGINE = MYISAM;
Query OK, 0 rows affected (0.02 sec)
mysql> ALTER TABLE articles ADD FULLTEXT(body, title);
Query OK, 0 rows affected (0.02 sec)
Records: 0 Duplicates: 0 Warnings: 0
mysql> insert into articles(body) values ('Maya');
Query OK, 1 row affected (0.00 sec)
mysql> SELECT * FROM articles WHERE MATCH(title, body) AGAINST('Maya');
Empty set (0.00 sec)
mysql> select * from articles
-> ;
+------+-------+----+
| body | title | id |
+------+-------+----+
| Maya | NULL | 1 |
+------+-------+----+
1 row in set (0.00 sec)
这是在“mysqld Ver 5.1.37-1ubuntu5 for debian-linux-gnu on i486((Ubuntu))”上.
这是简单剪切和粘贴的脚本(请尝试并验证它是否适用于您的系统):
CREATE TABLE articles (body TEXT, title VARCHAR(250), id INT NOT NULL auto_increment, PRIMARY KEY(id)) ENGINE = MYISAM;
ALTER TABLE articles ADD FULLTEXT(body, title);
insert into articles(body) values ('Maya');
SELECT * FROM articles WHERE MATCH(title, body) AGAINST('Maya');