Hello,
I am new to MySQL and I am running into errno 121, which after looking at the forums can have several possibilities.
I am using MySQL Workbench and I am receiving the errors as I try to Forward Engineer my database. I have been checking my tables, and I have not found any non-unique names, which is a common cause, and I am suspicious that it has to do with my foreign keys, but I cannot find a solution. I have set up a simple Dates table that I want to reference into any place where I need a date. In this table I need two different dates, a start and end date, so I have two foreign keys, one for start and one for end.
As a test, I tried deleting the end date, and I got the same error, only this time there was only a single foreign key, and I received the same error. Any help would be greatly appreciated, below is the message log from MySQL workbench:
Thanks in advance,
James
Executing SQL script in server
ERROR: Error 1005: Can't create table 'production_db.stage' (errno: 121)
-- -----------------------------------------------------
-- Table `Production_DB`.`Stage`
-- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS `Production_DB`.`Stage` (
`id` INT NOT NULL ,
`name` VARCHAR(45) NOT NULL ,
`description` MEDIUMTEXT NOT NULL ,
`status_id` INT NOT NULL ,
`date_start` INT NOT NULL ,
`date_end` INT NOT NULL ,
PRIMARY KEY (`id`) ,
INDEX `fk_status_id` (`status_id` ASC) ,
INDEX `fk_dateStart_id` (`date_start` ASC) ,
INDEX `fk_dateEnd_id` (`date_end` ASC) ,
UNIQUE INDEX `Stage_ID_UNIQUE` (`id` ASC) ,
CONSTRAINT `fk_status_id`
FOREIGN KEY (`status_id` )
REFERENCES `Production_DB`.`Status` (`id` )
ON DELETE NO ACTION
ON UPDATE NO ACTION,
CONSTRAINT `fk_dateStart_id`
FOREIGN KEY (`date_start` )
REFERENCES `Production_DB`.`Date` (`id` )
ON DELETE NO ACTION
ON UPDATE NO ACTION,
CONSTRAINT `fk_dateEnd_id`
FOREIGN KEY (`date_end` )
REFERENCES `Production_DB`.`Date` (`id` )
ON DELETE NO ACTION
ON UPDATE NO ACTION)
ENGINE = InnoDB
SQL script execution finished: statements: 8 succeeded, 1 failed
I am new to MySQL and I am running into errno 121, which after looking at the forums can have several possibilities.
I am using MySQL Workbench and I am receiving the errors as I try to Forward Engineer my database. I have been checking my tables, and I have not found any non-unique names, which is a common cause, and I am suspicious that it has to do with my foreign keys, but I cannot find a solution. I have set up a simple Dates table that I want to reference into any place where I need a date. In this table I need two different dates, a start and end date, so I have two foreign keys, one for start and one for end.
As a test, I tried deleting the end date, and I got the same error, only this time there was only a single foreign key, and I received the same error. Any help would be greatly appreciated, below is the message log from MySQL workbench:
Thanks in advance,
James
Executing SQL script in server
ERROR: Error 1005: Can't create table 'production_db.stage' (errno: 121)
-- -----------------------------------------------------
-- Table `Production_DB`.`Stage`
-- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS `Production_DB`.`Stage` (
`id` INT NOT NULL ,
`name` VARCHAR(45) NOT NULL ,
`description` MEDIUMTEXT NOT NULL ,
`status_id` INT NOT NULL ,
`date_start` INT NOT NULL ,
`date_end` INT NOT NULL ,
PRIMARY KEY (`id`) ,
INDEX `fk_status_id` (`status_id` ASC) ,
INDEX `fk_dateStart_id` (`date_start` ASC) ,
INDEX `fk_dateEnd_id` (`date_end` ASC) ,
UNIQUE INDEX `Stage_ID_UNIQUE` (`id` ASC) ,
CONSTRAINT `fk_status_id`
FOREIGN KEY (`status_id` )
REFERENCES `Production_DB`.`Status` (`id` )
ON DELETE NO ACTION
ON UPDATE NO ACTION,
CONSTRAINT `fk_dateStart_id`
FOREIGN KEY (`date_start` )
REFERENCES `Production_DB`.`Date` (`id` )
ON DELETE NO ACTION
ON UPDATE NO ACTION,
CONSTRAINT `fk_dateEnd_id`
FOREIGN KEY (`date_end` )
REFERENCES `Production_DB`.`Date` (`id` )
ON DELETE NO ACTION
ON UPDATE NO ACTION)
ENGINE = InnoDB
SQL script execution finished: statements: 8 succeeded, 1 failed