2012-04-16 86 views
0

我嘗試在數據庫中創建phpmyadmin中的新表時遇到問題。該代碼是:嘗試在XAMPP上創建mysql表時出錯

DROP TABLE IF EXISTS phpcrawler_links; 
CREATE TABLE phpcrawler_links (
    id   int(11) NOT NULL auto_increment, 
    site_id  int(11) NOT NULL default 0, 
    depth  int(11) NOT NULL default 0, 
    url   text NOT NULL, 
    url_title text, 
    url_md5  varchar(255) NOT NULL, 

    content  text NOT NULL, 
    content_md5 varchar(255) NOT NULL, 

    last_crawled datetime, 
    crawl_now int(11) NOT NULL default 1, 

    PRIMARY KEY (id), 
    KEY idx_site_id(site_id), 
    KEY idx_url (url(255)), 
    KEY idx_content_md5(content_md5), 
    FULLTEXT ft_content(content), 
    KEY idx_last_crawled(last_crawled) 
); 

DROP TABLE IF EXISTS words; 
CREATE TABLE words (
    id  int(11) NOT NULL, 
    word varchar(255) NOT NULL 
); 

這個問題似乎是在這條線:

last_crawled datetime, 

我得到的錯誤是:

#1214 - 所使用的表類型不支持FULLTEXT索引

如果任何人都可以幫助我,我會很高興!

回答

0

谷歌規則! 只有MyISAM表格支持全文索引。 http://forums.mysql.com/read.php?107,194405,194677

+0

好的。我能做些什麼來解決這個問題?我只需要一點幫助就可以找到解決方案。編輯:我只需在之前添加「ENGINE = MyISAM」;創建? – 2012-04-16 20:02:57

+0

對不起,延誤了。是的,你應該在CREATE TABLE ddl中提供ENGINE選項。在我給的網址中有一個例子。 – heximal 2012-04-17 06:11:48

+0

我解決了它。非常感謝你! – 2012-04-17 19:49:28

0

您不能添加索引到數據庫,如果表是Innodb的,你必須更改引擎在MyISAM或更改數據類型爲int

+0

我剛剛添加ENGINE = MyISAM「之前;在創建表,它的工作!感謝您的幫助! – 2012-04-16 20:35:38

0

似乎您使用的是舊版本的MySQL,是從MySQL 5.6,InnoDB已經支持全文索引。