简体   繁体   English

MySQL FULLTEXT索引问题

[英]MySQL FULLTEXT indexes issue

I'm trying to create a FULLTEXT index on an attribute of a table. 我正在尝试在表的属性上创建FULLTEXT索引。 Mysql returns Mysql返回

ERROR 1214: The used table type doesn't support FULLTEXT indexes. 错误1214:使用的表类型不支持FULLTEXT索引。

Any idea what I'm doing wrong? 知道我做错了什么吗?

You're using the wrong type of table. 您使用的是错误类型的表格。 Mysql supports a few different types of tables, but the most commonly used are MyISAM and InnoDB. Mysql支持几种不同类型的表,但最常用的是MyISAM和InnoDB。 MyISAM (in MySQL 5.6+also InnoDB tables) are the types of tables that Mysql supports for Full-text indexes. MyISAM(在MySQL 5.6 +也是InnoDB表中)是Mysql支持全文索引的表类型。

To check your table's type issue the following sql query: 要检查表的类型,请发出以下sql查询:

SHOW TABLE STATUS

Looking at the result returned by the query, find your table and corresponding value in the Engine column. 查看查询返回的结果,在“引擎”列中查找表和相应的值。 If this value is anything except MyISAM or InnoDB then Mysql will throw an error if your trying to add FULLTEXT indexes. 如果此值是除MyISAM或InnoDB之外的任何值,那么如果您尝试添加FULLTEXT索引,Mysql将抛出错误。

To correct this, you can use the sql query below to change the engine type: 要更正此问题,您可以使用下面的sql查询来更改引擎类型:

ALTER TABLE <table name> ENGINE = [MYISAM | INNODB]

Additional information (thought it might be useful): Mysql using different engine storage types to optimize for the needed functionality of specific tables. 附加信息(认为它可能有用):Mysql使用不同的引擎存储类型来优化特定表所需的功能。 Example MyISAM is the default type for operating systems (besides windows), preforms SELECTs and INSERTs quickly; 示例MyISAM是操作系统的默认类型(除了窗口),可以快速执行SELECT和INSERT; but does not handle transactions. 但不处理交易。 InnoDB is the default for windows, can be used for transactions. InnoDB是windows的默认设置,可用于交易。 But InnoDB does require more disk space on the server. 但InnoDB确实需要更多的服务器磁盘空间。

Up until MySQL 5.6, MyISAM was the only storage engine with support for full-text search (FTS) but it is true that InnoDB FTS in MySQL 5.6 is syntactically identical to MyISAM FTS. 直到MySQL 5.6,MyISAM是唯一支持全文搜索(FTS)的存储引擎,但是MySQL 5.6中的InnoDB FTS在语法上与MyISAM FTS完全相同。 Please read below for more details. 请阅读下面的详细信息。

InnoDB Full-text Search in MySQL 5.6 MySQL 5.6中的InnoDB全文搜索

mysql手册说只能在带有mylsam引擎的表上创建FULLTEXT索引。

Are you using InnoDB? 你在使用InnoDB吗? The only table type that supports FULLTEXT is MyISAM. 支持FULLTEXT的唯一表类型是MyISAM。

除了MyISAM表, PARTITIONING也不支持full-text索引。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM