MySQL #1214 - 使用的表类型不支持 FULLTEXT 索引
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/20964269/
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
#1214 - The used table type doesn't support FULLTEXT indexes
提问by RaGin RAj
I'm getting an error saying that the table type doesn't support FULLTEXT indices. How can I achieve this?
我收到一条错误消息,指出表类型不支持 FULLTEXT 索引。我怎样才能做到这一点?
Here's my table:
这是我的表:
CREATE TABLE gamemech_chat (
id bigint(20) unsigned NOT NULL auto_increment,
from_userid varchar(50) NOT NULL default '0',
to_userid varchar(50) NOT NULL default '0',
text text NOT NULL,
systemtext text NOT NULL,
timestamp datetime NOT NULL default '0000-00-00 00:00:00',
chatroom bigint(20) NOT NULL default '0',
PRIMARY KEY (id),
KEY from_userid (from_userid),
FULLTEXT KEY from_userid_2 (from_userid),
KEY chatroom (chatroom),
KEY timestamp (timestamp)
) ;
*
*
回答by peterm
Before MySQL 5.6 Full-Text Search is supported onlywith MyISAM Engine.
在 MySQL 5.6 之前,仅MyISAM 引擎支持全文搜索。
Therefore either change the engine for your table to MyISAM
因此,要么将表的引擎更改为 MyISAM
CREATE TABLE gamemech_chat (
id bigint(20) unsigned NOT NULL auto_increment,
from_userid varchar(50) NOT NULL default '0',
to_userid varchar(50) NOT NULL default '0',
text text NOT NULL,
systemtext text NOT NULL,
timestamp datetime NOT NULL default '0000-00-00 00:00:00',
chatroom bigint(20) NOT NULL default '0',
PRIMARY KEY (id),
KEY from_userid (from_userid),
FULLTEXT KEY from_userid_2 (from_userid),
KEY chatroom (chatroom),
KEY timestamp (timestamp)
) ENGINE=MyISAM;
Here is SQLFiddledemo
这是SQLFiddle演示
or upgrade to 5.6 and use InnoDB Full-Text Search.
或升级到 5.6 并使用 InnoDB 全文搜索。
回答by Nagaraj S
The problem occurred because of wrong table type.MyISAM is the only type of table that Mysql supports for Full-text indexes.
出现问题的原因是表类型错误。MyISAM 是Mysql 支持全文索引的唯一表类型。
To correct this error run following sql.
要纠正此错误,请运行以下 sql。
CREATE TABLE gamemech_chat (
id bigint(20) unsigned NOT NULL auto_increment,
from_userid varchar(50) NOT NULL default '0',
to_userid varchar(50) NOT NULL default '0',
text text NOT NULL,
systemtext text NOT NULL,
timestamp datetime NOT NULL default '0000-00-00 00:00:00',
chatroom bigint(20) NOT NULL default '0',
PRIMARY KEY (id),
KEY from_userid (from_userid),
FULLTEXT KEY from_userid_2 (from_userid),
KEY chatroom (chatroom),
KEY timestamp (timestamp)
) ENGINE=MyISAM;
回答by LoganEtherton
Only MyISAM allows for FULLTEXT, as seen here.
只有MyISAM数据允许FULLTEXT,因为看到这里。
Try this:
尝试这个:
CREATE TABLE gamemech_chat (
id bigint(20) unsigned NOT NULL auto_increment,
from_userid varchar(50) NOT NULL default '0',
to_userid varchar(50) NOT NULL default '0',
text text NOT NULL,
systemtext text NOT NULL,
timestamp datetime NOT NULL default '0000-00-00 00:00:00',
chatroom bigint(20) NOT NULL default '0',
PRIMARY KEY (id),
KEY from_userid (from_userid),
FULLTEXT KEY from_userid_2 (from_userid),
KEY chatroom (chatroom),
KEY timestamp (timestamp)
) ENGINE=MyISAM;
回答by nobuhiroharada
From official reference
来自官方参考
Full-text indexes can be used only with MyISAM tables. (In MySQL 5.6 and up, they can also be used with InnoDB tables.) Full-text indexes can be created only for CHAR, VARCHAR, or TEXT columns.
全文索引只能用于 MyISAM 表。(在 MySQL 5.6 及更高版本中,它们也可以与 InnoDB 表一起使用。)只能为 CHAR、VARCHAR 或 TEXT 列创建全文索引。
https://dev.mysql.com/doc/refman/5.5/en/fulltext-search.html
https://dev.mysql.com/doc/refman/5.5/en/fulltext-search.html
InnoDB with MySQL 5.5 does not support Full-text indexes.
带有 MySQL 5.5 的 InnoDB 不支持全文索引。
回答by Tilahun Mamuye Gidey
Simply do the following:
只需执行以下操作:
Open your .sql file with Notepad or Notepad ++
Find InnoDB and Replace all (around 87) with MyISAM
Save and now you can import your database with out error.
用记事本或记事本++打开你的.sql文件
找到 InnoDB 并用 MyISAM 替换所有(大约 87 个)
保存,现在您可以导入数据库而不会出错。
回答by Chandan Kumar
*************Resolved - #1214 - The used table type doesn't support FULLTEXT indexes***************
*************已解决 - #1214 - 使用的表类型不支持 FULLTEXT 索引***************
Its Very Simple to resolve this issue. People are answering here in very difficult words which are not easily understandable by the people who are not technical.
解决这个问题非常简单。人们在这里用非常困难的词来回答,这些词对于非技术人员来说是不容易理解的。
So i am mentioning here steps in very simple words will resolve your issue.
所以我在这里用非常简单的话提到步骤将解决您的问题。
1.) Open your .sql file with Notepad by right clicking on file>Edit Or Simply open a Notepad file and drag and drop the file on Notepad and the file will be opened. (Note: Please don't change the extention .sql of file as its still your sql database. Also to keep a copy of your sql file to save yourself from any mishappening)
1.) 用记事本打开您的 .sql 文件,方法是右键单击文件>编辑或简单地打开记事本文件并将文件拖放到记事本上,该文件将被打开。(注意:请不要更改文件的扩展名 .sql,因为它仍然是您的 sql 数据库。还要保留您的 sql 文件的副本,以免发生任何意外)
2.) Click on Notepad Menu Edit > Replace (A Window will be pop us with Find What & Replace With Fields)
2.) 单击记事本菜单编辑 > 替换(将弹出一个窗口,其中包含查找内容并替换为字段)
3.) In Find What Field Enter ENGINE=InnoDB& In Replace With Field Enter ENGINE=MyISAM
3.) 在查找什么字段中输入ENGINE=InnoDB& 在替换字段中输入ENGINE=MyISAM
4.) Now Click on Replace AllButton
4.) 现在点击全部替换按钮
5.) Click CTRL+Sor File>Save
5.) 单击CTRL+S或文件>保存
6.) Now Upload This File and I am Sure your issue will be resolved....
6.) 现在上传这个文件,我相信你的问题会得到解决....