Search code examples
mysqldatabasefull-text-search

MySQL error when altering table to Fulltext


I get an error #1283 - Column 'title' cannot be part of FULLTEXT index when I try to include the columns I want to alter via FULLTEXT in my database.

ALTER TABLE users ADD FULLTEXT (`firstname`, `lastname`, `title`, `description`)

I'm not understanding why this error shows or how to go about in fixing this problem. Would be grateful for any ideas or tips.


Solution

  • NOTE: This post applies to old version of MySQL. Starting from version 5.6, INNODB supports FULLTEXT index and the below code should not be used. Leaving the original answer for reference.

    FULLTEXT index works only on MyISAM tables, not on InnoDB. You can check what storage enging you use by typing:

    SHOW CREATE TABLE users;
    

    then, you could ALTER the table to use MyISAM engine using this command:

    ALTER TABLE users ENGINE = MyISAM;