MySQL Forums
Forum List  »  MySQL Workbench

Re: InnoDB error with FKs
Posted by: Ricardo Umans
Date: November 28, 2012 10:07AM

Oh sorry I thought maybe you guys would know it without the code :P

Anyways:
ERROR 1005: Can't create table 'pwsregistrationdev.#sql-8f8_1' (errno: 121)

SQL Statement:

ALTER TABLE `pwsregistrationdev`.`inventory`

ADD CONSTRAINT `user_id`

FOREIGN KEY (`user_id` )

REFERENCES `pwsregistrationdev`.`user` (`user_id` )

ON DELETE NO ACTION

ON UPDATE NO ACTION

, ADD INDEX `user_id_idx` (`user_id` ASC)



This is the one made for altering the table
---------------------------------



This one is when creating a table ->

ERROR 1005: Can't create table 'pwsregistrationdev.inventory2' (errno: 121)

SQL Statement:

CREATE TABLE `pwsregistrationdev`.`inventory2` (

`inventory2_id` INT NOT NULL AUTO_INCREMENT ,

`user_id` INT NOT NULL ,

PRIMARY KEY (`inventory2_id`) ,

UNIQUE INDEX `inventory2_id_UNIQUE` (`inventory2_id` ASC) ,

INDEX `user_id_idx` (`user_id` ASC) ,

CONSTRAINT `user_id`

FOREIGN KEY (`user_id` )

REFERENCES `pwsregistrationdev`.`user` (`user_id` )

ON DELETE NO ACTION

ON UPDATE NO ACTION)

ENGINE = InnoDB





Only then with less fields as this is a replica of the problem.

Options: ReplyQuote


Subject
Views
Written By
Posted
1265
November 27, 2012 09:29AM
576
November 28, 2012 08:42AM
Re: InnoDB error with FKs
739
November 28, 2012 10:07AM
608
November 28, 2012 11:02AM
712
November 28, 2012 11:22AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.