Mysql Error 1005 Errno 121
Contents |
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies mysql error code 1005. can't create table (errno 150) of this site About Us Learn more about Stack Overflow the company
Sql Server Error 121
Business Learn more about hiring developers or posting ads with us Stack Overflow Questions Jobs Documentation Tags Users Badges errno 121 mysql Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is a community of 6.2 million programmers, just like you, helping each other. Join them; it only takes a minute: errno 121 linux Sign up ERROR: Error 1005: Can't create table (errno: 121) up vote 81 down vote favorite 21 Im having troubles with forward engineering my MySQL database into WAMP server.. I was going to post an image of the schema but as this is my first post i can't.. Below is the executed script.. use aquaticstar; SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0; SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0; SET
Mysql Error No 150
@OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='TRADITIONAL,ALLOW_INVALID_DATES'; -- ----------------------------------------------------- -- Table `Students` -- ----------------------------------------------------- DROP TABLE IF EXISTS `Students` ; CREATE TABLE IF NOT EXISTS `Students` ( `id` VARCHAR(10) NOT NULL , `studentName` VARCHAR(45) NOT NULL , `gender` CHAR NOT NULL , `birthDate` DATETIME NOT NULL , `mNo` VARCHAR(10) NOT NULL , `contactName` VARCHAR(45) NOT NULL , `contactEmail` VARCHAR(45) NOT NULL , `contactPhone` INT(10) NOT NULL , `startDate` DATETIME NOT NULL , `remarks` VARCHAR(200) NULL , PRIMARY KEY (`id`) ) ENGINE = InnoDB; -- ----------------------------------------------------- -- Table `Waiting List` -- ----------------------------------------------------- DROP TABLE IF EXISTS `Waiting List` ; CREATE TABLE IF NOT EXISTS `Waiting List` ( `wait_id` VARCHAR(5) NOT NULL , `name` VARCHAR(45) NULL , `contactName` VARCHAR(45) NULL , `contactPhone` INT(10) NULL , `contactEmail` VARCHAR(45) NULL , `status` CHAR NULL , `remarks` VARCHAR(200) NULL , PRIMARY KEY (`wait_id`) ) ENGINE = InnoDB; -- ----------------------------------------------------- -- Table `Schedule` -- ----------------------------------------------------- DROP TABLE IF EXISTS `Schedule` ; CREATE TABLE IF NOT EXISTS `Schedule` ( `lesson_id` VARCHAR(10) NOT NULL , `day` VARCHAR(3) NOT NULL , `branch` VARCHAR(30) NOT NULL , `level` VARCHAR(30) NOT NULL , `time` TIME NOT NULL , `ae` VARCHAR(45) NOT
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies of mysql rename constraint this site About Us Learn more about Stack Overflow the company Business mysql error 150 Learn more about hiring developers or posting ads with us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask
Error 1005 Can T Create Table
Question x Dismiss Join the Stack Overflow Community Stack Overflow is a community of 6.2 million programmers, just like you, helping each other. Join them; it only takes a minute: Sign http://stackoverflow.com/questions/12623651/error-error-1005-cant-create-table-errno-121 up SQL : ERROR 1005: Can't create table 'obl2.itemsubjects' (errno: 121) up vote 5 down vote favorite 1 I have the following tables: CREATE TABLE `OBL2`.`item` ( `itemID` INT NOT NULL AUTO_INCREMENT , `itemName` VARCHAR(45) NOT NULL , PRIMARY KEY (`itemID`) , INDEX `itemName` (`itemName` ASC) ); CREATE TABLE `OBL2`.`subject` ( `subjectID` INT NOT NULL , `subjectName` VARCHAR(45) NOT NULL , PRIMARY KEY http://stackoverflow.com/questions/14294561/sql-error-1005-cant-create-table-obl2-itemsubjects-errno-121 (`subjectID`) ); now since the connection is many to many . each item can have many subject and each subject can be related to many items - i'd like to set a connection table. this is my code: CREATE TABLE `OBL2`.`itemsubjects` ( `itemID` INT NOT NULL , `subjectID` INT NOT NULL , PRIMARY KEY (`itemID`, `subjectID`) , INDEX `itemID_idx` (`itemID` ASC) , INDEX `subjectID_idx` (`subjectID` ASC) , CONSTRAINT `itemID` FOREIGN KEY (`itemID` ) REFERENCES `OBL2`.`item` (`itemID` ) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `subjectID` FOREIGN KEY (`subjectID` ) REFERENCES `OBL2`.`subject` (`subjectID` ) ON DELETE CASCADE ON UPDATE CASCADE); but for some reason the code of the 3rd table is not being accepted. i get an error msg: ERROR 1005: Can't create table 'obl2.itemsubjects' (errno: 121) i've read about the error on the internet and it says it's a known issue of MYSQL yet there are no solutions. any thoughts? mysql sql table database-design create-table share|improve this question edited Jan 12 '13 at 15:14 Saharsh Shah 21.4k52356 asked Jan 12 '13 at 15:01 ronn jack 7639 Can you try to insert some data to
perror 121 says this? MySQL error code 121: Duplicate key on write or update Really confused how you might get a duplicate key error while creating a table? If the table you're trying to create includes a foreign http://thenoyes.com/littlenoise/?p=81 key constraint, and you've provided your own name for that constraint, remember that it must be unique within the database. Run this query to see if that name is in use somewhere: SELECT constraint_name, table_name FROM information_schema.table_constraints WHERE constraint_type = 'FOREIGN KEY' AND table_schema = DATABASE() ORDER BY constraint_name; (If you're still on 4.1 or earlier, mysqldump --no-data yourDbName | grep CONSTRAINT to get a similar list) Thanks to [raymond] on Freenode. Share this:TweetMoreShare mysql error on TumblrPocket Filed under: MySQL FAQ Leave a comment Comments (14) Trackbacks (3) ( subscribe to comments on this post ) Álvaro G. VicarioApril 27th, 2010 - 11:20 In my case, it was an ALTER TABLE … ADD CONSTRAINT query and the name was in use by an index. JamesAugust 11th, 2010 - 12:48 Thank you very much. Worked like a charm. ArtemAugust 23rd, 2010 - 10:36 Thanks a lot! SenthilSeptember 4th, 2010 - t create table 07:25 Great !! It worked. DUSMANTA SAHOONovember 20th, 2012 - 01:35 Thank you so much!!!! It worked ChandrababuDecember 1st, 2012 - 02:51 Thanks for post solution for ErrorNo:121, now my DB successfully executed, once again thanks to u… Furkan ÇakmakDecember 4th, 2012 - 05:30 Thank you very much. I have been tried so many things last two hours and I have fixed errors thanks to your note. JoshDecember 13th, 2012 - 21:34 Amazing. Thank you! From San Diego, Josh Per OlesenJanuary 6th, 2013 - 08:15 Awesomeness your way. Thanks! AshtonApril 1st, 2013 - 18:48 Me and my professor have been searching for 2 weeks on how to fix this problem and finally someone pulled through! -Thanks!! meApril 12th, 2013 - 02:08 You sir just saved my day. Thank you! VishaFebruary 5th, 2015 - 05:19 Worked WaqasApril 20th, 2015 - 00:12 Thank you Sir! cyreneFebruary 2nd, 2016 - 15:51 i think its poor that mySQL does not give a hint or a better error message regarding this. Leave a comment Cancel reply Name (required) Email (required) Website Notify me of follow-up comments by email. Notify me of new posts by email. Error creating foreign key from MySQL Workbench | CL-UAT Error creating foreign key from MySQL Workbench | XL-UAT MySQL -- Can't create table (errno: 121) -- Small Coder Blog Flour Po