【问题标题】:Incorrect usage of spatial/fulltext/hash index and explicit index order on MySQL 8.0.11MySQL 8.0.11 上空间/全文/哈希索引和显式索引顺序的错误使用
【发布时间】:2018-10-01 09:39:29
【问题描述】:

我在 MySQL Workbench 6.3.10 上运行 sakila_full.mwb 的 Forward Engineer。 MySQL 服务器版本为 8.0.11。

    -- -----------------------------------------------------
    -- Table `sakila`.`film_text`
    -- -----------------------------------------------------
    CREATE TABLE IF NOT EXISTS `sakila`.`film_text` (
      `film_id` SMALLINT UNSIGNED NOT NULL,
      `title` VARCHAR(255) NOT NULL,
      `description` TEXT NULL,
      PRIMARY KEY (`film_id`),
      FULLTEXT INDEX `idx_title_description` (`title` ASC, `description` ASC))
    ENGINE = InnoDB

我收到以下错误。

ERROR: Error 1221: Incorrect usage of spatial/fulltext/hash index and explicit index order

为什么?

更新1

我尝试了全文索引仅适用于 TEXT 类型的列。按照此操作。

    -- -----------------------------------------------------
    -- Table `sakila`.`film_text`
    -- -----------------------------------------------------
    CREATE TABLE IF NOT EXISTS `sakila`.`film_text` (
      `film_id` SMALLINT UNSIGNED NOT NULL,
      `title` VARCHAR(255) NOT NULL,
      `description` TEXT NULL,
      PRIMARY KEY (`film_id`),
      FULLTEXT INDEX `idx_title_description` (`description` ASC))
    ENGINE = InnoDB

但我遇到了同样的错误。

Error Code: 1221. Incorrect usage of spatial/fulltext/hash index and explicit index order

【问题讨论】:

  • 您在 FULLTEXT 索引中指定了一个 VARCHAR 和 TEXT 列。全文索引仅适用于 TEXT 类型的列。
  • 对不起,我不知道。

标签: mysql mysql-workbench


【解决方案1】:

这已经自我解决了。 我删除了 ASC。

    -- -----------------------------------------------------
    -- Table `sakila`.`film_text`
    -- -----------------------------------------------------
    CREATE TABLE IF NOT EXISTS `sakila`.`film_text` (
      `film_id` SMALLINT UNSIGNED NOT NULL,
      `title` VARCHAR(255) NOT NULL,
      `description` TEXT NULL,
      PRIMARY KEY (`film_id`),
      FULLTEXT INDEX `idx_title_description` (`title`, `description`))
    ENGINE = InnoDB

谢谢。

更新1

MySQL Workbench 8.0.11 已修复。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2018-10-10
    • 2018-12-10
    • 2023-03-29
    • 2018-11-04
    • 1970-01-01
    • 2010-11-18
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多