0

While importing a mysqldump into a Galera cluster get an error message refering to duplicate error, referencing a line.

How do I echo out the particilar line in order to check the source table?

Import:

zcat DB_150909.sql.gz | mysql -u root -p test

I get this error:

ERROR 1062 (23000) at line 2412: Duplicate entry '329610-2011-03-27 03:00:00' for key 'user_id'
merlin
  • 2,093
  • 11
  • 39
  • 78

1 Answers1

2

I would do something like this:

zcat DB_150909.sql.gz | sed '2412q;d'
pehrs
  • 8,789
  • 1
  • 30
  • 46
  • I agree with the principal but would this cause problems if --extened-insert had been used ? – user9517 Sep 09 '15 at 11:16
  • 1
    No, @iain, that's not a problem, because the line number in the error will be the actual line number from the file, as determined by counting newlines (not statements). It could be up to a megabyte long with `--extended-insert` but it should be the correct line number. – Michael - sqlbot Sep 09 '15 at 23:53