MySQL FULLTEXT 索引问题
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/963534/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
MySQL FULLTEXT indexes issue
提问by Cimplicity
I'm trying to create a FULLTEXT index on an attribute of a table. Mysql returns
我正在尝试在表的属性上创建 FULLTEXT 索引。mysql 返回
ERROR 1214: The used table type doesn't support FULLTEXT indexes.
错误 1214:使用的表类型不支持 FULLTEXT 索引。
Any idea what I'm doing wrong?
知道我做错了什么吗?
回答by Cimplicity
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. MyISAM (in MySQL 5.6+also InnoDB tables) are the types of tables that Mysql supports for Full-text indexes.
您使用的表格类型错误。Mysql 支持几种不同类型的表,但最常用的是 MyISAM 和 InnoDB。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.
查看查询返回的结果,在 Engine 列中找到您的表和对应的值。如果此值是 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. Example MyISAM is the default type for operating systems (besides windows), preforms SELECTs and INSERTs quickly; but does not handle transactions. InnoDB is the default for windows, can be used for transactions. But InnoDB does require more disk space on the server.
附加信息(认为可能有用):Mysql 使用不同的引擎存储类型来优化特定表所需的功能。示例 MyISAM 是操作系统的默认类型(除了 windows),快速执行 SELECT 和 INSERT;但不处理交易。InnoDB 是 windows 的默认值,可用于事务。但是 InnoDB 确实需要服务器上更多的磁盘空间。
回答by Sukhjinder Singh
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. Please read below for more details.
在 MySQL 5.6 之前,MyISAM 是唯一支持全文搜索 (FTS) 的存储引擎,但 MySQL 5.6 中的 InnoDB FTS 在语法上与 MyISAM FTS 相同。请阅读下文了解更多详情。
回答by soulmerge
The mysql manualsays that FULLTEXT
indexes can only be created on tables with the mylsam engine.
在MySQL手册说,FULLTEXT
指数只能在与mylsam引擎表来创建。
回答by Artem Russakovskii
Are you using InnoDB? The only table type that supports FULLTEXT is MyISAM.
你在使用 InnoDB 吗?唯一支持 FULLTEXT 的表类型是 MyISAM。
回答by Saurabh Chandra Patel
apart from MyISAM table PARTITIONING
also not support full-text
index.
除了 MyISAM 表PARTITIONING
也不支持full-text
索引。