If you are using referential integrity on MySQL, you can easily run into this error with the InnoDB engine.
It frequently seems to occur with an ALTER TABLE statement. It can mean many things but typically it means the data types don? match between the foreign key and primary key column. Likewise, it can mean one of the column data types disagrees in a multiple-column foreign to multiple-column primary key constraint.
The error by itself isn't very handy. This is a sample:
ERROR 1005 (HY000): Can't create table 'my_data' (errno: 150)
mysql> SHOW engine innodb STATUS;
------------------------
LATEST FOREIGN KEY ERROR
------------------------
1001111 13:11:00 Error IN FOREIGN KEY CONSTRAINT OF TABLE my_data :
FOREIGN KEY(id2)
REFERENCES pk(test1):
Cannot find an INDEX IN the referenced TABLE WHERE the
referenced COLUMNS appear AS the FIRST COLUMNS, OR COLUMN types
IN the TABLE AND the referenced TABLE do NOT MATCH FOR CONSTRAINT.