try
mysql --force < sample_data.sql Mysql help section says -f, --force Continue even if we get an sql error.----------------------You could also use INSERT IGNOREINSERT IGNORE INTO mytable (primaryKey, field1, field2)VALUES ('1', 1, 2), ('1', 3, 4), //will not be inserted ('2', 5, 6); //will be inserted----------------------You can use INSERT... IGNORE syntax if you want to take no action when there's a duplicate record.You can use REPLACE INTO syntax if you want to overwrite an old record with a new one with the same key.Or, you can use INSERT... ON DUPLICATE KEY UPDATE syntax if you want to perform an update to the record instead when you encounter a duplicate.----------------------
REF: