Long ago I wrote a tool called oak-apply-ri. It is part of the openark-kit, which is generally well accepted. I'm beginning with the disclaimer that this tool is less popular, and I don't have much input about it (other than my own).
Nevertheless, it allows you to specify two tables that share a FK relationship, and it will verify whether the constraint holds.
You can ask it to actually resolve the differences via --action=delete
or --action=setnull
.
If you are suspicious, you may ask it to --print-only
in which case it will not apply any changes to your database; instead it will print out the statements it would like to invoke on the database.
I'm happy to get any feedback on this.