mysql版本8.0.26,
创建全文索引:
alter table tb add fulltext index testIdx (name);
match() & against()可以正常使用:
select * from tb where match(name) against('str*' in boolean mode)
但是contains()会提示 code: 'ER_PARSE_ERROR', errno: 1064 :
select * from tb where contains(name,'str')
我估计你是受了某些中文“技术”博客(技术打引号,你懂我的意思吧)的荼毒。
MySQL8 的 Full-Text Search 只有
MATCH (col1,col2,...) AGAINST (expr [search_modifier])
这一种语法,压根就没有CONTAINS (col, expr)
这种语法,那是 MS SQL Server 的。P.S. 无数事实告诉我们,要想学好编程,真的得远离中文搜索引擎、及 CSDN 等一票所谓的“技术”网站,不要给它们贡献点击率,慢慢的它们没有收入自然而然就倒闭了。