Skip to main content

View Contents of BLOB (Tickler)

BLOBs in MySQL

BLOBs or Binary Large OBjects are a useful datatype in relational databases for certain use-cases.

For example storing a profile image for a user of the system.

I have also seen databases that use them for storing large amounts of sensitive or encrypted data.

Sometimes we need to see the contents of the BLOB. Use a command like this to do so, and remember to choose the character encoding.

MySQL:

SELECT CONVERT(blob_column USING latin1) FROM mytable;

SELECT CONVERT(blob_column USING utf8) FROM mytable;

These "memory tickler" posts are quick-hits to refresh my mind about little technical details that arise infrequently enough that I forget in between, and wind up doing an internet search every time. By posting them here, they will be easier to find as needed.)