Wednesday, July 19, 2017

MySQL 5.5 ERROR 1217 (23000): Cannot delete or update a parent row: a foreign key constraint fails


>PROBLEM

Running the script like this:
  \. myScript.sql
fails and returns the message:
  ERROR 1217 (23000): Cannot delete or update a parent row: a foreign key constraint fails

Nevertheless, if running the command straight on the console, it may work.



>SOLUTION

This issue was solved checking the file's encoding versus the database encoding and matching them.
So, the database was UTF-8, and the script was using the same encoding.



>ENV
Windows
MySQL 5.5

No comments:

Post a Comment

eclipse: java: SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder" or Exception in thread "main" java.lang.NoClassDefFoundError: org/slf4j/impl/StaticLoggerBinder

  >PROBLEM Using Eclipse, you try to run a simple logging test using "org.slf4j.Logger" like the sample below: package Test; im...