如何在MySQL数据库中存储超过255个字符? [英] How to store more than 255 char in MySQL database?

查看:639
本文介绍了如何在MySQL数据库中存储超过255个字符?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我只能将MySQL中的文本字段设置为255,如果我想存储长度超过255个字符的数据,我该怎么办?

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?

推荐答案

MySQL 5.0.3之前的

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

  • 要存储最多65535(64KB)个字符,请使用 TEXT 列.
  • 要存储最多16777216(16MB)个字符,请使用 MEDIUMTEXT 列.
  • 要存储最多4294967296(4GB)字符,请使用 LONGTEXT 列.
  • 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.

5.0.3之后的MySQL版本可以在VARCHAR中存储多达65535个字符(但是,在一行中不能存储超过65535个字节).

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

这篇关于如何在MySQL数据库中存储超过255个字符?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆