title: phpMyAdmin cannot create table
body: <p>I need to create a database for a school project but it is not working.  Each time I import the following into the database I get a cannot create table error at <code>group_rights</code>.  I've tried all kinds of things.  I tried to run the sql one command at a time but then it crashes on more tables.  </p>
  
  <p>What am I doing wrong?</p>
  
  <pre><code>    -- MySQL Script generated by MySQL Workbench
  -- 03/31/15 15:50:41
  -- Model: New Model    Version: 1.0
  -- MySQL Workbench Forward Engineering
  
  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';
  
  -- -----------------------------------------------------
  -- Schema kevineb144_yii1
  -- -----------------------------------------------------
  
  -- -----------------------------------------------------
  -- Schema kevineb144_yii1
  -- -----------------------------------------------------
  CREATE SCHEMA IF NOT EXISTS `kevineb144_yii1` DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci ;
  USE `kevineb144_yii1` ;
  
  -- -----------------------------------------------------
  -- Table `kevineb144_yii1`.`user`
  -- -----------------------------------------------------
  CREATE TABLE IF NOT EXISTS `kevineb144_yii1`.`user` (
    `User_id` INT NOT NULL AUTO_INCREMENT,
    `Username` VARCHAR(45) NULL,
    `Password` VARCHAR(45) NULL,
    `First_name` VARCHAR(45) NULL,
    `Last_name` VARCHAR(45) NULL,
    `Day_Of_Birth` DATE NULL,
    `Address` VARCHAR(45) NULL,
    `Email_address` VARCHAR(45) NULL,
    `Phone_number` VARCHAR(45) NULL,
    PRIMARY KEY (`User_id`))
  ENGINE = InnoDB;
  
  
  -- -----------------------------------------------------
  -- Table `kevineb144_yii1`.`group`
  -- -----------------------------------------------------
  CREATE TABLE IF NOT EXISTS `kevineb144_yii1`.`group` (
    `Group_Id` INT NOT NULL,
    `Name` VARCHAR(45) NOT NULL,
    PRIMARY KEY (`Group_Id`))
  ENGINE = InnoDB;
  
  
  -- -----------------------------------------------------
  -- Table `kevineb144_yii1`.`user_group`
  -- -----------------------------------------------------
  CREATE TABLE IF NOT EXISTS `kevineb144_yii1`.`user_group` (
    `User_Id` INT NOT NULL,
    `Group_Id` INT NOT NULL,
    INDEX `User_Id_idx` (`User_Id` ASC),
    INDEX `Group_Id_idx` (`Group_Id` ASC))
  ENGINE = InnoDB;
  
  
  -- -----------------------------------------------------
  -- Table `kevineb144_yii1`.`rights`
  -- -----------------------------------------------------
  CREATE TABLE IF NOT EXISTS `kevineb144_yii1`.`rights` (
    `Rights_Id` INT NOT NULL,
    `Name` VARCHAR(45) NOT NULL,
    `Description` VARCHAR(45) NOT NULL,
    `Default_Value` VARCHAR(45) NOT NULL,
    PRIMARY KEY (`Rights_Id`))
  ENGINE = InnoDB;
  
  
  -- -----------------------------------------------------
  -- Table `kevineb144_yii1`.`group_rights`
  -- -----------------------------------------------------
  CREATE TABLE IF NOT EXISTS `kevineb144_yii1`.`group_rights` (
    `Group_Id` INT NOT NULL,
    `Rights_Id` INT NOT NULL,
    INDEX `Rights_Id_idx` (`Rights_Id` ASC))
  ENGINE = InnoDB;
  
  
  -- -----------------------------------------------------
  -- Table `kevineb144_yii1`.`category`
  -- -----------------------------------------------------
  CREATE TABLE IF NOT EXISTS `kevineb144_yii1`.`category` (
    `Category_id` INT NOT NULL AUTO_INCREMENT,
    `Name` VARCHAR(45) NOT NULL,
    PRIMARY KEY (`Category_id`))
  ENGINE = InnoDB;
  
  
  -- -----------------------------------------------------
  -- Table `kevineb144_yii1`.`factory`
  -- -----------------------------------------------------
  CREATE TABLE IF NOT EXISTS `kevineb144_yii1`.`factory` (
    `Factory_id` INT NOT NULL AUTO_INCREMENT,
    `Name` VARCHAR(45) NOT NULL,
    `Address` VARCHAR(45) NOT NULL,
    `Email` VARCHAR(45) NULL,
    `Phone_Number` VARCHAR(45) NOT NULL,
    PRIMARY KEY (`Factory_id`))
  ENGINE = InnoDB;
  
  
  -- -----------------------------------------------------
  -- Table `kevineb144_yii1`.`subcategory`
  -- -----------------------------------------------------
  CREATE TABLE IF NOT EXISTS `kevineb144_yii1`.`subcategory` (
    `Subcategory_id` INT NOT NULL AUTO_INCREMENT,
    `Category_id` INT NOT NULL,
    `Name` VARCHAR(45) NOT NULL,
    PRIMARY KEY (`Subcategory_id`),
    INDEX `Category_idx` (`Category_id` ASC))
  ENGINE = InnoDB;
  
  
  -- -----------------------------------------------------
  -- Table `kevineb144_yii1`.`product`
  -- -----------------------------------------------------
  CREATE TABLE IF NOT EXISTS `kevineb144_yii1`.`product` (
    `Product_id` INT NOT NULL AUTO_INCREMENT,
    `Category_id` INT NOT NULL,
    `Subcategory_id` INT NOT NULL,
    `Name` VARCHAR(45) NOT NULL,
    `Type` VARCHAR(45) NOT NULL,
    `Cost_Price` FLOAT NOT NULL,
    `Retail_price` FLOAT NOT NULL,
    `Factory_id` INT NOT NULL,
    PRIMARY KEY (`Product_id`),
    INDEX `Category_idx` (`Category_id` ASC, `Subcategory_id` ASC),
    INDEX `Factory_idx` (`Factory_id` ASC),
    INDEX `Subcategory_idx` (`Subcategory_id` ASC))
  ENGINE = InnoDB;
  
  
  -- -----------------------------------------------------
  -- Table `kevineb144_yii1`.`location`
  -- -----------------------------------------------------
  CREATE TABLE IF NOT EXISTS `kevineb144_yii1`.`location` (
    `Location_Id` INT NOT NULL AUTO_INCREMENT,
    `Name` VARCHAR(45) NOT NULL,
    `Address` VARCHAR(45) NOT NULL,
    `Phone_Number` VARCHAR(45) NOT NULL,
    PRIMARY KEY (`Location_Id`))
  ENGINE = InnoDB;
  
  
  -- -----------------------------------------------------
  -- Table `kevineb144_yii1`.`inventory`
  -- -----------------------------------------------------
  CREATE TABLE IF NOT EXISTS `kevineb144_yii1`.`inventory` (
    `Product_Id` INT NOT NULL,
    `Location_Id` INT NOT NULL,
    `Amount` INT NOT NULL,
    `Mutation` DATETIME NOT NULL,
    INDEX `Product_idx` (`Product_Id` ASC),
    INDEX `Location_idx` (`Location_Id` ASC))
  ENGINE = InnoDB;
  
  
  -- -----------------------------------------------------
  -- Table `kevineb144_yii1`.`order`
  -- -----------------------------------------------------
  CREATE TABLE IF NOT EXISTS `kevineb144_yii1`.`order` (
    `Order_Id` INT NOT NULL,
    `Order_date` DATETIME NOT NULL,
    `User_Id` INT NOT NULL,
    PRIMARY KEY (`Order_Id`),
    INDEX `User_Id_idx` (`User_Id` ASC))
  ENGINE = InnoDB;
  
  
  SET SQL_MODE=@OLD_SQL_MODE;
  SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS;
  SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS;
  </code></pre>
  
  <p>Sorry i forgot to post the error here it is:</p>
  
  <pre><code>-- -----------------------------------------------------
  -- Table `kevineb144_yii1`.`group_rights`
  -- -----------------------------------------------------
  CREATE TABLE IF NOT EXISTS `kevineb144_yii1`.`group_rights` (
    `Group_Id` INT NOT NULL,
    `Rights_Id` INT NOT NULL,
    INDEX `Rights_Id_idx` (`Rights_Id` ASC),
    CONSTRAINT `Group_Id`
      FOREIGN KEY (`Group_Id`)
      REFERENCES `kevineb144_yii1`.`group` (`Group_Id`)
      ON DELETE NO ACTION
      ON UPDATE NO ACTION,
    CONSTRAINT `Rights_Id`
      FOREIGN KEY (`Rights_Id`)
      REFERENCES `kevineb144_yii1`.`rights` (`Rights_Id`)
      ON DELETE NO ACTION
      ON UPDATE NO ACTION)
  ENGINE = InnoDB;
  MySQL meldt: Documentatie
  
  #1005 - Can't create table 'kevineb144_yii1.group_rights' (errno: 121) (Details…) 
  </code></pre>