Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

I only get set the text field in MySQL to 255, if I want to store a data longer than 255 chars, what can I do?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
565 views
Welcome To Ask or Share your Answers For Others

1 Answer

Prior to MySQL 5.0.3, a VARCHAR could only store up to 255 characters.

  • To store up to 65535 (64KB) characters, use a TEXT column.
  • To store up to 16777216 (16MB ) characters, use a MEDIUMTEXT column.
  • To store up to 4294967296 (4GB) characters, use a LONGTEXT column.

See the storage requirements section of the manual for caveats on their usage.

Versions of MySQL after 5.0.3 can store up to 65535 chars in a VARCHAR (However you cannot store more than 65535 bytes in a single row).


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...