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: You can try SHOW WARNINGS but you will discover more about the error by running the following command as the root superuser:
It returns a dump of the InnoDB's activity. You can see it by unfolding the complete log, if you are interested in the details. The significant part of the log to solve this type of problem is: While this is more information, it isn't necessarily enough to solve the problem when you are new to MySQL. The first place you should look is whether the data types agree between the foreign key and primary key columns. The most common variation that I've run into is where the primary key column uses a int unsigned data type and the foreign key column uses an int data type. It's quite nice that the InnoDB Engine stops this cold. Naturally, you fix it by changing the foreign key data type to match the int unsigned data type.