MySQL TEXT数据的长度
2016-03-18 11:46
435 查看
MySQL TEXT数据的长度
MySQL supports 4 TEXT field types (TINYTEXT, TEXT, MEDIUMTEXT and LONGTEXT) and this post looks at the maximum length of each of these field types.
MyISAM tables in MySQL have a maximum size of a row of 65,535 bytes, so all the data in a row must fit within that limit. However, the TEXT types are stored outside the table itself and only contribute 9 to 12 bytes towards that limit. (For more information about this refer to the MySQL Manual - Data Storage Requirements chapter).
TEXT data types are also able to store much more data than VARCHAR and CHAR text types so TEXT types are what you need to use when storing web page or similar content in a database.
The maximum amount of data that can be stored in each data type is as follows:
TINYTEXT 256 bytes
TEXT 65,535 bytes ~64kb
MEDIUMTEXT 16,777,215 bytes ~16MB
LONGTEXT 4,294,967,295 bytes ~4GB
In most circumstances the TEXT type is probably sufficient, but if you are coding a content management system it’s probably best to use the MEDIUMTEXT type for longer pages to ensure there are no issues with data size limits.
MySQL supports 4 TEXT field types (TINYTEXT, TEXT, MEDIUMTEXT and LONGTEXT) and this post looks at the maximum length of each of these field types.
MyISAM tables in MySQL have a maximum size of a row of 65,535 bytes, so all the data in a row must fit within that limit. However, the TEXT types are stored outside the table itself and only contribute 9 to 12 bytes towards that limit. (For more information about this refer to the MySQL Manual - Data Storage Requirements chapter).
TEXT data types are also able to store much more data than VARCHAR and CHAR text types so TEXT types are what you need to use when storing web page or similar content in a database.
The maximum amount of data that can be stored in each data type is as follows:
TINYTEXT 256 bytes
TEXT 65,535 bytes ~64kb
MEDIUMTEXT 16,777,215 bytes ~16MB
LONGTEXT 4,294,967,295 bytes ~4GB
In most circumstances the TEXT type is probably sufficient, but if you are coding a content management system it’s probably best to use the MEDIUMTEXT type for longer pages to ensure there are no issues with data size limits.
相关文章推荐
- MYSQL5.7.9开启慢查询日志的技巧
- wamp默认配置修改
- MySQL 中文显示乱码以及中文查询条件返回0条结果的问题解决
- MySQL常用配置
- 基础知识收录(三)MYSQL大小写敏感
- 图文:通过sql server 连接mysql
- MySQL灾难恢复实战
- MySQL主主复制实战
- 修改mysql的密码
- mysqldump 参数
- mysql 技巧
- MySQL半同步复制实战
- mysql MyISAM 转 Innodb
- mysql 参数模板
- MySQL 备份与恢复
- mysql分区表
- mysql 创建 报表 slave
- mysql bin_log 配置
- mysql 各个flush 操作
- MySQL复制类型介绍