#1005 - Can't create table './db_sp15g08/SalesCopy.frm' (errno: 121)

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • SteveP26
    New Member
    • Apr 2010
    • 2

    #1

    #1005 - Can't create table './db_sp15g08/SalesCopy.frm' (errno: 121)

    Hi guys,

    I keep getting this error message (below) when I try to run the sql query for my database
    #1005 - Can't create table './db_sp15g08/SalesCopy.frm' (errno: 121)
    Heres the code, but the error message only applies to the LAST table (SalesCopy), I have no clue how its any different than the others.


    [code=sql]SET @OLD_UNIQUE_CHE CKS=@@UNIQUE_CH ECKS, UNIQUE_CHECKS=0 ;

    SET @OLD_FOREIGN_KE Y_CHECKS=@@FORE IGN_KEY_CHECKS, FOREIGN_KEY_CHE CKS=0;

    SET @OLD_SQL_MODE=@ @SQL_MODE, SQL_MODE='TRADI TIONAL';



    CREATE SCHEMA IF NOT EXISTS `db_sp15g08` DEFAULT CHARACTER SET latin1 COLLATE latin1_swedish_ ci ;



    -- -----------------------------------------------------

    -- Table `db_sp15g08`.`M ember`

    -- -----------------------------------------------------

    CREATE TABLE IF NOT EXISTS `db_sp15g08`.`M ember` (

    `memberid` INT NOT NULL AUTO_INCREMENT ,

    `name` VARCHAR(45) NOT NULL ,

    `email` VARCHAR(45) NOT NULL ,

    `bonus` INT NOT NULL ,

    PRIMARY KEY (`memberid`) )

    ENGINE = InnoDB;





    -- -----------------------------------------------------

    -- Table `db_sp15g08`.`M ovieDetails`

    -- -----------------------------------------------------

    CREATE TABLE IF NOT EXISTS `db_sp15g08`.`M ovieDetails` (

    `videoid` INT NOT NULL ,

    `title` VARCHAR(45) NOT NULL ,

    `rentalprice` DECIMAL(10,2) NOT NULL ,

    `saleprice` DECIMAL(10,2) NOT NULL ,

    `rentnumber` INT NOT NULL ,

    `salenumber` INT NOT NULL ,

    PRIMARY KEY (`videoid`) )

    ENGINE = InnoDB;





    -- -----------------------------------------------------

    -- Table `db_sp15g08`.`R entalCopy`

    -- -----------------------------------------------------

    CREATE TABLE IF NOT EXISTS `db_sp15g08`.`R entalCopy` (

    `copyid` INT NOT NULL AUTO_INCREMENT ,

    `returndate` DATE NOT NULL ,

    `videoid` INT NOT NULL ,

    `memberid` INT NOT NULL ,

    PRIMARY KEY (`copyid`) ,

    INDEX `videoid` (`videoid` ASC) ,

    INDEX `memberid` (`memberid` ASC) ,

    CONSTRAINT `videoid`

    FOREIGN KEY (`videoid` )

    REFERENCES `db_sp15g08`.`M ovieDetails` (`videoid` )

    ON DELETE NO ACTION

    ON UPDATE NO ACTION,

    CONSTRAINT `memberid`

    FOREIGN KEY (`memberid` )

    REFERENCES `db_sp15g08`.`M ember` (`memberid` )

    ON DELETE NO ACTION

    ON UPDATE NO ACTION)

    ENGINE = InnoDB;





    -- -----------------------------------------------------

    -- Table `db_sp15g08`.`S alesCopy`

    -- -----------------------------------------------------

    CREATE TABLE IF NOT EXISTS `db_sp15g08`.`S alesCopy` (

    `salesid` INT NOT NULL AUTO_INCREMENT ,

    `memberid` INT NOT NULL ,

    `videoid` INT NOT NULL ,

    PRIMARY KEY (`salesid`) ,

    INDEX `memberid` (`memberid` ASC) ,

    INDEX `videoid` (`videoid` ASC) ,

    CONSTRAINT `memberid`

    FOREIGN KEY (`memberid` )

    REFERENCES `db_sp15g08`.`M ember` (`memberid` )

    ON DELETE NO ACTION

    ON UPDATE NO ACTION,

    CONSTRAINT `videoid`

    FOREIGN KEY (`videoid` )

    REFERENCES `db_sp15g08`.`M ovieDetails` (`videoid` )

    ON DELETE NO ACTION

    ON UPDATE NO ACTION)

    ENGINE = InnoDB;







    SET SQL_MODE=@OLD_S QL_MODE;

    SET FOREIGN_KEY_CHE CKS=@OLD_FOREIG N_KEY_CHECKS;

    SET UNIQUE_CHECKS=@ OLD_UNIQUE_CHEC KS;[/code]


    I have been using MySQL Workbench, Im tryin to use it in phpMyAdmin.

    Thanks
    Last edited by Atli; Apr 8 '10, 10:47 PM. Reason: Added [code] tags.
  • code green
    Recognized Expert Top Contributor
    • Mar 2007
    • 1726

    #2
    Have you tried building each step individually?
    Try with one table, then two etc...
    The error message may be misleading

    Comment

    • SteveP26
      New Member
      • Apr 2010
      • 2

      #3
      Originally posted by code green
      Have you tried building each step individually?
      Try with one table, then two etc...
      The error message may be misleading
      Hi,

      yeah I have tried building each table seperately, the first two tables work fine. But the last two dont seem to work when I build them, maybe its something to do with the foreign keys?

      Keeps coming up with the same error message, is there anythin in the code that has an error or something?

      Thanks for helping btw

      Comment

      • code green
        Recognized Expert Top Contributor
        • Mar 2007
        • 1726

        #4
        I can't see anything.
        The only approach i can see is remove all but the simple field creation, then add INDEX, CONSTRAINT one at a time.
        It could be a syntax, mis-named or illegal. Difficult

        Comment

        Working...