创建表的时候就指定搜索的列,会插入删除会自动更新索引,或者数据完成的时候去改动,不要在导入数据的时候修改。

建表语句:

Create table vilay(
id int unsigned auto_increment,
title varchar(20),
body text,
primary key (id),
FULLTEXT('body')
)

使用:

//Match匹配搜索的列,Against指定搜索的表达式(内容)
select body from vilay where MATCH(body) Against('test')

注意:MyISAM支持全文本搜索,InnoDB不支持