troubleshooting Question

MySQL FK Constraint Error (1451) - But I have no FKs!

Avatar of apj68
apj68 asked on
MySQL Server
7 Comments2 Solutions1895 ViewsLast Modified:
This is driving me crazy.  My table has no foreign keys and no indices but when I try to delete rows, I get:

Error Code: 1451. Cannot delete or update a parent row: a foreign key constraint fails (temp file operation failed)

This table used to have constraints, but I removed them.  I did refresh MySql workbench and also reconnected with the client.  If I describe the table, it does not show constraints other than the PK.

select * from information_schema.table_constraints
where table_schema = schema()
and table_name = 'AppVersion';

NULL, 'cmdb', 'PRIMARY', 'cmdb', 'AppVersion', 'PRIMARY KEY'

show create table AppVersion;

'AppVersion', 'CREATE TABLE `AppVersion` (
  `appVersionID` int(11) NOT NULL AUTO_INCREMENT,
  `Environment_environmentID` int(11) NOT NULL,
  `rollback_version` varchar(45) NOT NULL,
  `app_version` varchar(45) NOT NULL,
  PRIMARY KEY (`appVersionID`)

The table that originally had the FK (Environment) in the AppVersion has nothing either:

show create table Environment

'Environment', 'CREATE TABLE `Environment` (
  `environmentID` int(11) NOT NULL AUTO_INCREMENT,
  `env_name` varchar(45) DEFAULT NULL,
  PRIMARY KEY (`environmentID`)

Is there something I need to do to shake out that old constraint??  Thanks for your suggestions!

Pieter Marais
Senior Developer

Our community of experts have been thoroughly vetted for their expertise and industry experience.

Join our community to see this answer!
Unlock 2 Answers and 7 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 2 Answers and 7 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros