Error 1005 Sql 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 1005 can't create table (errno 121) of this site About Us Learn more about Stack Overflow the company
Error 1005 Can't Create Table (errno 121)
Business Learn more about hiring developers or posting ads with us Stack Overflow Questions Jobs Documentation Tags Users Badges
Error 1005 Can't Create Table (errno 150)
Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is a community of 4.7 million programmers, just like you, helping each other. Join them; it only takes a
General Error 1005 Can't Create Table (errno 121)
minute: 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; error 1005 (hy000) at line can't create table (errno 150) SET @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 , `a
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and error 1005 (hy000) errno 121 policies of this site About Us Learn more about Stack Overflow the mysql errno 121 can't create table company Business Learn more about hiring developers or posting ads with us Stack Overflow Questions Jobs Documentation Tags #1005 - can't create table (errno 150) Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is a community of 4.7 million programmers, just like you, helping each other. Join them; it only takes http://stackoverflow.com/questions/12623651/error-error-1005-cant-create-table-errno-121 a minute: Sign up SQL - error code 1005 with error number 121 up vote 12 down vote favorite 4 I'm running the following MySQL script (trimmed down), generated automatically by MySQL Workbench and I get the following error: Error Code: 1005 Can't create table 'regula.reservation' (errno: 121) I'm not very proficient with databases and this error is not very informative. http://stackoverflow.com/questions/4412693/sql-error-code-1005-with-error-number-121 What is the problem here? -- ----------------------------------------------------- -- Table `regula`.`Users` -- ----------------------------------------------------- DROP TABLE IF EXISTS `regula`.`Users` ; CREATE TABLE IF NOT EXISTS `regula`.`Users` ( `idUsers` INT UNSIGNED NOT NULL AUTO_INCREMENT , `name` TEXT NOT NULL , `type` TEXT NOT NULL , `pwd` TEXT NOT NULL , PRIMARY KEY (`idUsers`) , UNIQUE INDEX `idUsers_UNIQUE` (`idUsers` ASC) ) ENGINE = InnoDB; -- ----------------------------------------------------- -- Table `regula`.`Projects` -- ----------------------------------------------------- DROP TABLE IF EXISTS `regula`.`Projects` ; CREATE TABLE IF NOT EXISTS `regula`.`Projects` ( `idProjects` INT UNSIGNED NOT NULL AUTO_INCREMENT , `ownerId` INT UNSIGNED NOT NULL , `name` TEXT NOT NULL , `date` DATE NOT NULL , `time` TIME NOT NULL , `place` TEXT NOT NULL , `itemType` INT NOT NULL , PRIMARY KEY (`idProjects`) , UNIQUE INDEX `idProjects_UNIQUE` (`idProjects` ASC) , INDEX `ownerId` (`ownerId` ASC) , CONSTRAINT `ownerId` FOREIGN KEY (`ownerId` ) REFERENCES `regula`.`Users` (`idUsers` ) ON DELETE NO ACTION ON UPDATE NO ACTION) ENGINE = InnoDB; -- ----------------------------------------------------- -- Table `regula`.`ItemTypes` -- ----------------------------------------------------- DROP TABLE IF EXISTS `regula`.`ItemTypes` ; CREATE TABLE IF NOT EXISTS `regula`.`ItemTypes` ( `idItemTypes` INT UNSIGNED NOT NULL , `p
set a foreign key If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register http://board.phpbuilder.com/showthread.php?10359413-RESOLVED-mysql-error-1005-errno-121-when-trying-to-set-a-foreign-key link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. Results 1 to 9 of 9 Thread: [RESOLVED] mysql error 1005 errno 121 when trying to set a foreign key Tweet Thread Tools Show Printable Version Email this Page… Subscribe to this Thread… Search Thread Advanced Search Display Linear Mode Switch to Hybrid Mode Switch to Threaded Mode 09-27-2008,01:32 PM error 1005 #1 s0me0ne View Profile View Forum Posts Senior Member Join Date May 2003 Posts 121 [RESOLVED] mysql error 1005 errno 121 when trying to set a foreign key I'm trying to setup a table that has 2 foreign keys. I was able to set host_id as a Foreign Key, but I cannot get site_id to be a foreign key in the table SITES_HOSTS. I get mysql error 1005 errno 121 I'm can't create table using the MySQL Query Browser when I'm doing this, because I'm not good enough to use the command line, but the app shows me its doing this ALTER TABLE `db_special`.`sites_hosts` ADD CONSTRAINT `site_id` FOREIGN KEY `site_id` (`site_id`) REFERENCES `sites` (`id`) ON DELETE RESTRICT ON UPDATE RESTRICT; Here are my tables Code: SITES +-------------+---------------------+------+-----+---------------------+----------------+ | id | int(10) unsigned | NO | PRI | NULL | auto_increment | | title | varchar(100) | NO | | | | | description | longtext | YES | | NULL | | | url | varchar(150) | YES | | NULL | | | status | tinyint(3) unsigned | NO | | | | | pubdate | timestamp | NO | | CURRENT_TIMESTAMP | | | updated | timestamp | NO | | 0000-00-00 00:00:00 | | | subtitle | varchar(100) | YES | | NULL | | | sitetype_id | int(10) unsigned | NO | MUL | | | +-------------+---------------------+------+-----+---------------------+----------------+ HOSTS +---------+---------------------+------+-----+-------------------+----------------+ | Field | Type | Null | Key | Default | Extra | +---------+---------------------+------+-----+-------------------+----------------+ | id | int(10) unsigned | NO | PRI | NULL | auto_increment | | title | varchar(100) | NO | | | | | status | tinyint(3) unsigned | NO | | | | | pubdate