Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
593 views
in Technique[技术] by (71.8m points)

sql - How to store more than 255 char in MySQL database?

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

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

1 Reply

0 votes
by (71.8m points)

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).


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...