我目前正試圖用正向工程嚮導MySQL工作臺的創建我的數據庫,但我得到這個錯誤:MySQL的正向工程 - SQL給錯誤121
Executing SQL script in server
ERROR: Error 1005: Can't create table 'microweb.users' (errno: 121)
CREATE TABLE IF NOT EXISTS `microweb`.`users` (
`user_id` INT UNSIGNED NOT NULL AUTO_INCREMENT ,
`role_id` INT UNSIGNED NOT NULL ,
`username` VARCHAR(45) NOT NULL ,
`password` VARCHAR(45) NOT NULL ,
`email` VARCHAR(45) NOT NULL ,
`salt` VARCHAR(45) NOT NULL ,
`first_name` VARCHAR(45) NOT NULL ,
`middle_name` VARCHAR(45) NULL ,
`last_name` VARCHAR(45) NOT NULL ,
`address_id` INT UNSIGNED NULL ,
`registration_id` INT UNSIGNED NOT NULL ,
`active` TINYINT(1) NOT NULL ,
`banned` TINYINT(1) NOT NULL ,
PRIMARY KEY (`user_id`) ,
UNIQUE INDEX `user_id_UNIQUE` (`user_id` ASC) ,
UNIQUE INDEX `username_UNIQUE` (`username` ASC) ,
UNIQUE INDEX `email_UNIQUE` (`email` ASC) ,
UNIQUE INDEX `registration_id_UNIQUE` (`registration_id` ASC) ,
CONSTRAINT `fk_user_role`
FOREIGN KEY (`role_id`)
REFERENCES `microweb`.`roles` (`role_id`)
ON DELETE CASCADE
ON UPDATE CASCADE,
CONSTRAINT `fk_user_registration`
FOREIGN KEY (`registration_id`)
REFERENCES `microweb`.`registrations` (`registration_id`)
ON DELETE CASCADE
ON UPDATE CASCADE)
ENGINE = InnoDB
SQL script execution finished: statements: 10 succeeded, 1 failed
完整的腳本中含有大量的外鍵和21個表。問題是執行後,當Workbench說10次成功時,phpMyAdmin中只有2個。
如果有人需要完整的模型,請告訴我。
哪個版本的MySQL Workbench是這樣的?你在使用最新的嗎? – 2013-03-15 08:36:06
@MikeLischke是的,我在4天前安裝了它。 – 2013-03-15 08:44:03