Pranav
Pranav

Reputation: 143

Store large content in MySql

Hi I am trying to store large data content in mysql database. For that i set Datatype as TEXT but still it limits to store the data. So what will be the solution for string large content in Mysql tables and retrieve the same.

I am storing news description in one of my mysql table.

Suggest!!! Thanks.

Upvotes: 0

Views: 1690

Answers (4)

namhd
namhd

Reputation: 337

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

TINYBLOB, TINYTEXT       L + 1 bytes, where L < 2^8    (255 Bytes)
BLOB, TEXT               L + 2 bytes, where L < 2^16   (64 Kilobytes)
MEDIUMBLOB, MEDIUMTEXT   L + 3 bytes, where L < 2^24   (16 Megabytes)
LONGBLOB, LONGTEXT       L + 4 bytes, where L < 2^32   (4 Gigabytes)

Upvotes: 2

The TEXT datatype is far more than enough. Seems like you are not satisfied, so go for BLOB (Binary Large Objects)

Upvotes: 0

Jenson M John
Jenson M John

Reputation: 5689

VARCHAR is limited to 255 characters in all mysql versions <= 5.0.3

Various Types of TEXT fields : TINYTEXT, TEXT, MEDIUMTEXT, LONGTEXT.

TINYTEXT    256 bytes    
TEXT    65,535 bytes    ~64kb
MEDIUMTEXT   16,777,215 bytes   ~16MB
LONGTEXT    4,294,967,295 bytes     ~4GB

A BLOB can be 65535 bytes maximum. MEDIUMBLOB for 16777215 bytes or a LONGBLOB for 4294967295 bytes.

Difference between TEXT & BLOB : BLOB is used for storing binary data & TEXT is used to store large strings.

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

Upvotes: 0

dev
dev

Reputation: 439

you may need to change maximum allowed packet size: http://dev.mysql.com/doc/refman/5.0/en/server-system-variables.html#sysvar_max_allowed_packet

Upvotes: 0

Related Questions