bashbackupmysqlmysql-error-1062

How to skip row when importing bad MySQL dump


Given bad mysqldump that causes error on import:

namtar backups # mysql -p < 2010-12-01.sql
Enter password: 
ERROR 1062 (23000) at line 8020: Duplicate entry 'l�he?' for key 'wrd_txt'

Is there an easy way to tell import to just skip given row and continue?

(Yes, I know I can manually edit the file or parse output, but it's not very convinient)


Solution

  • If you can make the dump again you could add --insert-ignore to the command-line when dumping.

    Or you can try using the mysqlimport command with --force,which will continue even if it encounters MySQL Errors.