ERROR 1005: Can't create InnoDB table (errno: 150)

Discussion in 'MySQL' started by sathish5566, Apr 15, 2010.

  1. #1
    Could someone please help me
    #1005 - Can't create table '.\iolcat\user.frm' (errno: 150) :

    CREATE TABLE `iolcat`.`user` (
    `user_id` INT NOT NULL AUTO_INCREMENT ,
    `user_name` VARCHAR( 300 ) NOT NULL ,
    `user_password` VARCHAR( 300 ) NOT NULL ,
    `user_first` VARCHAR( 100 ) NOT NULL ,
    `user_theme` VARCHAR( 100 ) NOT NULL ,
    `role_id` TINYINT( 5 ) NOT NULL ,
    `user_salt1` VARCHAR( 300 ) NOT NULL ,
    `user_salt2` VARCHAR( 300 ) NOT NULL ,
    `user_lastpassword` VARCHAR( 100 ) NOT NULL ,
    `user_account_id` TINYINT( 5 ) NOT NULL ,
    `user_notification` TINYINT( 2 ) NOT NULL DEFAULT '0',
    `user_expire_on` DATE NOT NULL ,
    `user_banned` TINYINT( 2 ) NOT NULL DEFAULT '0',
    `user_banned_reason` VARCHAR( 300 ) NOT NULL ,
    PRIMARY KEY ( `user_id` ) ,
    FOREIGN KEY (user_account_id) REFERENCES user_account(user_account_id),
    FOREIGN KEY (role_id) REFERENCES role(role_id),
    UNIQUE (
    `user_name`
    )
    ) ENGINE = InnoDB

    May i know what problem ..
     
    sathish5566, Apr 15, 2010 IP
  2. edenCC

    edenCC Member

    Messages:
    63
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    41
    #2
    [root@admin~]# perror 150
    MySQL error code 150: Foreign key constraint is incorrectly formed

    You need to pay some attention to these two lines:

    FOREIGN KEY (user_account_id) REFERENCES user_account(user_account_id),
    FOREIGN KEY (role_id) REFERENCES role(role_id),
     
    edenCC, Apr 16, 2010 IP
  3. weaverIT

    weaverIT Peon

    Messages:
    14
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Let me know if this issue still exists
     
    weaverIT, Apr 19, 2010 IP
  4. whiteeaglet

    whiteeaglet Peon

    Messages:
    175
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #4
    You have to turn on InnoDB Engine when creating the DB as well. Go back and check it, did you?
     
    whiteeaglet, Apr 22, 2010 IP
  5. itsupportservice

    itsupportservice Peon

    Messages:
    93
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #5
    I am sure about that if you turn on InnoDB Engine... Then this issue will definitely resolved...!!
     
    itsupportservice, Apr 23, 2010 IP