2

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.

1 Answer 1

1

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)

See SELECT ... INTO OUTFILE

2
  • Does that read the whole blob into memory? Commented Oct 11, 2017 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
    Commented Oct 11, 2017 at 4:38

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.