What is VARBINARY in MySQL?
Emily Wong
Updated on March 08, 2026
What is VARBINARY in MySQL?
The BINARY and VARBINARY types are similar to CHAR and VARCHAR , except that they store binary strings rather than nonbinary strings. This means they have the binary character set and collation, and comparison and sorting are based on the numeric values of the bytes in the values.
What is a VARBINARY data type?
The VARBINARY type is similar to the VARCHAR type, but stores binary byte strings rather than non-binary character strings. It contains no character set, and comparison and sorting are based on the numeric value of the bytes.
What is Longblob data type?
LONGBLOB: A binary large object column with a maximum length of 4294967295 (2^32 – 1) bytes, or 4GB in storage. Each LONGBLOB value is stored using a four-byte length prefix that indicates the number of bytes in the value.
Is VARBINARY a BLOB?
Ultimately, VARBINARY is virtually the same as BLOB (from the perspective of what can be stored in it), unless you want to preserve compatibility with “old” versions of MySQL. In most respects, you can regard a BLOB column as a VARBINARY column that can be as large as you like.
What is the difference between binary and VARBINARY?
Both BINARY and VARBINARY are both binary byte data types. But they have the following major differences: BINARY stores values in fixed lengths. VARBINARY stores values in variable lengths.
What is the difference between VARBINARY and binary?
Both BINARY and VARBINARY are both binary byte data types. BINARY stores values in fixed lengths. Values are padded with 0x00. VARBINARY stores values in variable lengths.
What is BLOB data in MySQL?
A BLOB is a binary large object that can hold a variable amount of data. BLOB values are treated as binary strings (byte strings). They have the binary character set and collation, and comparison and sorting are based on the numeric values of the bytes in column values.
What is BLOB full form?
BLOB stands for binary large objects, which are used for storing binary data, such as an image.
What is the difference between BLOB and VARBINARY in SQL Server?
1 Answer. VARCHAR or VARBINARY types are not optimal types for storing files of several kilobytes. You can use the BLOB type. The difference between this and VARBINARY is the dedicated storage mechanism for large object used for BLOB and CLOB.
What are binary and varbinary types in MySQL?
MySQL 5.7 Reference Manual / / The BINARY and VARBINARY types are similar to CHAR and VARCHAR, except that they store binary strings rather than nonbinary strings. That is, they store byte strings rather than character strings.
What are the string types in mymysql?
MySQL 5.7 Reference Manual / Data Types / String Types / The BINARY and VARBINARY Types. The BINARY and VARBINARY types are similar to CHAR and VARCHAR, except that they contain binary strings rather than nonbinary strings. That is, they contain byte strings rather than character strings.
When should I use varbinary or BLOB data types?
If the value retrieved must be the same as the value specified for storage with no padding, it might be preferable to use VARBINARY or one of the BLOB data types instead. Within the mysql client, binary strings display using hexadecimal notation, depending on the value of the –binary-as-hex.
What is the difference between binary and varbinary?
The BINARY and VARBINARY types are similar to CHAR and VARCHAR, except that they store binary strings rather than nonbinary strings. That is, they store byte strings rather than character strings. This means they have the binary character set and collation, and comparison and sorting are based on the numeric values of the bytes in the values.