I've a table with a blob field for each row. The blob contains binary data, which can be represented as bytes or text ( using mysql workbench - open value in viewer)

  1. Does anybody know how can I search specific sequence of bytes in a given bytes chunk(blob field), for example search for the sequence of bytes: 00 38 a7 in blob's binary representation

  2. Is there any possibility to export all table values to csv with blob values in binary representation When I tried to export using mysql workbench I got for each blob ... as a value in csv.


One way...

SELECT ... FROM ... WHERE HEX(blob_col) REGEXP '(..)*0038A7';

The (..)* skips over any number of pairs of the hex digits.

For dumping, see mysqldump --hex-blob (not good for csv)


  • Does that read the whole blob into memory? – Evan Carroll Oct 11 '17 at 0:17
  • @EvanCarroll - Blobs are read in whole, regardless of whether you use LEFT(...) or anything else that one would think could do a shortcut. – Rick James Oct 11 '17 at 4:38

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.