Mysql Error Error 1005 Errno 121
Contents |
here for a quick overview of the site Help Center
Mysql Can't Create Table Errno 121
Detailed answers to any questions you might have Meta mysql error code 1005. can't create table (errno 150) Discuss the workings and policies of this site About Us Learn more about Stack Overflow sql server error 121 the company Business Learn more about hiring developers or posting ads with us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question
Errno 121 Mysql
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 up ERROR: Error 1005: Can't create table (errno: 121) up vote 81 down vote favorite 21 Im having
Errno 121 Linux
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 @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
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 this site About Us Learn more mysql error no 150 about Stack Overflow the company Business Learn more about hiring developers or posting ads
Mysql Rename Constraint
with us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow mysql error 1005 is a community of 6.2 million programmers, just like you, helping each other. Join them; it only takes a minute: Sign up SQL - error code 1005 with error number 121 up vote 12 down http://stackoverflow.com/questions/12623651/error-error-1005-cant-create-table-errno-121 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. What is the problem here? -- ----------------------------------------------------- -- Table `regula`.`Users` -- ----------------------------------------------------- DROP TABLE IF EXISTS `regula`.`Users` ; CREATE TABLE IF NOT EXISTS `regula`.`Users` ( http://stackoverflow.com/questions/4412693/sql-error-code-1005-with-error-number-121 `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 , `prjId` INT UNSIGNED NOT NULL , `parentId` INT UNSIGNED NULL DEFAULT NULL , `name` TEXT NOT NULL , PRIMARY KEY (`idItemTypes`) , INDEX `prjId` (`prjId` ASC) , INDEX `parentId` (`parentId` ASC) , CONSTRAINT `prjId` FOREIGN KEY (`prjId` ) REFERENCES `regula`.`Projects` (`idProjects` ) ON DELETE NO ACTION ON UPDATE NO ACTION, CONSTRAINT `paren
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 this site About Us http://stackoverflow.com/questions/19980058/magento-1005-cant-create-table-errno-121-error Learn more about Stack Overflow the company Business Learn more about hiring developers http://board.phpbuilder.com/showthread.php?10359413-RESOLVED-mysql-error-1005-errno-121-when-trying-to-set-a-foreign-key or posting ads with us Stack Overflow Questions Jobs Documentation Tags Users Badges 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: Sign up Magento #1005 - Can't create table '…' (errno: mysql error 121) ERROR up vote 1 down vote favorite I had an issue with my magento website, now the the site is down. but I have my db backup. but when I import the db , it gives me this error: #1005 - Can't create table '' (errno: 121); for this query: ALTER TABLE `admin_rule` ADD CONSTRAINT FK_ADMIN_RULE_ROLE_ID_ADMIN_ROLE_ROLE_ID` FOREIGN KEY (`role_id`) REFERENCES `admin_role` (`role_id`) ON DELETE CASCADE ON can't create table UPDATE CASCADE; This error is coming for all the alter commands. this is one example I'm showing u Here is the table structure of admin_rule CREATE TABLE IF NOT EXISTS `admin_rule` ( `rule_id` int(10) unsigned NOT NULL AUTO_INCREMENT COMMENT 'Rule ID', `role_id` int(10) unsigned NOT NULL DEFAULT '0' COMMENT 'Role ID', `resource_id` varchar(255) NOT NULL COMMENT 'Resource ID', `privileges` varchar(20) DEFAULT NULL COMMENT 'Privileges', `assert_id` int(10) unsigned NOT NULL DEFAULT '0' COMMENT 'Assert ID', `role_type` varchar(1) DEFAULT NULL COMMENT 'Role Type', `permission` varchar(10) DEFAULT NULL COMMENT 'Permission', PRIMARY KEY (`rule_id`), KEY `IDX_ADMIN_RULE_RESOURCE_ID_ROLE_ID` (`resource_id`,`role_id`), KEY `IDX_ADMIN_RULE_ROLE_ID_RESOURCE_ID` (`role_id`,`resource_id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='Admin Rule Table' AUTO_INCREMENT=2 ; mysql magento share|improve this question edited Nov 14 '13 at 14:24 Dariusz 11.8k42265 asked Nov 14 '13 at 14:19 user2606912 1116 It might be that you are referencing a table which is not yet created. –Mihai Nov 14 '13 at 14:25 table is present Mihai –user2606912 Nov 14 '13 at 14:25 add a comment| 1 Answer 1 active oldest votes up vote 0 down vote Make sure the table admin_role exists and has a column named role_id that is primary key on that table and has the same exact ty
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 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 #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 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 |