MySQL doesn’t have a native CLOB (Character Large Object) data type exactly like some other databases such as Oracle. MySQL offers the TEXT family of data types, which can be considered similar to CLOB. The LONGTEXT type can store up to 4GB of text data. More: MySQL TEXT (CLOB).
| Type in MySQL / MariaDB | Maximum size |
|---|---|
TINYTEXT | 255 bytes |
TEXT | 64 KB |
MEDIUMTEXT | 16 MB |
LONGTEXT | 4 GB |
MySQL has no type called CLOB - the TEXT family takes its place. Both measure length in bytes, but TEXT is decoded with the column character set and takes part in sorting and comparison, while BLOB is treated as opaque binary.
The ceiling you actually hit is not the 4 GB column limit but max_allowed_packet (4 MB by default on MySQL 5.7, 64 MB on 8.0). A single value larger than that fails at the protocol layer.
mysqldump (writes BLOBs as hex by default) or SELECT ... INTO DUMPFILELOAD_FILE() - restricted by secure_file_priv - or mysqlimportmax_allowed_packet at its default and the 4 GB LONGBLOB ceiling is unreachablecol(255)mysqldump writes BLOB values as hex literals, so the dump is about twice the size of the data; --hex-blob just makes that explicitROW_FORMAT=COMPACT or REDUNDANT only 768 bytes stay in the row