Hi Ravi,
I have reproduced the error like this
case i:
CREATE TABLE IF NOT EXISTS esf_company_config ( esf_config_id int( 11
) NOT NULL AUTO_INCREMENT Primary key , esf_config_company_id int( 11
) NOT NULL , esf_config_name varchar( 10 ) NOT NULL ,
esf_config_status int( 11 ) NOT NULL , FOREIGN KEY (
esf_config_company_id ) REFERENCES esf_company( id ) )
ENGINE = InnoDB DEFAULT CHARSET = latin1 AUTO_INCREMENT =1;
ERROR 1005 (HY000): Can't create table './test/esf_company_config.frm'
(errno: 150)
case ii:
mysql> CREATE TABLE IF NOT EXISTS esf_company_config ( esf_config_id
int( 11 ) NOT NULL AUTO_INCREMENT Primary key , esf_config_company_id
int( 11 ) NOT NULL , esf_config_name varchar( 10 ) NOT NULL ,
esf_config_status int( 11 ) NOT NULL , FOREIGN KEY (
esf_config_company_id ) REFERENCES esf_company( id ) ) ENGINE =
InnoDB;
ERROR 1005 (HY000): Can't create table './test/esf_company_config.frm'
(errno: 150)
case iii:(with out innodb)
mysql> CREATE TABLE IF NOT EXISTS esf_company_config ( esf_config_id
int( 11 ) NOT NULL AUTO_INCREMENT Primary key , esf_config_company_id
int( 11 ) NOT NULL , esf_config_name varchar( 10 ) NOT NULL ,
esf_config_status int( 11 ) NOT NULL , FOREIGN KEY (
esf_config_company_id ) REFERENCES esf_company( id ) );
Query OK, 0 rows affected (0.01 sec)
Have a shot at
http://forums.mysql.com/read.php?22,19755,29094#msg-29094
regards,
Thyagarajan Shanmugham