[英]Error 1064 when forward engineering a ER diagram in mysql workbench
我正在嘗試在Workbench中正向工程化ER圖以創建架構,但出現錯誤。 我正在為Mac使用mySql Workbench。
這是我收到的錯誤消息:
Executing SQL script in server
ERROR: Error 1064: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '
INDEX `city_id_fk_idx` (`city_id` ASC) VISIBLE,
INDEX `county_id_idx` (`cou' at line 13
SQL Code:
-- -----------------------------------------------------
-- Table `k00243666_property_bubble`.`addresses`
-- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS `k00243666_property_bubble`.`addresses` (
`address_id` INT NOT NULL AUTO_INCREMENT,
`address1` VARCHAR(45) NULL,
`address2` VARCHAR(45) NULL,
`eircode` VARCHAR(7) NULL,
`town_id` INT NULL,
`city_id` INT NULL,
`county_id` INT NULL,
PRIMARY KEY (`address_id`),
INDEX `town_id_fk_idx` (`town_id` ASC) VISIBLE,
INDEX `city_id_fk_idx` (`city_id` ASC) VISIBLE,
INDEX `county_id_idx` (`county_id` ASC) VISIBLE,
CONSTRAINT `town_id_fk`
FOREIGN KEY (`town_id`)
REFERENCES `k00243666_property_bubble`.`town` (`town_id`)
ON DELETE NO ACTION
ON UPDATE CASCADE,
CONSTRAINT `city_id_fk`
FOREIGN KEY (`city_id`)
REFERENCES `k00243666_property_bubble`.`city` (`city_id`)
ON DELETE NO ACTION
ON UPDATE CASCADE,
CONSTRAINT `county_id`
FOREIGN KEY (`county_id`)
REFERENCES `k00243666_property_bubble`.`county` (`county_id`)
ON DELETE NO ACTION
ON UPDATE CASCADE)
ENGINE = InnoDB
SQL script execution finished: statements: 5 succeeded, 1 failed
Fetching back view definitions in final form.
Nothing to fetch
有誰知道為什么我會收到此錯誤?
我的猜測是,您的MariaDB版本不支持應用於索引定義的VISIBLE
或INVISIBLE
。 無論如何,默認情況下索引應該是可見的,因此甚至不需要指定VISIBLE
。 嘗試使用以下語法:
INDEX town_id_fk_idx (town_id),
INDEX city_id_fk_idx (city_id),
INDEX county_id_idx (county_id)
這是指向 MariaDB的功能請求的鏈接 。 沒有用於關閉優化器索引的INVISIBLE
語法。 但是,它提供了一種替代方法:
ALTER TABLE addresses DISABLE KEYS;
這將使優化器看不到所有索引。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.