Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9222971
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T03:57:43+00:00 2026-06-18T03:57:43+00:00

I have just discovered my database which has been moved between a few servers

  • 0

I have just discovered my database which has been moved between a few servers in the last few months was, in one of the database dumps, converted to myisam and all the foreign key constraints nuked (not impressed). I’ve converted all the tables back to innodb with a php script but now I’m finding half the constraints are failing to add.

Error Code: 1452. Cannot add or update a child row: a foreign key constraint fails (`identicar2`.<result 2 when explaining filename '#sql-2a7_c0'>, CONSTRAINT `#sql-2a7_c0_ibfk_1` FOREIGN KEY (`feature_sk`) REFERENCES `tbl_feature_list` (`feature_sk`))

I’m lost now, I can’t go through thousands of records manually. what is the best thing to do in order to get my database back into shape?

I can provide table structures if you want but I imagine any solution will be independant of the exact structure anyway

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-18T03:57:44+00:00Added an answer on June 18, 2026 at 3:57 am

    The simplest solution: (containing the obvious danger of losing data you may want to keep)

    UPDATE table
    SET fkColumn = NULL
    WHERE fkColumn NOT IN (SELECT referenceColumn FROM referencedTable)
    

    If you just want to find them:

    SELECT *
    FROM table
    WHERE fkColumn NOT IN (SELECT referenceColumn FROM referencedTable)
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a Rails app where users can follow one another. I've just discovered
I have a PHP script with which I want to read servers from database
I have a MySQL dev database, and discovered one of my columns is too
I have just discovered a variable name that is misspelled. If it were hidden
I just discovered the what c# knowledge should I have? question and wondered about
I have a website, and I just discovered that somehow someone injected JavaScript on
In my database i have translation table which contains dictionary for converting unusual Unicode
I have a Database that has the following relations: Transaction->Purchase->Item->Schedule Transaction - self explanitory
I just discovered that my programmer actually loaded the entire SQLite database into lists
I have just discovered the taglist plugin for vim, and read about how to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.