From personal experience, the error ERROR 1005 (HY000) is the result of having foreign key constraints of the same symbol name. It appears that the foreign key constraint cannot have the same symbol in the database - in other words, it must be unique throughout the database, not just the table.
2 posts tagged with "mysql"View All Tags
MySQL Error 1452
This is to help developers who encounter the error ERROR 1452 (23000) in MySQL resolve it.
There can be a few causes to this error. One of the reasons is the newline characters that terminate each line. There are differences between the Windows platform and the Linux-based platforms when terminating each line. Refer to this forum post for more information.
The other reason I found out personally is the existing data in the table. For example, suppose the field in the table was of type VARCHAR(20) and all rows have numeric strings in this field. Even if the field was modified to be an integer type, referencing this field to a numeric field in another table will not work because the data in the rows are character types. Therefore, before the foreign key constraint can be created, the data in the field has to be changed to integer types.