PostgreSQL → MySQL
Convert PostgreSQL bytea to MySQL
Binary columns translate to LONGBLOB, the size-safe choice. The bytes are identical; only the literal syntax differs between the engines.
bytea → LONGBLOB
What to know
- bytea → LONGBLOB; content preserved byte-for-byte
- '\x48656c6c6f' hex literals become 0x48656c6c6f in MySQL dumps
- max_allowed_packet on the target server must exceed your largest value
- Consider object storage for multi-megabyte payloads in either engine
Before / after
PostgreSQL
raw bytea
-- value: \x48656c6c6f MySQL
raw LONGBLOB
-- value: 0x48656C6C6F 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 PostgreSQL → MySQL converterSee the full type mapping table or all guides.