473,322 Members | 1,352 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,322 software developers and data experts.

#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.


Expand|Select|Wrap|Line Numbers
  1. SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0;
  2.  
  3. SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0;
  4.  
  5. SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='TRADITIONAL';
  6.  
  7.  
  8.  
  9. CREATE SCHEMA IF NOT EXISTS `db_sp15g08` DEFAULT CHARACTER SET latin1 COLLATE latin1_swedish_ci ;
  10.  
  11.  
  12.  
  13. -- -----------------------------------------------------
  14.  
  15. -- Table `db_sp15g08`.`Member`
  16.  
  17. -- -----------------------------------------------------
  18.  
  19. CREATE  TABLE IF NOT EXISTS `db_sp15g08`.`Member` (
  20.  
  21.   `memberid` INT NOT NULL AUTO_INCREMENT ,
  22.  
  23.   `name` VARCHAR(45) NOT NULL ,
  24.  
  25.   `email` VARCHAR(45) NOT NULL ,
  26.  
  27.   `bonus` INT NOT NULL ,
  28.  
  29.   PRIMARY KEY (`memberid`) )
  30.  
  31. ENGINE = InnoDB;
  32.  
  33.  
  34.  
  35.  
  36.  
  37. -- -----------------------------------------------------
  38.  
  39. -- Table `db_sp15g08`.`MovieDetails`
  40.  
  41. -- -----------------------------------------------------
  42.  
  43. CREATE  TABLE IF NOT EXISTS `db_sp15g08`.`MovieDetails` (
  44.  
  45.   `videoid` INT NOT NULL ,
  46.  
  47.   `title` VARCHAR(45) NOT NULL ,
  48.  
  49.   `rentalprice` DECIMAL(10,2) NOT NULL ,
  50.  
  51.   `saleprice` DECIMAL(10,2) NOT NULL ,
  52.  
  53.   `rentnumber` INT NOT NULL ,
  54.  
  55.   `salenumber` INT NOT NULL ,
  56.  
  57.   PRIMARY KEY (`videoid`) )
  58.  
  59. ENGINE = InnoDB;
  60.  
  61.  
  62.  
  63.  
  64.  
  65. -- -----------------------------------------------------
  66.  
  67. -- Table `db_sp15g08`.`RentalCopy`
  68.  
  69. -- -----------------------------------------------------
  70.  
  71. CREATE  TABLE IF NOT EXISTS `db_sp15g08`.`RentalCopy` (
  72.  
  73.   `copyid` INT NOT NULL AUTO_INCREMENT ,
  74.  
  75.   `returndate` DATE NOT NULL ,
  76.  
  77.   `videoid` INT NOT NULL ,
  78.  
  79.   `memberid` INT NOT NULL ,
  80.  
  81.   PRIMARY KEY (`copyid`) ,
  82.  
  83.   INDEX `videoid` (`videoid` ASC) ,
  84.  
  85.   INDEX `memberid` (`memberid` ASC) ,
  86.  
  87.   CONSTRAINT `videoid`
  88.  
  89.     FOREIGN KEY (`videoid` )
  90.  
  91.     REFERENCES `db_sp15g08`.`MovieDetails` (`videoid` )
  92.  
  93.     ON DELETE NO ACTION
  94.  
  95.     ON UPDATE NO ACTION,
  96.  
  97.   CONSTRAINT `memberid`
  98.  
  99.     FOREIGN KEY (`memberid` )
  100.  
  101.     REFERENCES `db_sp15g08`.`Member` (`memberid` )
  102.  
  103.     ON DELETE NO ACTION
  104.  
  105.     ON UPDATE NO ACTION)
  106.  
  107. ENGINE = InnoDB;
  108.  
  109.  
  110.  
  111.  
  112.  
  113. -- -----------------------------------------------------
  114.  
  115. -- Table `db_sp15g08`.`SalesCopy`
  116.  
  117. -- -----------------------------------------------------
  118.  
  119. CREATE  TABLE IF NOT EXISTS `db_sp15g08`.`SalesCopy` (
  120.  
  121.   `salesid` INT NOT NULL AUTO_INCREMENT ,
  122.  
  123.   `memberid` INT NOT NULL ,
  124.  
  125.   `videoid` INT NOT NULL ,
  126.  
  127.   PRIMARY KEY (`salesid`) ,
  128.  
  129.   INDEX `memberid` (`memberid` ASC) ,
  130.  
  131.   INDEX `videoid` (`videoid` ASC) ,
  132.  
  133.   CONSTRAINT `memberid`
  134.  
  135.     FOREIGN KEY (`memberid` )
  136.  
  137.     REFERENCES `db_sp15g08`.`Member` (`memberid` )
  138.  
  139.     ON DELETE NO ACTION
  140.  
  141.     ON UPDATE NO ACTION,
  142.  
  143.   CONSTRAINT `videoid`
  144.  
  145.     FOREIGN KEY (`videoid` )
  146.  
  147.     REFERENCES `db_sp15g08`.`MovieDetails` (`videoid` )
  148.  
  149.     ON DELETE NO ACTION
  150.  
  151.     ON UPDATE NO ACTION)
  152.  
  153. ENGINE = InnoDB;
  154.  
  155.  
  156.  
  157.  
  158.  
  159.  
  160.  
  161. SET SQL_MODE=@OLD_SQL_MODE;
  162.  
  163. SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS;
  164.  
  165. SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS;

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

Thanks
Apr 8 '10 #1
3 4579
code green
1,726 Expert 1GB
Have you tried building each step individually?
Try with one table, then two etc...
The error message may be misleading
Apr 9 '10 #2
@code green
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
Apr 9 '10 #3
code green
1,726 Expert 1GB
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
Apr 9 '10 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: Morten Gulbrandsen | last post by:
USE company; DROP TABLE IF EXISTS EMPLOYEE; CREATE TABLE EMPLOYEE ( # PK SSN CHAR(9) NOT NULL, # FK SUPERSSN CHAR(9), DNO INT NOT NULL DEFAULT 1, CONSTRAINT EMPPK
0
by: CoOL! . | last post by:
Hello, I found the key to solve this problem in: http://darkstar.ist.utl.pt/mysql/doc/en/InnoDB_foreign_key_constraints.html You'll probably need an INDEX for that new foreign key you are...
0
by: Morten Gulbrandsen | last post by:
mysql> USE company; Database changed mysql> mysql> DROP TABLE IF EXISTS EMPLOYEE; -------------- DROP TABLE IF EXISTS EMPLOYEE -------------- Query OK, 0 rows affected (0.00 sec)
0
by: NW | last post by:
Hi I had error message "Can't create table *.frm (errno:121)" when I was trying to create an innoDB table in MySQL Server 4.0.15. I know that the reason is the .frm files was deleted by some one...
6
by: Amir Hardon | last post by:
I'm new to DOM and can't figure out this thing: I'm trying to add a row to a table with a form field in one of it's cells, but if I'm appending the field to a form it gets out of the table. Can...
1
by: Andy Fish | last post by:
Hi, I read in the mysql manual that it's possible to copy the 'frm' files from one mysql server to another, but when I try to do this I get the error "Can't open file: 'mytable.ibd' (errno: 1)"...
2
by: jith87 | last post by:
This is MySql lang...Link nt able to poen so i ve posted here.. What is error 1005 Can't create table (errno:150)....... There is a field X in a table Y. This X field has to be accessed by another...
6
by: daveftl | last post by:
Good day to all...i always have this error after making an ALTER command ... #1005 - Can't create table '.\_ftl\#sql-918_f.frm' (errno: 150) whats the cause of this error...thanks in advance..
2
by: jarea | last post by:
I have read quite a bit about this error but I have yet to find the solution to my problem. I am trying to execute the following mysql statement: alter table line_items add...
9
by: AmiMitra | last post by:
i am using mysql 5.1. i have one table named as resv_record. the format is create table resv_record ( book enum('h','c','r','f','t') , resv_id int(8) auto_increment not null , user_id varchar(12)...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.