user499054
user499054

Reputation:

Max of 4kB for MySQL text column?

How can I have a max length of 4096 bytes for a MySQL text or blob column? Is this even possible?

Upvotes: 0

Views: 2293

Answers (1)

Ass3mbler
Ass3mbler

Reputation: 3915

No, check this page:

http://dev.mysql.com/doc/refman/5.0/en/storage-requirements.html

You can use maybe VARCHAR or VARBINARY instead of the TEXT or BLOB field. For VARHCHAR and VARBINARY you can specify a length of 4096 if you want. Example: MYSTRING VARCHAR(4096);. But pay attention that, as the manual says:

The effective maximum length of a VARCHAR in MySQL 5.0.3 and later is subject to the maximum row size (65,535 bytes, which is shared among all columns) and the character set used.

So if you use a lot of large columns, you must be sure to stay under the 64k limit for a row

Upvotes: 2

Related Questions