A BLOB is a binary large object that can store a variable amount of data.
BLOB types are classified into TINYBLOB, BLOB, MEDIUMBLOB, and LONGBLOB. The maximum length of stored values is different for the four types.
BLOB values are treated as binary strings (or byte strings) that use the binary character set and collation. Comparison and sorting are based on the numeric values of bytes in the column values.
When strict SQL mode is not enabled, if the value assigned to a BLOB column exceeds the maximum length of the column, the excess part of the value is truncated, and an alert is generated. In strict SQL mode, if non-space characters are truncated, an error instead of an alert occurs, and the insertion of the value is prohibited.
TINYBLOB
The maximum length of a TINYBLOB column is 255 bytes.
The syntax of TINYBLOB is as follows:
TINYBLOB
BLOB
The maximum length of a BLOB column is 65,535 bytes.
You can specify an optional length M for a BLOB column. The syntax is as follows:
BLOB[(M)]
MEDIUMBLOB
The maximum length of a MEDIUMBLOB column is 16,777,215 bytes.
The syntax of MEDIUMBLOB is as follows:
MEDIUMBLOB
LONGBLOB
The maximum length of a LONGBLOB column is 536,870,910 bytes. The maximum length of the LONGBLOB column also depends on the maximum packet size and available memory configured in the client/server protocol.
The syntax of LONGBLOB is as follows:
LONGBLOB