Changing MySQL “INSERT INTO” into “INSERT IGNORE INTO” can solve a lot of headaches when batch importing a lot of records

Inserting a batch of records into MySQL will stop on the first instance the record already exists with a matching PRIMARY KEY. If you’re at risk of this happening, open the .sql file and use your text editor to search for “INSERT INTO” and replace it with “INSERT IGNORE INTO” and this will skip any existing records with the same primary key value without stopping the batch process.

INSERT IGNORE INTO

Simple, yes? But so many people seem to search for this solution. I was aware of it but seldom use it so I had to look it up, that’s why I put it in the MySQL section here on http://tools.belchamber.us so it’s easy to find and be reminded of this solution.

About Author:

Senior Cloud Software Engineer and 25+ years experienced video production, video editing and 3D animation services for a variety of global clients including local video production here in Jacksonville, Florida.

Leave a Comment

Your email address will not be published. Required fields are marked *