If you have encountered this error, this is maybe because:
- There is a table within another schema (“database” in mysql terminology) which has a FK reference
- The innodb internal data dictionary is out of sync with the mysql one.
To apply your queries, simply bypass foreign keys security check.
This is the solution:
SET FOREIGN_KEY_CHECKS=0; YOUR_QUERY here
After your queries have been done, reset to default foreign keys security check: