MySQL Forums
Forum List  »  InnoDB

ERROR 1005 (HY000): Can't create table 'mokrig.areas' (errno: 150)
Posted by: Mauro Mattana
Date: October 08, 2008 10:38AM

I new in mysql :D
I'm creating my database for store info about game but i'm in trouble when i create table "Areas" with FOREIGN KEY. I don't know how to solve problem.
When i create it i get this error "ERROR 1005 (HY000): Can't create table 'mokrig.areas' (errno: 150)"

I'm using Mysql 5.1.28-rc.


CREATE TABLE User
(
UserID CHAR(20) PRIMARY KEY,
password CHAR(32) NOT NULL,
email varchar(40) NOT NULL UNIQUE,
Race SET ('elf','human','ork','dwarf') NOT NULL,
Gold SMALLINT UNSIGNED DEFAULT 0,
Plus DATETIME DEFAULT '2008-01-01 01:01:01',
INDEX (UserID, email)
)
ENGINE = InnoDB;


CREATE TABLE Areas
(
X TINYINT NOT NULL,
Y TINYINT NOT NULL,
VillageName CHAR(20) UNIQUE,
Belong CHAR(20),
Resouce01 INT UNSIGNED NOT NULL DEFAULT 1000,
Resouce02 INT UNSIGNED NOT NULL DEFAULT 1000,
Resouce03 INT UNSIGNED NOT NULL DEFAULT 1000,
Resouce04 INT UNSIGNED NOT NULL DEFAULT 1000,
PlusOn DATETIME,
INDEX (X, Y, VillageName, Belong),
PRIMARY KEY (X, Y),
FOREIGN KEY (Belong) REFERENCES User (UserID) ON UPDATE CASCADE ON DELETE CASCADE,
FOREIGN KEY (PlusOn) REFERENCES User (Plus) ON UPDATE CASCADE ON DELETE CASCADE
)
ENGINE = InnoDB;

If i cut this line "FOREIGN KEY (PlusOn) REFERENCES User (Plus) ON UPDATE CASCADE ON DELETE CASCADE" i can create the table.

This problem appear with 3 datatype: DATATIME, ENUM, SET.

Sorry for my english :/

Regard Mauro

Options: ReplyQuote


Subject
Views
Written By
Posted
ERROR 1005 (HY000): Can't create table 'mokrig.areas' (errno: 150)
9717
October 08, 2008 10:38AM
3450
October 10, 2008 04:18AM
2904
October 12, 2008 04:57PM
2311
October 13, 2008 11:58AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.