MySQL → PostgreSQL
Convert MySQL BLOB to PostgreSQL bytea
Binary data maps from MySQL's BLOB family to PostgreSQL's single bytea type. Content is preserved byte-for-byte.
BLOB / VARBINARY → bytea
What to know
- BINARY, VARBINARY, TINYBLOB…LONGBLOB → bytea
- bytea literals use hex: '\x89504e47…'
- Client libraries return bytes/Buffer objects in both engines — application code rarely changes
- For files larger than ~10 MB consider object storage instead of either database
Before / after
MySQL
CREATE TABLE files (
data LONGBLOB
); PostgreSQL
CREATE TABLE files (
data bytea
); Don't convert column-by-column — convert the whole database.
Upload a dump, get back ready-to-import SQL with this mapping (and every other one) applied.
Open the MySQL → PostgreSQL converterSee the full type mapping table or all guides.