我在mysql上獲得另一個errno 150。我已經看過表引擎,列類型,但沒有運氣,在我看來它沒有錯。無法在Mysql上創建表errno:150
這次我會出錯嗎?
我在創建與image_tag和tag_lang相關的標記表時出錯。對於MySQL錯誤150顯示
-- -----------------------------------------------------
-- Table `ratna`.`image_tag`
-- -----------------------------------------------------
DROP TABLE IF EXISTS `ratna`.`image_tag` ;
CREATE TABLE IF NOT EXISTS `ratna`.`image_tag` (
`id` INT(11) NOT NULL ,
`tag` INT(11) NOT NULL ,
PRIMARY KEY (`id`, `tag`) ,
INDEX `image_fk` (`id` ASC) ,
CONSTRAINT `image_fk`
FOREIGN KEY (`id`)
REFERENCES `ratna`.`image` (`id`)
ON DELETE CASCADE
ON UPDATE CASCADE)
ENGINE = InnoDB
DEFAULT CHARACTER SET = utf8;
-- -----------------------------------------------------
-- Table `ratna`.`tag_lang`
-- -----------------------------------------------------
DROP TABLE IF EXISTS `ratna`.`tag_lang` ;
CREATE TABLE IF NOT EXISTS `ratna`.`tag_lang` (
`id` INT(11) NOT NULL ,
`lang` INT(20) NOT NULL ,
`tag_desc` VARCHAR(200) CHARACTER SET 'utf8' COLLATE 'utf8_unicode_ci' NOT NULL ,
PRIMARY KEY (`id`, `lang`))
ENGINE = InnoDB
DEFAULT CHARACTER SET = utf8
COLLATE = utf8_general_ci;
-- -----------------------------------------------------
-- Table `ratna`.`tag`
-- -----------------------------------------------------
DROP TABLE IF EXISTS `ratna`.`tag` ;
CREATE TABLE IF NOT EXISTS `ratna`.`tag` (
`id` INT(11) NOT NULL AUTO_INCREMENT ,
`name` VARCHAR(50) CHARACTER SET 'utf8' COLLATE 'utf8_unicode_ci' NOT NULL ,
`seq` INT(11) NOT NULL ,
PRIMARY KEY (`id`) ,
INDEX `image_tag_fk` (`id` ASC) ,
INDEX `tag_lang` (`id` ASC) ,
CONSTRAINT `image_tag_fk`
FOREIGN KEY (`id`)
REFERENCES `ratna`.`image_tag` (`tag`)
ON DELETE CASCADE
ON UPDATE CASCADE,
CONSTRAINT `tag_lang`
FOREIGN KEY (`id`)
REFERENCES `ratna`.`tag_lang` (`id`)
ON DELETE CASCADE
ON UPDATE CASCADE)
ENGINE = InnoDB
AUTO_INCREMENT = 13
DEFAULT CHARACTER SET = utf8
COLLATE = utf8_general_ci;
哪個MySQL版本? – Phil 2012-03-04 03:17:25
mysql版本:5.1.41 – 2012-03-04 03:21:03